I second that emoji @Jerry3904


I second that emoji @Jerry3904
This surely is way more sophisticated code than my feable attempt to script a notification message every time the CapsLock key (and similar script for NumLock key) is pressed - when running Fluxbox...fehlix wrote: Sun Nov 12, 2023 1:31 pm In addtion to the xfce-builtin Caps-Lock indicator on the panel as mentioned in #12,
one could also bind a "send notification" action to the Caps_Lock key itself:
E.g. To bind the send-notification event in Xfce on command line with this one-liner:or alternatively within Keyboard-Settings add new applications shortcut,Code: Select all
xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/Caps_Lock -n -t string -s 'sh -c '\''sleep 0.2; notify-send -t 5000 -i caps-lock "Caps Lock" $(xset -q | grep -oP "Caps Lock:\s*\K(off|on)")'\'''
with the command:and press Caps_Lock for the key to bind.Code: Select all
sh -c 'sleep 0.2; notify-send -t 5000 -i caps-lock "Caps Lock" $(xset -q | grep -oP "Caps Lock:\s*\K(off|on)")'
This gives a nice notification on the desktop when the Caps Lock key is pressed:
Caps Lock on
caps-on-notification.jpg
Caps Lock off
caps-off-notification.jpg
Code: Select all
#!/bin/bash
value=$(xset q | grep "Caps Lock:" | awk '{print $4}' | grep -c on)
if [ "$value" -eq "1" ];
then
notify-send -t 2500 -i "capslock-on" "Caps Lock is ON" &
else
notify-send -t 2500 -i "capslock-off" "Caps Lock is OFF"
fi
Code: Select all
#!/bin/bash
value=$(xset q | grep "Num Lock:" | awk '{print $8}' | grep -c on)
if [ "$value" -eq "1" ];
then
notify-send -t 2500 -i "numlock-on" "Num Lock is ON" &
else
notify-send -t 2500 -i "numlock-off" "Num Lock is OFF"
fi
Code: Select all
Caps_Lock :Exec sleep 0.3 && caps_lock.sh
Num_Lock :Exec sleep 0.3 && num_lock.sh
Code: Select all
#!/bin/bash
for (( ; ; ))
do
echo -n $(xset -q | grep Caps)
echo " … (Crtl + c to quit)"
sleep 0.5
clear
done
Code: Select all
${alignc}${if_match "${key_caps_lock} == 1"}${color5} Caps Lock: ${key_caps_lock} ${endif}
Code: Select all
${alignc}${if_match "${key_caps_lock}" == "On"}${color5} Caps Lock: ${key_caps_lock} ${endif}