Enable numlock in Linux

This commit is contained in:
2Shirt 2021-07-23 22:58:28 -06:00
parent 07bddaae54
commit dd50852a68
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
5 changed files with 27 additions and 0 deletions

10
scripts/numlock Executable file
View file

@ -0,0 +1,10 @@
#!/bin/env bash
#
## Enable numlock if no battery is detected
## Credit: https://wiki.archlinux.org/title/Activating_numlock_on_bootup#With_systemd_service
if ! compgen -G "/sys/class/power_supply/BAT*" >/dev/null; then
for tty in /dev/tty{1..6}; do
/usr/bin/setleds -D +num < "$tty"
done
fi

View file

@ -21,6 +21,7 @@ mkvtoolnix-cli
mpv
noto-fonts
noto-fonts-cjk
numlockx
openbox-patched
otf-font-awesome-4
papirus-icon-theme

View file

@ -0,0 +1 @@
/etc/systemd/system/numlock.service

View file

@ -0,0 +1,10 @@
[Unit]
Description=numlock
[Service]
ExecStart=/usr/local/bin/numlock
StandardInput=tty
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View file

@ -2,6 +2,11 @@
#
## Start desktop apps based on WM
# Numlock
if ! compgen -G "/sys/class/power_supply/BAT*" >/dev/null; then
numlockx &
fi
# Start common apps
#picom --backend xrender --xrender-sync --xrender-sync-fence &
picom --daemon || picom --daemon --no-vsync