Remap your hard drive LED indicator to CAPSlock key LED

This is a tweak for those laptop users who rely upon the hard drive LED indicator to tell them if the computer's responding as expected, or if something's hung, but their laptop manufacturer decided to put the hard drive LED indicator on the side of the laptop (hrrrmppphhh... HP... hrrrmppphhh).

Look in /sys/class/leds. Find the file which says "capslock". Mine is input3::capslock.

sudo su
echo disk-activity > /sys/class/leds/input3::capslock/trigger

Flashy, flashy! :crazy_face:

I haven't rebooted yet to see if it sticks. If not, I'll whip up a bash file to make it a permanent setup.

Meanwhile, I disabled a Caps Lock key.

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.