If your keyboard lacks visual lock indicators, especially for Caps Lock function, you can use a small hack to have a notification whenever the Caps Lock key is pressed. Here are the basics:
One thing to consider is having a delay before the state is being queried and only after that the notification should be displayed. First you need to have the script created. I've saved mine in my personal home directory but you can make it available for other users by placing it in a common area. They say it's a good practice to put this kind of scripts in the /opt directory so if you want to do it, you can just
sudo mkdir -p /opt/scriptsCreate the script using vi:
sudo vi /opt/scripts/capslock.shWhat the script will be doing is to use xset, grep and awk to get the Caps Lock state into a shell variable. Copy and paste the following into vi:
#!/bin/bashThe 0.1 seconds delay is there to give time for the Caps Lock to transition its state before reading it, otherwise it will display bogus status. Save the file then quit vi.
sleep 0.1
output=$(xset q | grep "Caps Lock:" | awk '{if ($4 == "on") {print "ON"} else {print "OFF"}}')
notify-send -t 5000 -i dialog-information "Caps Lock" "$output"
sudo chmod ugo+x /opt/scripts/capslock.shNow for the graphical part.