Keyboard shortcuts

I use a fairly eclectic range of hardware and software, and keyboard shortcuts are required to get it to all work together. This list is mainly for me, but I’ve split it up by device/application in case it is of any use to other people with similar setups.

Epomaker SK61 keyboard shortcuts

I use a 61-key keyboard on my main computer. It doesn’t have some of the keys that I use occasionally, and whilst it’s perfect for writing there are a few keyboard shortcuts required to make some things I do a little bit easier. The main ones that I use are:

  • Up arrow – Fn + /
  • Down arrow – Fn + menu
  • Left arrow – Fn + Alt
  • Right arrow – Fn + Ctrl
  • Delete – Fn + M
  • Volume up –Fn + H
  • Volume down –Fn + G
  • Switch to layer 2 – Fn + W

There isn’t really much else I use that this keyboard doesn’t give me naturally, and the form factor and the way it handles more than make up for the lack of keys.

Motospeed CK61 keyboard shortcuts

My other keyboard is a Motospeed CK61, which seems to have increased dramatically in price since I got mine. The layout is the same as the SK61 (which is why I like it), but instead of layers it has shortcuts that translate specific parts of the keyboard to alternate keys, which I find quite useful sometimes. Shortcuts I use are:

  • Factory reset – Fn + Escape
  • Map /, alt, menu and ctrl to arrow keys – Fn + 3
  • Control brightness of backlight – Fn + U/I
  • Cycle through different lighting patterns – Fn + menu

i3 shortcuts

I’ve used i3 as my window manager for over a year now, and I find it fits my workflow perfectly. The main i3 shortcuts I find myself using are:

  • Open a terminal window – $mod + Enter
  • Open a different application – $mod + d then type the application name (eg firefox)
  • Open (or go to) a second desktop – $mod + 2
  • Send the focused application to that desktop – $mod + Shift + 2
  • Split a container vertically – $mod + v
  • Split a container horizontally – $mod + h
  • Move between containers – $mod + arrow keys
  • Switch to a tabbed layout – $mod + w
  • Switch to a stacked layout – $mod + s
  • Close a window – $mod + Shift + q
  • Exit i3 – $mod + Shift + e

I do have a few other custom shortcuts defined, which are detailed in my i3 config file.

Atom shortcuts

I use the Atom text editor for a lot of my workflow. My main shortcuts are:

  • Multi line editing – ctrl + alt (or shift on Linux) + arrow keys
  • Toggle markdown preview – ctrl + shift + m
  • Create a PDF of the current file – alt + ctrl + e
  • Open a terminal ctrl + alt + shift + i
  • Show a hidden menu bar – alt

Kitty shortcuts

I use Kitty as my terminal emulator on any computer that it works with, although I don’t really use too much advanced functionality. The main shortcuts I use in Kitty are:

  • New terminal within an existing session – ctrl + shift + enter
  • Toggle through windows – ctrl + shift + ]

There are lots more of these on the Kitty website

Qutebrowser shortcuts

I’ve just started experimenting with Qutebrowser. It’s very fast, but has a steep learning curve. The main shortcuts that I’ve found myself using so far are:

  • Open a URL in the current tab – o
  • Open a URL in a new tab – shift + o
  • Toggle through open tabs – shift + k and shift + J
  • Close the current tab – d
  • Back – shift + H

A lot of standard shortcuts (ctrl + t for a new tab, Fn + 5 to refresh) also work as expected.

Zathura shortcuts

Zathura is a lightweight PDF viewer, and something else I’ve been incorporating into my workflow over the last few months. I only ever really use it for reading PDFs, so just use the arrow key shortcuts detailed above, plus s to make what I’m reading fit the width on the window/container I’m reading it in. Zathura has a lot of other functionality which I really do need to explore at some point soon, at which point I’ll come back and update this guide with anything interesting I uncover.

My Setup – April 2021

My Setup

I’ve been maintaining an up to date list of what hardware and software I use since I discovered Uses This a few years ago. It used to live as a page in my blog, but I like to maintain an up to date version so I can keep track of exactly what I’m using and how it changes over time. Every couple of years I post a snapshot as a blog post to track the passage of time. This is one of those snapshots.

The hardware I use

