Keyboard backlight issue after reinstall

I have reinstalled Garuda after some issues I created in my first install, and now I cannot get the keyboard backlight to function the way I want.

I simply want the Scroll Lock key to toggle on/off the keyboard backlight - my keyboard is a Cooler Master Devastator with only one backlight color and brightness - it's either on, or off. Pretty simple.

On the first Garuda install (that I screwed up, requiring the reinstall) I was able to get this to work, and be persistent after power cycling/log-in/out, by simply typing in a terminal the following:

sudo xmodmap -e 'add mod3 = Scroll_Lock'

I found that by searching, and it worked like a charm. So, fast-forward to after the reinstall, and of course I assume this will work....which it does for the current session only - there's no persistence. I have researched and read alot of posts, many of which are for other distros using different WMs, so I'm a little wary of executing anything that's not specifically for Arch or Garuda.

I'm not sure what Garuda uses upon session login to determine the keymaps, and therefore, what I should be doing to modify a file to make this permanent. I looked through the Settings in Garuda Settings Manager and System Settings, but see nothing that appears to address my issue. I'm just looking for some advice on the best way to accomplish this one task - I feel like I shouldn't need to create a script and have it autorun on login (some posts have suggested this for other distros). I also don't understand why this worked on the first install and not on the second. ???

garuda-inxi

