Is there any way to show a notification when Caps Lock is pressed?

Help for Current Versions of MX
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
User avatar
fehlix
Developer
Posts: 12723
Joined: Wed Apr 11, 2018 5:09 pm

Re: Is there any way to show a notification when Caps Lock is pressed?

#31 Post by fehlix »

Jerry3904 wrote: Tue Nov 14, 2023 6:40 am Perfect, thanks. I had been using "On" and only switched to "1" in trying to fix it; but I never had the extra quote marks.
== compares double quoted strings strings

User avatar
i_ri
Posts: 1105
Joined: Tue Jun 30, 2015 12:26 am

Re: Is there any way to show a notification when Caps Lock is pressed?

#32 Post by i_ri »

hello fehlix and Jerry3904
Why ask for $key_caps_lock twice? is it necessary for translate On?
${if_match "${key_caps_lock}"=="On"}${color orange}${font :bold:size=14}caps LOCK is ON${color}$font${endif}

User avatar
Jerry3904
Administrator
Posts: 23244
Joined: Wed Jul 19, 2006 6:13 am

Re: Is there any way to show a notification when Caps Lock is pressed?

#33 Post by Jerry3904 »

It works that way if translation is not a problem. I was thinking of increasing the size too.
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

MXRobo
Posts: 1834
Joined: Thu Nov 14, 2019 12:09 pm

Re: Is there any way to show a notification when Caps Lock is pressed?

#34 Post by MXRobo »

This kind of works for both insert buttons, but without the on-off indicator - if they have been toggled to function as insert keys, i.e. maybe fn for delete/insert, and the number-lock for 0/insert key.

Code: Select all

sh -c 'sleep 0.2; notify-send -t 5000  -i insert "Insert" $(xset -q | grep -oP "Insert:\s*\K(off|on)")'
This does work correctly for Num Lock:

Code: Select all

sh -c 'sleep 0.2; notify-send -t 5000  -i num-lock "Num Lock" $(xset -q | grep -oP "Num Lock:\s*\K(off|on)")'
Complicated coding. :p

Post Reply

Return to “MX Help”