Home – I’ve just bought a new desktop computer that mostly consists of components that are fairly new (this is a first for me). Everything feels snappy and fast, and I love it. I also have three monitors (now identical in both size and resolution which pleases me), a mechanical keyboard, a hand-me-down gaming mouse, and all the docks, cables and switches to connect everything together. My personal laptops are both Thinkpads – an x260 for travel and couch-surfing, and an x230 which largely gets used for digitising vinyl and testing software I plan on using on one of my main computers. I also have a variety of Raspberry Pis that fulfil various server and media functions, and a Synology NAS for backups. I’m trying to phase out a lot of my older computers and only use newer machines with SSDs and lots of memory, but it’s hard to let go sometimes.

Work from home – As home, but with a Thinkpad L13 doing the driving. All it requires is a couple of cable switches and toggling the input on two of my monitors. I’d love to do this without crawling under my desk, but that’s a problem for another day.

Work – I’ve not been in my office for a while, but I think I still have something largely similar to my home setup, but with one less screen. I think I’ll be taking my very quiet solar-powered keyboard in as I’ll be sharing an office soon and mechanical keyboards are not conducive to good working relationships.

Travel – I don’t travel right now, but which I did it would be some combination of a Thinkpad, Raspberry Pi Zero, Kindle and phone. I also carry bootable USB versions of Ubuntu and Tails everywhere I go (even places I don’t take a computer). Increasingly my travel hardware also includes a bike and related tools.

The software I use

At work I’m running Windows 10. It largely does the job, but I would like to be able to live without it. Most of my day is spent doing video calls using either Teams or Zoom, but apart from those I tend to use largely the same suite of applications as I do for everything else.

At home (and whilst travelling) It’s mostly Ubuntu with a side order of LibreElec and Raspbian for my Raspberry Pis. I’ve been using the i3 window manager for Ubuntu since early 2020, although I do have Gnome installed on most of my computers as well. The script I use for installing my computers is available on Github and is regularly updated so it generally represents the software I am currently using.

Firefox has always been my main browser, and it surprises me that more people don’t use it. I have a container running with various versions of all the main browsers so that I can test things, but otherwise it’s Firefox all the way.

Other software I use that I feel is somewhat noteworthy includes:

WordPress – All my blogs run on WordPress. I currently maintain a WordPress multisite installation and several stand alone sites.

Atom – A text editor that handles Markdown well, integrates nicely with GitHub, and can preview and export to PDF. I also use Pandoc to convert to PDF, HTML, and/or .docx if required (I try not to use office software until the point I have to share what I’m working on with someone else), and have also started experimenting with using Pandoc to generate slides and ebooks.

Trello – I use this for my to do list, and it’s a good way to visualise the planning and execution of any task based work. It also reminds me when I have forgotten to do something.

Dropbox – Cloud storage and syncing software to ensure I can access everything everywhere.

IFTTT and Buffer – To automate as much as possible. Between them they handle a lot of the seemingly clever things in my digital life, and explain why I seem to be able to post to social media sites at times when I appear to be elsewhere.

Virtualbox and Multipass – Because no-one needs as many physical computers as I had before virtualisation was a thing. Multipass is what I use the most at the moment, and it’s really transformed the way I use containers for anything volatile or requiring increased privacy or security. There are generally at least a couple of containers running on my computer which I can switch to if I need to use a different desktop environment or browser to test something.

Spotify for discovering new music, and Rhythmbox for playing the music I already own. I have 162 days of digital music on my computer, and that’s before we get to all the records and CDs I’ve not got round to digitising yet.

Github for collecting together code that I’ve written and making the way my computers are set up available to other people in case it’s useful. I’ve also increasingly started using private repositories to version control writing and the notes I take at work.

My dream setup

Maybe I’m already living the dream, but the one thing I’d really like is to go back to doing everything on one computer. I also long for reasonably priced mechanical keyboards that are designed for people who just like to type, rather than gamers. Give me RGB and I will activate it, but sometimes I think something a bit more stylish might be more in keeping with the rest of my setup.

More changes to my i3 config file

I had my new computer delivered this week. It was good to install it from my own scripts, copy across my dotfiles, and just carry on working.

Going through this process I did note that my i3 configuration file looks a lot different than when I last blogged about it, so I thought I’d make a note of the things I’ve changed from the defaults.

First up is screen locking. My muscle memory expects to use the same keyboard shortcut as Windows, so I’ve just configured that in:

set $i3lockwall i3lock -i /home/andy/Dropbox/lock.png -t
bindsym mod4+l exec --no-startup-id $i3lockwall