System:
Kernel: 6.0.6-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=33bab7e2-354b-4a41-90a0-a035436b4688 rw [email protected]
quiet quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
resume=UUID=d50fe1fb-623e-4546-b2a6-59b370feff67 loglevel=3
Desktop: KDE Plasma v: 5.26.2 tk: Qt v: 5.15.6 info: latte-dock
wm: kwin_x11 vt: 1 dm: SDDM Distro: Garuda Linux base: Arch Linux
Machine:
Type: Desktop Mobo: ASUSTeK model: ROG STRIX B450-F GAMING v: Rev 1.xx
serial: <superuser required> UEFI: American Megatrends v: 4901
date: 07/25/2022
Battery:
Device-1: hidpp_battery_0 model: Logitech G700s serial: <filter> charge: 55%
(should be ignored) rechargeable: yes status: discharging
CPU:
Info: model: AMD Ryzen 5 3600 bits: 64 type: MT MCP arch: Zen 2 gen: 3
level: v3 note: check built: 2020-22 process: TSMC n7 (7nm)
family: 0x17 (23) model-id: 0x71 (113) stepping: 0 microcode: 0x8701021
Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 3 MiB desc: 6x512 KiB
L3: 32 MiB desc: 2x16 MiB
Speed (MHz): avg: 3634 high: 4027 min/max: 2200/4208 boost: enabled
scaling: driver: acpi-cpufreq governor: performance cores: 1: 3600 2: 3600
3: 4027 4: 3600 5: 3600 6: 3600 7: 3600 8: 3600 9: 3582 10: 3600 11: 3600
12: 3600 bogomips: 86407
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Vulnerabilities:
Type: itlb_multihit status: Not affected
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: mmio_stale_data status: Not affected
Type: retbleed mitigation: untrained return thunk; SMT enabled with STIBP
protection
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
prctl
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
sanitization
Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, STIBP:
always-on, RSB filling, PBRSB-eIBRS: Not affected
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: NVIDIA GA104 [GeForce RTX 3070 Ti] vendor: eVga.com.
driver: nvidia v: 520.56.06 alternate: nouveau,nvidia_drm non-free: 515.xx+
status: current (as of 2022-10) arch: Ampere code: GAxxx process: TSMC n7
(7nm) built: 2020-22 pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max:
gen: 4 speed: 16 GT/s bus-ID: 07:00.0 chip-ID: 10de:2482 class-ID: 0300
Device-2: Logitech C920 HD Pro Webcam type: USB
driver: snd-usb-audio,uvcvideo bus-ID: 5-2:2 chip-ID: 046d:0892
class-ID: 0102 serial: <filter>
Display: x11 server: X.Org v: 21.1.4 with: Xwayland v: 22.1.4
compositor: kwin_x11 driver: X: loaded: nvidia unloaded: modesetting
alternate: fbdev,nouveau,nv,vesa gpu: nvidia display-ID: :0 screens: 1
Screen-1: 0 s-res: 5360x1440 s-dpi: 109 s-size: 1249x342mm (49.17x13.46")
s-diag: 1295mm (50.98")
Monitor-1: DP-4 pos: primary,top-left res: 3440x1440 hz: 60 dpi: 109
size: 800x335mm (31.5x13.19") diag: 867mm (34.15") modes: N/A
Monitor-2: HDMI-0 pos: bottom-r res: 1920x1080 hz: 60 dpi: 96
size: 509x286mm (20.04x11.26") diag: 584mm (22.99") modes: N/A
OpenGL: renderer: NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2 v: 4.6.0 NVIDIA
520.56.06 direct render: Yes
Audio:
Device-1: NVIDIA GA104 High Definition Audio vendor: eVga.com.
driver: snd_hda_intel v: kernel bus-ID: 5-2:2 chip-ID: 046d:0892 pcie:
class-ID: 0102 gen: 3 speed: 8 GT/s serial: <filter> lanes: 16 link-max:
gen: 4 speed: 16 GT/s bus-ID: 07:00.1 chip-ID: 10de:228b class-ID: 0403
Device-2: AMD Starship/Matisse HD Audio vendor: ASUSTeK
driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
bus-ID: 09:00.4 chip-ID: 1022:1487 class-ID: 0403
Device-3: Logitech C920 HD Pro Webcam type: USB
driver: snd-usb-audio,uvcvideo
Sound API: ALSA v: k6.0.6-zen1-1-zen running: yes
Sound Server-1: PulseAudio v: 16.1 running: no
Sound Server-2: PipeWire v: 0.3.59 running: yes
Network:
Device-1: Intel I211 Gigabit Network vendor: ASUSTeK driver: igb v: kernel
pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: e000 bus-ID: 04:00.0
chip-ID: 8086:1539 class-ID: 0200
IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
Drives:
Local Storage: total: 13.19 TiB used: 174.28 GiB (1.3%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital
model: WDBRPG0010BNC-WRSN size: 931.51 GiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
rev: 111130WD temp: 37.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 860 EVO 500GB
size: 465.76 GiB block-size: physical: 512 B logical: 512 B speed: 1.5 Gb/s
type: SSD serial: <filter> rev: 1B6Q
ID-3: /dev/sdb maj-min: 8:16 vendor: Toshiba model: HDWE140
size: 3.64 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
type: HDD rpm: 7200 serial: <filter> rev: FP1R scheme: GPT
ID-4: /dev/sdc maj-min: 8:32 vendor: Toshiba model: MD04ACA500
size: 4.55 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
type: HDD rpm: 7200 serial: <filter> rev: FP2A scheme: GPT
ID-5: /dev/sdd maj-min: 8:48 type: USB vendor: Toshiba model: External
USB 3.0 size: 3.64 TiB block-size: physical: 4096 B logical: 512 B
type: N/A serial: <filter> rev: 5438 scheme: GPT
Partition:
ID-1: / raw-size: 896.83 GiB size: 896.83 GiB (100.00%) used: 174.28 GiB
(19.4%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%) used: 608 KiB
(0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 896.83 GiB size: 896.83 GiB (100.00%) used: 174.28
GiB (19.4%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-4: /var/log raw-size: 896.83 GiB size: 896.83 GiB (100.00%) used: 174.28
GiB (19.4%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 896.83 GiB size: 896.83 GiB (100.00%) used: 174.28
GiB (19.4%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 31.26 GiB used: 1.2 MiB (0.0%)
priority: 100 dev: /dev/zram0
ID-2: swap-2 type: partition size: 34.39 GiB used: 0 KiB (0.0%)
priority: -2 dev: /dev/nvme0n1p3 maj-min: 259:3
Sensors:
System Temperatures: cpu: 35.0 C mobo: 29.0 C gpu: nvidia temp: 41 C
Fan Speeds (RPM): cpu: 778 case-1: 729 case-2: 0 case-3: 858 gpu: nvidia
fan: 0%
Power: 12v: 9.92 5v: N/A 3.3v: N/A vbat: 3.23
Info:
Processes: 305 Uptime: 20m wakeups: 2 Memory: 31.26 GiB used: 3.22 GiB
(10.3%) Init: systemd v: 251 default: graphical tool: systemctl
Compilers: gcc: 12.2.0 clang: 14.0.6 Packages: pm: pacman pkgs: 2031
libs: 553 tools: octopi,pamac,paru Shell: fish v: 3.5.1 default: Bash
v: 5.1.16 running-in: konsole inxi: 3.3.22
Garuda (2.6.9-1):
System install date:     2022-10-29
Last full system update: 2022-10-30
Is partially upgraded:   No
Relevant software:       NetworkManager
Windows dual boot:       No/Undetected
Snapshots:               Snapper
Failed units:

I'll add that I looked here: Keyboard backlight - ArchWiki

and since there is nothing about KDE Plasma, I'm leery to use anything listed here.

That command inherently has no persistence and never has. You did something to make it persistent yourself.

Create /etc/X11/xinit/.Xmodmap and paste add mod3 = Scroll_Lock into it.

2 Likes

I followed your advice and created .Xmodmap and put add mod3 = Scroll_Lock into said file. Upon reboot, my Scroll Lock key does not turn on the keyboard. I also tried using mod3 = Scroll_Lock - no change.

I cannot explain what I "did" on the first install, as I did not document everything like I have for this current install, but I assure you that to my recollection the only thing I did was type sudo add mod3 = Scroll_Lock in a terminal. After that, it worked flawlessly for my regular login. Note that it did not affect root - logging in as root would not have Scroll Lock enabled for the keyboard backlight.

Please correct me if I am wrong, but my research indicates that if the .Xmodmap file exists, xmodmap will load that information in that file and execute the keymap based on that (basically). If that is correct, then the question becomes, why is my Garuda installation not executing xmodmap upon startup/login? Or is it, and I've done something wrong in my creation of .Xmodmap? Or does Garuda use something else to load keymaps on startup/login?

Thank you for your advice, I do appreciate the time people invest in reading and replying to others' issues such as mine.

That would evaluate to /etc/X11/xinit/.Xmodmap as far as I know. You can check in /etc/X11/xinit/xinitrc.

Alternatively, you should be able to create /etc/X11/xinit/xinitrc.d/50-keyboard-backlight.sh and add xmodmap -e 'add mod3 = Scroll_Lock' to it.

2 Likes

I tried your second suggestion first, creating a file 50-keyboard-backlight.sh and adding xmodmap -e 'add mod3 = Scroll_Lock' to it. I rebooted, but no change. So, I then changed the file permissions to 755; this seems to have no effect either - it does not enable Scroll Lock for keyboard backlight. Maybe I'm doing something wrong here, I'm not sure.

This is what that looks like:

╭─[email protected] in /etc/X11/xinit/xinitrc.d🔒
╰─λ ls -l
.rwxr-xr-x 318 root  3 Nov 18:15  40-libcanberra-gtk-module.sh
.rwxr-xr-x  36 root  7 Nov 08:54  50-keyboard-backlight.sh
.rwxr-xr-x 538 root  3 Nov 12:18  50-systemd-user.sh
.rwxr-xr-x 235 root 28 Oct  2020  80-appmenu-gtk-module

and this is the content of 50-keyboard-backlight.sh:

xmodmap -e 'add mod3 = Scroll_Lock'

As for the first suggestion, I checked /etc/X11/xinit/xinitrc, and here are the contents:

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then

xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi

I had created .Xmodmap in both /etc/X11/xinit and my $Home folder, both with the same contents:

xmodmap -e 'add mod3 = Scroll_Lock'

but even after reboot, none of this seems to have any effect. I'm sure I'm just not doing something right.....

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.