Qtile_numlock

Here’s a little mistake that can quickly become annoying:

Entering a number and finding out that the numlock key was not locked.

And since I don’t do anything like everyone else, I use qtile and there is no way to fix it. But with a little bit of trickery here is how I got out of it.

Step number 1: install numlockx the application that will lock the numeric keys. Under archlinux in a terminal:

pacman -S numlockx

Step number 2: tell qtile to start numlockx at startup, to do this I will edit the file “~/.config/qtile/autostart.sh” At the end of the file I will add the following lines:

import os
import subprocess

from libqtile import hook

@hook.subscribe.startup_once
def autostart():
	home = os.path.expanduser('~/.config/qtile/autostart.sh')
	subprocess.run([home])

I tell with these lines to qtile to execute at startup and only once the file autostart.sh (if qtile is started several times on a session it will be executed only once).

Then I create the autostart.sh file which will group the commands to be executed at startup with the following lines in the ~/.config/qtile/ folder:

#!/bin/sh
numlockx &

I take care to make this file executable with the command

chmod +x ~/.config/qtile/autostart.sh

untagged

197 Words

2022-03-25 13:55 +0100