I’ve also set up something to randomise my wallpaper each time I log in (with a different one on each screen if I’m using multiple monitors):

exec --no-startup-id feh --randomize --bg-scale /home/andy/Dropbox/Wallpaper/current/*

I just keep a small folder of images in Dropbox that acts as a repository to pick from, and then add/remove occasionally to keep things fresh.

And then I’ve picked applications that don’t make sense in tiled mode and make the windows float (so they appear on top of everything else and can be moved around):

for_window [class="Gimp"] floating enable
for_window [class="vlc"] floating enable
for_window [class="zoom"] floating enable
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [class="Arandr"] floating enable
for_window [class="XTerm"] floating enable

I think that’s about it for now. I’ve also made fairly significant changes to my installation and update scripts, but that’s a topic for another day.

Adding a new repository to Oracle Linux

When I first install Oracle Linux 8 a lot of software I want to use isn’t available. But we can fix this by adding another repository.

First of all, create a new file in /etc/yum.repos.d:

sudo nano /etc/yum.repos.d/ol8-epel.repo

Then add the following to the file:

[ol8_developer_EPEL]
name= Oracle Linux $releasever EPEL ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/developer/EPEL/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

Issue the following command to start using the new repository:

sudo dnf makecache

Then try and install some software that wasn’t previously available:

sudo dnf install -y byobu neofetch

This gives me access to a lot of software that makes computers feel like my computers.

Building a private cloud with LXD

I’ve been doing some experiments with LXD on Ubuntu and I thought it was worth publishing some of the notes I made myself so that when I come back to this at a later date I can remember what I did.

LXD is described as:

LXD (pronounced lex-dee) is the lightervisor, or lightweight container hypervisor. LXC (lex-see) is a program which creates and administers “containers” on a local system. It also provides an API to allow higher level managers, such as LXD, to administer containers. In a sense, one could compare LXC to QEMU, while comparing LXD to libvirt.

(from https://ubuntu.com/server/docs/containers-lxd)

To install:

sudo snap install lxd
sudo lxd init

Then answer some questions about where you want to store things and what file system to use.

Finding images

For Ubuntu, the syntax is:

lxc image list ubuntu:focal

(replace focal with the name of the version you are interested in)

For non-Ubuntu images, you’ll need to search https://uk.images.linuxcontainers.org/. This shortens to images So for an Oracle Linux 8 image we would type:

lxc image list images:oracle/8

Creating containers

To do this we need to tell LXC which image to build the container from and what to call it. For an Oracle Linux 8 container with the name oracle-01 we would type:

lxc launch images:oracle/8 oracle-01

Once it’s built (it shouldn’t take long) we can connect to it by using the following command:

lxc exec oracle-01 -- bash

The containers are very minimal, and I found myself having to install aditional software before I could set them up to work in the way I like (nano and wget were both missing for example).

Stopping and starting containers

I’m very used to working with Multipass, so the commands for LXD are very similar.

Start a container:

lxc start <container_name>

Stop a container:

lxd stop <container_name>

Delete a container:

lxd delete <container_name>

Viewing your current containers

The command to issue is:

lxc list

You will get to see which containers are running (with their IP address) and which containers you have that have been built but are not running.

That’s about as far as I’ve got with building the latest part of my private cloud. I’ve also been working on using Oracle’s cloud as a location for my backups, but I’ll write about that another day.

Notes on my experiments with Oracle Cloud

This Christmas I set up two small VMs in Oracle’s cloud; one running Oracle Linux 8 (which I’m trying to learn at the moment), and one running Ubuntu (with my standard VM/container build). I’ve written these notes largely for me, but maybe someone else might find them useful too.

Registering for Oracle Cloud

To sign up for Oracle Cloud go to https://www.oracle.com/cloud/free/.

You’ll need a credit card, but it won’t be charged providing you only use things marked as always free. This gets you two VMs, with 1 GB of RAM each and 100 GB of storage. That’s more than enough for what I need to do here so it’s all good. You also get signed up for a trial which allows you to build much bigger machines and access more services. I’ve not tried this out yet, but it’s possible to go all the way up to VMs with 64 GB of RAM or bare metal machines with a lot more (which is basically what I want to build at home at some point soon).

See here for exactly what the free tier gets you.

Using Oracle Cloud

To build VMs and generally interact with the service log in at Oracle Cloud. The first time you create a VM you’ll be asked to generate an SSH key (or provide one). Download the private key and save it somewhere, and then chmod it to 500 (otherwise it won’t let you log in). The key can be used for more than one VM, so you should only need to go through this process once.

You can see all your instances at https://console.uk-london-1.oraclecloud.com/compute/instances – This works for anything in the London data centre but would need to be amended for other data centres.

Logging in to a VM

To log in open up a terminal and SSH to the VM. The syntax is:

ssh -i /path/to/key/ username@ip_address

Where /path/to/key/ is the location you saved your private key. Username and IP address will be in the Instance Access section of the Instance Details for the specific VM.

Full instructions are available on the Oracle Cloud website.

First thoughts

The Ubuntu VM was indistinguishable from what I’m used to, and all my usual software and scripts worked fine. I’m less familiar with Oracle Linux, but installing and updating software works as expected so I have no reason to believe that the experience will be that different from a locally installed server. I still don’t find Oracle Linux anywhere near as easy to use as Ubuntu, but I suspect that’s as much down to 15 years less experience as anything else.

Deploying Multipass Containers

I’ve been running a lot of experiments using Multipass, which is a (fairly) new application for deploying and working with containers on various operating systems (including all the ones I use). I’ve now set up a script to deploy these containers on any Ubuntu machine I install, and thought it might be worth sharing the script that I use.

#!/bin/bash

# Script to set up multipass and then deploy a load of containers for various things
echo "---------------------------------------------"
echo "Multipass Deployment Script - v0.1, June 2020"
echo "---------------------------------------------"

# Changelog:
# 28/6/20 - Created script to deploy 5 containers (POC)

# First off, install multipass:

sudo snap install multipass --classic

# What we're going to do next is:
# 1. Deploy a container for the current LTS version of Ubuntu
# 2. Run my usual post-deployment and update scripts inside that container
# 3. Shut the container down

multipass launch focal --name ubuntu-lts
multipass exec ubuntu-lts -- wget https://www.dropbox.com/s/p5jjsbvuuskeotl/deploy_ubuntu_wsl.sh
multipass exec ubuntu-lts -- sudo mv deploy_ubuntu_wsl.sh /usr/local/bin/
multipass exec ubuntu-lts -- sudo chmod 755 /usr/local/bin/deploy_ubuntu_wsl.sh
multipass exec ubuntu-lts -- deploy_ubuntu_wsl.sh
multipass stop ubuntu-lts

# We will then do the same for the LTS before

multipass launch bionic --name ubuntu-lts-old
multipass exec ubuntu-lts-old -- wget https://www.dropbox.com/s/p5jjsbvuuskeotl/deploy_ubuntu_wsl.sh
multipass exec ubuntu-lts-old -- sudo mv deploy_ubuntu_wsl.sh /usr/local/bin/
multipass exec ubuntu-lts-old -- sudo chmod 755 /usr/local/bin/deploy_ubuntu_wsl.sh
multipass exec ubuntu-lts-old -- deploy_ubuntu_wsl.sh
multipass stop ubuntu-lts-old

# Then we will follow the same process for the latest build of the next version of Ubuntu

multipass launch daily:20.10 --name ubuntu-devel
# TODO: investigate why the devel alias doesn't work for this
multipass exec ubuntu-devel -- wget https://www.dropbox.com/s/p5jjsbvuuskeotl/deploy_ubuntu_wsl.sh
multipass exec ubuntu-devel -- sudo mv deploy_ubuntu_wsl.sh /usr/local/bin/
multipass exec ubuntu-devel -- sudo chmod 755 /usr/local/bin/deploy_ubuntu_wsl.sh
multipass exec ubuntu-devel -- deploy_ubuntu_wsl.sh
multipass stop ubuntu-devel

# Do the same for any other versions of Ubuntu you want but this is probably enough for a POC

# Next up let's try a snapcraft development and test environment. This bit needs work once I know more about it

multipass launch snapcraft:core18  --name snapcraft-build
multipass stop snapcraft-build
multipass launch core18 --name snapcraft-test
multipass stop snapcraft-test

# Finally let's see what we now have:

multipass list

Using the i3 window manager

i3 is a window manager for Linux that I’ve been using for the last few weeks. It’s a fairly steep learning curve, but definitely brings some productivity gains. i3 is a tiling window manager, and by default will fill up the whole screen with applications. So if you have one application open it’s full screen, if you have two open then they each take up 50% of the screen, etc.

Installing i3

A excerpt from my installation script:

# Install the i3 window manager and some basic utilities

sudo apt install -y i3 feh arandr byobu htop

# Download some wallpaper and set it as default when using i3

wget https://www.dropbox.com/s/n5o7jjg4qpuebjn/2017-12-27-13.38.44.jpg
mv 2017-12-27-13.38.44.jpg  default_wallpaper.jpg
echo "feh --bg-scale default_wallpaper.jpg" >> .profile

## Add some aliases

echo alias ls="ls -l" >> .bashrc
echo alias top="htop" >> .bashrc

Using i3

When you log in for the first time you’ll be asked to choose a modifier key (I chose ALT). The keyboard shortcuts below use $mod to refer to that modifier.

  • Open a terminal window – $mod + Enter
  • Open a different application – $mod + d then type the application name (eg firefox)
  • Open (or go to) a second desktop – $mod + 2
  • Send the focused application to that desktop – $mod + Shift + 2
  • Split a container vertically – $mod + v
  • Split a container horizontally – $mod + h
  • Move between containers – $mod + arrow keys
  • Switch to a tabbed layout – $mod + w
  • Switch to a stacked layout – $mod + s
  • Close a window – $mod + Shift + q
  • Exit i3 – $mod + Shift + e

For multiple monitors it’s possible to enable/define them using xrandr. The sysntax is something like:

`xrandr --output HDMI-2 --auto --right-of HDMI-1`

As I have three monitors I find arandr to be a better way to set them up though. It’s a graphical wrapper to xrandr and lets me see the layout of my monitors which I find much more useful.

More information about i3 can be found at https://i3wm.org/docs/userguide.html.

Ubuntu Update Scripts 2020

I’ve maintained my own scripts for updating software on a few Linux distributions for a while. This weekend I decided it was time to consolodate all my installation and update scripts in one place, and amend them to reflect the new ways I work with Linux (both in using i3 as a window manager and relying more on WSL and Multipass).

What follows is largely for my benefit, but I thought it may be of interest to others.

Ubuntu

  wget https://www.dropbox.com/s/hwfvynamcy6bkcs/deploy_ubuntu.sh
  sudo mv deploy_ubuntu.sh /usr/local/bin/
  sudo chmod 755 /usr/local/bin/deploy_ubuntu.sh
  deploy_ubuntu.sh

Windows Subsystem for Linux (WSL)

wget https://www.dropbox.com/s/p5jjsbvuuskeotl/deploy_ubuntu_wsl.sh
sudo mv deploy_ubuntu_wsl.sh /usr/local/bin/
sudo chmod 755 /usr/local/bin/deploy_ubuntu_wsl.sh
deploy_ubuntu_wsl.sh

This one also works with Multipass (which will probably be the subject of a blog post soon).

Using Pi-hole as an ad blocker

I’ve used various ad-blockers over the years, and while they have all largely worked, they have also started to slow my browser down (especially on older computers). I read about Pi-hole a few times, but didn’t get around to actually installing it until this week. Now I have installed it I’m wishing I hadn’t waited, because not only does it lead to a largely ad-free browsing experience, but it also makes my older and slower computers noticeably faster.

Pi-hole should work on any Debian or Red Hat derived Linux distribution, but I went for the obvious solution of putting it on one of my always-on Raspberry Pis (which also runs WordPress and a command-line IRC client). To install just type curl -sSL https://install.pi-hole.net | bash in a terminal, and then visit the /admin URL of the machine it’s installed on to view the admin console.

Configuring machines to use it is just a case of defining a custom DNS server (how to do that varies between each OS, but was trivial on Ubuntu and ChromeOS – I’ve not tried anything else yet). Just add the IP address of the Pi as a DNS server, and it will block anything on the block list, and then forward everything else on to be dealt with as normal. If you want to do this for everything on your network then there are various options detailed here that range from configuring one machine to routing everything through Pi-hole.

The admin page will tell you how much blocking is going on. With me it was about 1% of all traffic, and it will even tell you which domains it is blocking so you can whitelist anything you actually want to see (not all ads are bad). I don’t really notice a performance increase on my main computer, but older and slower computers definitely seem snappier, and can maintain about twice as many open tabs before they start to slow down, which is a bonus feature that I wasn’t really expecting.