OK, it doesn't stick. Let's try this:
If you don't have Nautilus-Admin installed: sudo apt install nautilus-admin
Once it's installed, navigate to /etc/rc5.d
, right-click one of the files and select "Edit as Administrator" to open it, then Save-As the file as /etc/init.d/driveled-remap
.
Then select all the text and delete it, and paste in the following:
#!/bin/sh
#
# Remap hard drive led to CAPSlock key
# NOTE: YOU MUST EDIT THIS TO REFLECT
# YOUR OWN CAPSLOCK AS SHOWN IN
# /sys/class/leds
#
sudo bash -c 'echo disk-activity > /sys/class/leds/input3::capslock/trigger'
If that code doesn't work for you, you can also use:
#!/bin/sh
#
# Remap hard drive led to CAPSlock key
# NOTE: YOU MUST EDIT THIS TO REFLECT
# YOUR OWN CAPSLOCK AS SHOWN IN
# /sys/class/leds
#
sudo su <<EOF
echo disk-activity > /sys/class/leds/input3::capslock/trigger
EOF
Save it to /etc/init.d/driveled-remap
.
Set the file as executable:
sudo chmod +x /etc/init.d/driveled-remap
Create a sym-link in the proper run level directory:
sudo ln -s /etc/init.d/driveled-remap /etc/rc5.d/S01driveled-remap
And that works. The CAPSlock key lights up with disk activity shortly before the desktop loads.
You can even map disk activity to all the available LEDs at the same time.
Just FYI, that's not the only trigger you can assign to that LED, nor the only LED you can assign a trigger to. Look in /sys/class/leds
for all the LEDs you can remap, and here's the triggers:
none usb-gadget usb-host rfkill-any rfkill-none kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock AC-online BAT0-charging-or-full BAT0-charging BAT0-full BAT0-charging-blink-full-solid disk-activity disk-read disk-write ide-disk mtd nand-disk cpu cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 cpu6 cpu7 panic rc-feedback phy0rx phy0tx phy0assoc phy0radio rfkill0 audio-mute audio-micmute bluetooth-power hci0-power rfkill1
That list of triggers is from /sys/devices/platform/i8042/serio0/input/input3/input3::capslock
.
We're using 'disk-activity
' in this instance, but you can use any of the above, on any of your LEDs.