notes by alifeee profile picture tagged linux (5) rss

return to notes / blog / website / weeknotes / linktree

here I may post some short, text-only notes, mostly about programming. source code.

tags: all (44) scripting (13) linux (5) bash (4) geojson (4) obsidian (4) android (3) github (3) html (3) jq (3) ............ see all (+63)

installing Waydroid, an Android emulator, on Linux # prev single next top

tags: linux, Android, installation • 645 'words', 194 secs @ 200wpm

I wanted to use Android on Linux, so I searched the web and found https://waydro.id/.

Instead of running in some kind of virtual machine, it seems to run Android slightly more natively on Linux (I really don't know how any of this works).

Here is a small adventure at trying to install it:

Official installation guide

Following steps from https://docs.waydro.id/usage/install-on-desktops#ubuntu-debian-and-derivatives (I'm on Pop!_OS which I think is based on Debian).

$ sudo apt install curl ca-certificates
$ curl -s https://repo.waydro.id | sudo bash
$ sudo apt install waydroid
$ waydroid init
[11:27:05] Failed to load binder driver
[11:27:05] modprobe: FATAL: Module binder_linux not found in directory /lib/modules/6.13.0-061300-generic
[11:27:05] ERROR: Binder node "binder" for waydroid not found
[11:27:05] See also: https://github.com/waydroid

I don't really know what this error meant, but after searching, it seemed that Waydroid needed "wayland" and I was using X (which are both Desktop thingies which make pixels appear on the screen). I read things about Pop!_OS not having something necessary installed in the kernel, but I could use "DKMS", meaning Dynamic Kernel Module Support. So I tried installing what I'd found links to with:

git clone https://github.com/choff/anbox-modules
cd anbox-modules && ./INSTALL.sh

now when I ran waydroid init it worked, but then I got nothing. I wasn't really sure what I was supposed to be doing to "open" it now that it was "init"'d. So I deleted all I could with

$ sudo apt remove waydroid
$ sudo find / -type d -name "waydroid"
/var/lib/waydroid
$ rm -rf /var/lib/waydroid

…and found a helper script to do stuff for me.

Installation script

The script I found was https://github.com/n1lby73/waydroid-installer, which I ran with

git clone https://github.com/n1lby73/waydroid-installer
cd waydroid-installer
sudo bash install_script.sh

The script didn't complete, and complained about modules not installing, specifically that lxd-client could not be installed.

Looking at the script I saw it was trying to run apt install lxd-client but running that myself, it seemed that it didn't exist:

$ sudo apt install lxd-client
E: Unable to locate package lxd-client

After searching, it seems lxd-client provides a command lxc, so I looked for how to install lxc, and found it was possible via snap. I've not really used snap before and people have complained about it (about filesize and automatic updates), so I was wary to install it, but I did with:

$ sudo apt install snapd
$ sudo snap install lxd
$ lxc --version
5.21.3 LTS

I removed lxd-client from the install script and re-ran it, and it seemed to work OK. It said it installed a "Wayland" desktop option on my login page if I rebooted.

Opening waydroid

So I rebooted, and on the login screen selected "Pop on Wayland" (I'm still not fully sure what this X/Wayland thing is), and tried starting Waydroid.

Running…

waydroid session start

…and…

waydroid show-full-ui
waydroid app install org.fedorahosted.freeotp_46.apk
waydroid app install Firefox Fast & Private Browser_136.0.2_APKPure.apk

…installed some apps and filled one of my screens with a big Android display.

I found the APKs on either F-Droid, which just has them available for download (sweet) or by searching the web and downloading them from sketchy sites.

It seems to work well!

I suppose there's a lot you can do with Waydroid, if you want. I don't think I want.

In some ways, this is an example of the involved-nature of installing things on Linux.

back to top

my de-googlification so far - switching from big tech # prev single next top

tags: software, ethical, big-tech, obsidian, email, syncthing, openstreetmap, linux, github, android • 1430 'words', 429 secs @ 200wpm

I think it's a great idea to use ethical alternatives to free software made by mega-corporations with profit-maximising motives.

To that end, I had a push to replace lots of things I used (most because they were the default, or because I'd used them a long time), mainly using the great website https://switching.software/ (I also know of https://european-alternatives.eu/alternatives-to but haven't used it as much.)

I replaced some things. I didn't manage to replace everything. Change is, and should be, incremental.

Here is a list, mostly copied from my notes, of what I replaced, and what I didn't. The title of each item is verbatim copied from my notes, and I have added context underneath each.

Google

Gmail -> see below
see "email" below
Drive -> Cryptpad/Nextcloud or Syncthing
I replaced my Google Drive usage with a weird setup where I use Syncthing to sync several folders between my devices, and to share large files I either upload them to my server (bad advice, technical knowledge needed), or I upload them to Wormhole where they get deleted after 24 hours. I don't have much need to share files for a long time, but I'd consider Nextcloud.
Photos -> ???
I thought about this a lot, but Google Photos is too good for me. Maybe another day.
Calendar -> ???
I installed Tasks and Fossify Calendar. I tried to use them, but in the end, Google Calendar won out, and I still use it.
Keep -> ???
I didn't really replace keep, I just started using it less. I put most of my notes in Obsidian, but I still have it installed. Sometimes, when I want to take a really quick note, I'll put it in there.
Maps -> OpenStreetMap
I still use Google Maps, but I've been using OpenStreetMap more recently, and while interrailing last month, I mainly used OsmAnd because of its great offline maps. Day-to-day, I still use Google Maps, because it has most-or-every business, and websites, and opening times, which OSM tries but just doesn't (yet…) have the data for.
generic Android apps -> Fossify
I found Fossify who make "generic apps" for Android like the gallery, file explorer, contacts, calendar, messages, notes, etc. I haven't used many of them, apart from the file explorer, which I like.

Facebook

Facebook -> delete it
my suggested replacement here was "delete it". I haven't. Sometimes I open it for "mindless phone downtime", but I have a 5 minute daily app timer on it, so not for long.
Instagram -> PixelFed
I tried to import my Instagram export into Pixelfed, but it wouldn't work when I deleted my DMs from the files (as these are not needed to import only posts). I raised an issue, and left it at that. Since then, PixelFed has gotten quite a lot more popular. I haven't tried again recently, but I find the main developer of PixelFed a little weird on Mastodon. That means nothing, but… I just haven't tried again.
Messenger/WhatsApp -> Signal
I am slowly convincing friends and group chats to move to Signal. It goes well.

Microsoft

OneDrive -> Cryptpad/Nextcloud or Syncthing
see Google Drive above. I have also stopped using OneDrive.
Windows -> Linux https://waldyrious.net/computefreely/
That site is good. This was probably the biggest switch in this list. I installed Linux in increments, first on my PC, then on my laptop, then on my Gaming PC, which ends up with Steam's Proton able to play anything I could have played on Windows! I'm loving it. I have Pop!_OS, backed up in a custom way.
GitHub -> sourcehut, codeberg, gitlab, etc
I haven't started on this one, even though I should. I have so many things on GitHub, and I feel as if I create a new repository every week. Combine that with all the GitHub actions I use, and I say rightfully that Microsoft has me. It's not what I want, but it's what I have.

Android

Android -> LineageOS or GrapheneOS or CalyxOS (comparison)
I looked into this one a lot, and talked to a few people I knew on Mastodon for advice. Ultimately, I discovered people's opinions and experiences that it was neat, but there were enough compatibility problems to be annoying. Particularly, that banking apps would semi-regularly break on non-stock-Android OSes, and that the banking app companies would say "we don't care". I use a very digital banking app where I only keep between £0 and £50 on my card, and it would be very annoying for me to not shuffle money around easily. I already have boneless Wednesday. I did enjoy installing LineageOS on an old phone though.

The rest

Notion -> Obsidian
Notion is classic lock-in. It was also a place where I had a lot of notes. I made an export, downloaded Obsidian (which, sadly, is still not open source - but your notes are simply text files, so I hazard if it were to go weird, there would be many Open Source pop-ups, or I could use VSCodium, etc.), and imported my export. It worked pretty well. Most files had double spaces where I only had single in Notion, and the databases ended up pretty weird (as loads of flat files), which made my Notion spider diagram look super weird. Anyway, I love Obsidian now. I sync my vault between my devices with Syncthing, and when there are editing conflicts, I use a great plugin.
Spotify -> https://codeberg.org/swiso/website/issues/26
Several months ago I was removed from a Spotify Family plan that I was on, so stopping my Spotify usage was pretty easy. I didn't resubscribe, and I mainly listen to the radio now (BBC Radio 6 Music ! the best station !). Sometimes, I miss being able to choose what I'm listening to. I tried to get SoundCloud, but it didn't have as much music on as I wanted (or it was restricted to a "super Pro" version). However, I do want it back. I might re-subscribe soon.
DNS Registrar -> https://dnsimple.com/ https://www.namecheap.com/ https://domainr.com/ https://www.namesilo.com/ (API) https://www.name.com https://desec.io/
to be honest, mine wasn't an evil corporation, I just wanted a new one (I was using 123-reg and it's super annoying to configure my DNS settings). It was difficult to web-search for this, and I ended up using Porkbun, which isn't even on the list above.

email

Format-break. I spent a long time looking at options, and ended up finding a bunch. Here was a list I had:

I wanted to use a custom domain (alifeee.net), I wanted to use wildcard domains (anyone@alifeee.net), I wanted to use maybe a few custom domains (alfierenn.dev), I wanted to use IMAP and SMTP (so I could view my emails with Thunderbird). Turns out those requirements were restrictive to make a lot of the above list bad options, which left me Proton or Mailbox.org.

There was a problem with Proton which I can't remember, so I am using Mailbox.org. I like it. Free your email.

The End

I started the push maybe six months ago. Maybe I did OK, maybe I didn't. But, I certainly made some changes, and I think that's good.

Why not take a look at https://switching.software/ and think about whether you are fine with the number of tentacles that American Big-Tech companies have in your life.

back to top

starting radio station streams with shortcuts on Linux Pop!OS # prev single next top

tags: shortcuts, linux, radio • 310 'words', 93 secs @ 200wpm

I enjoy listening to the radio. I enjoy listening to music. I don't enjoy listening to adverts. BBC Radio 6 Music fits these requirements well. So do two of my local Sheffield radio stations: Forge radio and mondo.radio.

I have a physical radio in my kitchen, but on my laptop or computer I enjoy using HTTP audio streams. For the latter two radio stations, I opened the network tab in my web browser, and clicked play, and then saw a request pop up. I copied this and I can use it either in a new tab in my browser, or as a "Network stream" in VLC Media Player. For BBC Radio 6 Music, I can't remember how I found the stream. I just tried to find a copy in the network requests tab, but I couldn't. I did find two articles about it: https://garfnet.org.uk/cms/2023/10/29/latest-bbc-hls-radio-streams/ and https://minimradio.com/. Anyway, I still have the URL, so I can launch it (and the others) in VLC by using:

# forge radio
vlc "http://solid41.streamupsolutions.com:10062/;stream.nsv"
# mondo radio
vlc "https://streamer.radio.co/s1afcca186/listen"
# bbc radio 6 music
vlc "https://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_6music/bbc_6music.isml/bbc_6music-audio%3d96000.norewind.m3u8"

I'm enjoying creating shortcuts on my computer, so I turned the above three commands into shortcuts. Now I can launch the radios in VLC with the push of a (well, four) button.

SUPER + CTRL + SHIFT + 4 --- "Four"-ge radio
SUPER + CTRL + SHIFT + 5 --- mondo radio (no pun for this one)
SUPER + CTRL + SHIFT + 6 --- BBC Radio "6" music
back to top

turning my clipboard into a blockquote on Linux # prev single next top

tags: scripting, linux, markdown • 237 'words', 71 secs @ 200wpm

I like markdown. I use Obsidian a lot, and write a lot in GitHub issues. Something useful I usually do is quote other people's words, so in markdown it would look like:

The Met office said

> it will definitely snow tonight
>
> like... 100%

I found that I can use a command xclip to get/set my clipboard on Linux, and I use a lot of sed to do word replacement, so I realised I could copy the text

it will definitely snow tonight

like... 100%

and then run this command in my terminal (xclip gets/sets the clipboard, sed replaces ^ (the start of each line) with > )

xclip -selection c -o | sed "s/^/> /" | xclip -selection c

which would get my clipboard, replace the start of each line with a quote, and set the clipboard, setting the clipboard to:

it will definitely snow tonight

like... 100%

I've set aliases for these commands so I can use them quickly in my terminal as:

alias getclip='xclip -selection c -o'
alias setclip='xclip -selection c'
alias quote='getclip | sed "s/^/> /" | setclip'

but also I created a keyboard shortcut in Gnome, CTRL + SUPER + Q, which will quote my clipboard. I had to set the shortcut to run bash -c 'xclip -selection c -o | sed "s/^/> /" | xclip -selection c' as I don't think pipes sit well in shortcuts.

But now I can really easily...

quooooooooote

back to top

copy my most recent screenshot on Pop!_OS Gnome Linux # prev single next top

tags: linux, shortcuts • 597 'words', 179 secs @ 200wpm

I recently started using Pop!_OS, which uses Gnome as a desktop environment.

What's the problem? my clipboard history doesn't do images

Apparently there are a few different "clipboards" in desktop Linux, but I like to ignore this fact and pretend there is only one.

I like clipboard history, so that I can copy several things, switch application, and then paste several things (like copying both username and password). As such, I installed a Gnome extension "clipboard indicator" to have a clipboard history: https://extensions.gnome.org/extension/779/clipboard-indicator/.

However, it doesn't have images on there, only text. So, if you copy an image (or take a screenshot), then copy some text, you can't use the clipboard history to get back to the image - you have to re-copy it or re-take the screenshot. I find this a bit annoying.

my clipboard history does have support but not for my version of Gnome

A note: image support was added, but only in Gnome 45 (which is not very obvious). I am on Gnome 42.9, and I don't understand enough about Linux distributions to know if I can upgrade that version myself, or it is built into Pop!_OS. It seems like Pop!_OS is creating a whole new Desktop environment anyway, for some reason, so they may never reach Gnome 45.

changing where screenshots are stored

Let's work around the problem. But first, Screenshots are saved to ~/Pictures/Screenshots, which can't be changed (easily). However, an aside: I want to change it because I sync my ~/Pictures/ folder to my phone with Syncthing, and I don't want ephemeral screenshots clouding my phone.

First, I tried changing dconf settings by installing dconf-editor with sudo apt install dconf-editor, and I found a setting called org.gnome.totem > screenshot-save-uri. I changed this from "" to .cache, but it did nothing. It turned out it was entirely unrelated, as "gnome totem" is some sort of video player. So, instead, I moved the Screenshots directory manually and created a symbolic link with

mv /home/alifeee/Pictures/Screenshots /home/alifeee/.cache/Screenshots
ln -s /home/alifeee/.cache/Screenshots /home/alifeee/Pictures/Screenshots

copying the latest screenshot to the clipboard

with some searching, I found a way to use xclip to copy an image to the clipboard, like this:

xclip -selection clipboard -target image/png -i "Screenshot from 2024-11-11 10-28-31.png" 

creating a keyboard shortcut to copy the latest screenshot

with Gnome you can create keyboard shortcuts, so I wanted to map CONTROL + SUPER + C to "copy latest screenshot". I struggled getting the command to output anything, and eventually wrapped the whole command (that I got working in my terminal) in quotes and slapped bash before it, and it works great now. After installing libnotify-bin, I created the keybind with this command:

bash -c 'dir=~/Pictures/Screenshots/; img=$(ls -t "${dir}" | head -n1); xclip -selection clipboard -target image/png -i "${dir}${img}"; notify-send "copied image" "${img}"'

Now I press CTRL+SUPER+C and I get a notification on the top of my screen telling me I copied an image, and I can paste the image anywhere I can usually paste images!

Sweet.

back to top