Page 1 of 1
Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 1:14 pm
by notfound
I recently did a new install of MX 23.1 because it was time to upgrade from 19... and I used to use "indicator-keylock" to show a notification whenever Caps Lock was pressed. It showed whether it was on or off, and was extremely useful. Although it seems to not be available any longer. I can't get the repository to work.
Is there any way to have a simple indicator for if Caps Lock is on or off?
I once had a program that would put an icon in the side panel, but I can't find that either.
Thanks.
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 1:31 pm
by Charlie Brown
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 3:28 pm
by jeffreyC
In the repos for MX versions up to MX-21 there was a package indicator-keylock which would specifically do that, the packager who handled it is no longer around (SwampRabbit).
There is a (poorly written) package request for it to be in MX-23 that is getting no traction,
The package for MX-21 is still in the repos and will install in MX-23 if you do it manually.
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 3:46 pm
by Jerry3904
I have a working prototype for a line that appears in a conky, will post once I get it to where I like it
BTW there is an installable plugin in the repos for people using gkrellm
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 3:51 pm
by notfound
jeffreyC wrote: Sat Nov 11, 2023 3:28 pm
In the repos for MX versions up to MX-21 there was a package indicator-keylock which would specifically do that, the packager who handled it is no longer around (SwampRabbit).
There is a (poorly written) package request for it to be in MX-23 that is getting no traction,
The package for MX-21 is still in the repos and will install in MX-23 if you do it manually.
Indicator-keylock doesn't show on my end. I don't know where to find it in the repos.
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 4:06 pm
by MXRobo
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 4:07 pm
by Jerry3904
I have this now at the bottom of my standard conky (MX-Cees) using a laptop that has no leds
Code: Select all
<space>
###### CAPSLOCK ####
${alignc} ${color5}${exec xset q | grep "Caps Lock: on" | awk '{print "CAPS: " $4}'}
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 4:29 pm
by oops
Jerry3904 wrote: Sat Nov 11, 2023 4:07 pm
I have this now at the bottom of my standard conky (MX-Cees) using a laptop that has no leds
Code: Select all
<space>
###### CAPSLOCK ####
${alignc} ${color5}${exec xset q | grep "Caps Lock: on" | awk '{print "CAPS: " $4}'}
Yes, even into a terminal ... do the trick:
Code: Select all
xset q | grep "Caps Lock:"
#or
xset q
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 4:33 pm
by ceeslans
notfound wrote: Sat Nov 11, 2023 3:51 pm
Indicator-keylock doesn't show on my end. I don't know where to find it in the repos.
try here:
http://nl.mxrepo.com/mx/repo/pool/main/ ... _amd64.deb
EDIT: Sorry, here's the full download link for
indicator-keylock_3.1.1-0~mx21+1_amd64.deb
http://nl.mxrepo.com/mx/repo/pool/main/ ... _amd64.deb
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 5:15 pm
by Charlie Brown
Nope, MX-23.1 :
Code: Select all
$ apt list indic*
Listing... Done
indicator-sensors/stable 1.3-1 amd64
indicator-sensors/stable 1.3-1 i386
indicator-sound-switcher/mx,mx 2.3.9-1~mx23+1 all
In the meantime, you noticed this one in the link, right ?
https://github.com/oco2000/xfce4-kbdleds-plugin
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 5:44 pm
by Charlie Brown
@notfound In case you don't know how to, here it is for you (you can even create a new, dedicated panel and do it there if you like) :
Right click on panel: "Add New" ...
Command:
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 6:50 pm
by fehlix
notfound wrote: Sat Nov 11, 2023 1:14 pm
I recently did a new install of MX 23.1 because it was time to upgrade from 19... and I used to use "indicator-keylock" to show a notification whenever Caps Lock was pressed. It showed whether it was on or off, and was extremely useful. Although it seems to not be available any longer. I can't get the repository to work.
Is there any way to have a simple indicator for if Caps Lock is on or off?
Yes. Use Xfce's builtin keyboard-layout panel plugin.
And do change properties (right-click on the icon in the panel):
keyboard-loayout-panel-plugin-properties.jpg
* to display caps-lock indicator
WIth caps-locked:
kbd-us-caps-locked.jpg
w/o caps-lock:
kbd-us-caps-not-locked.jpg
HTH
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 9:23 pm
by i_ri
nice one fehlix. thanks for pointing that out.
Caps lock keystate is somewhere in the system;
i say that because any pkexec Launcher window shows a caps lock on indicator in the text box.
Can that be grabbed from the pkexec indicator and put into system tray?
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 9:25 pm
by Jerry3904
It's in the xset -q output
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sat Nov 11, 2023 10:51 pm
by i_ri
Hello everyone
MXRobo gave the download link to indicator-keylock Version: 3.1.1-0~mx21+1
by MXRobo » Sat Nov 11, 2023 5:06 pm
https://mxrepo.com/MX21packages.html
install 3.1.1-0~mx21+1 this .deb onto MX23; it did not indicate any needed dependencies; it went right on, on its own.
tried it; it works. it is on two mxfluxbox that have one xfce4-notifyd and one ukui notifications, so it is pretty.
conky can use $key_caps_lock
caps lock ${key_caps_lock}
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 6:10 am
by fehlix
i_ri wrote: Sat Nov 11, 2023 10:51 pm
Hello everyone
MXRobo gave the download link to indicator-keylock Version: 3.1.1-0~mx21+1
by MXRobo » Sat Nov 11, 2023 5:06 pm
https://mxrepo.com/MX21packages.html
install 3.1.1-0~mx21+1 this .deb onto MX23; it did not indicate any needed dependencies; it went right on, on its own.
tried it; it works. it is on two mxfluxbox that have one xfce4-notifyd and one ukui notifications, so it is pretty.
conky can use $key_caps_lock
caps lock ${key_caps_lock}
Good found:
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 9:16 am
by MXRobo
I have not tried this, but possibly, and if it works, it should supply true notifications.
https://www.reddit.com/r/wayland/commen ... ?rdt=45177
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 9:45 am
by jeffreyC
For Wayland.
It might work in MX-23 KDE, but Xfce has not yet moved to Wayland it still uses X11, and Fluxbox would need to be completely rebuilt from scratch.
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 11:08 am
by Jerry3904
Fluxbox would need to be completely rebuilt from scratch

Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 1:31 pm
by fehlix
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:
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)")'\'''
or alternatively within Keyboard-Settings add new applications shortcut,
with the command:
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)")'
and press Caps_Lock for the key to bind.
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
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 2:24 pm
by siamhie
Jerry3904 wrote: Sun Nov 12, 2023 11:08 am
Fluxbox would need to be completely rebuilt from scratch
I second that emoji
@Jerry3904

Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 2:38 pm
by Jerry3904
Did you get a working line using that key_caps_lock?
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 2:52 pm
by ceeslans
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:
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)")'\'''
or alternatively within Keyboard-Settings add new applications shortcut,
with the command:
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)")'
and press Caps_Lock for the key to bind.
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
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...
My script does show individual icons for 'on' and 'off' state :
caps_lock.sh
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
num_lock.sh
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
keybindings in ~/fluxbox/keys:
Code: Select all
Caps_Lock :Exec sleep 0.3 && caps_lock.sh
Num_Lock :Exec sleep 0.3 && num_lock.sh
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 4:41 pm
by oops
... Or a simple script into the terminal (in "real time")
Code: Select all
#!/bin/bash
for (( ; ; ))
do
echo -n $(xset -q | grep Caps)
echo " … (Crtl + c to quit)"
sleep 0.5
clear
done
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 8:11 pm
by i_ri
Hello MXRobo the wayland script shows notification of Caps Lock On.
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Sun Nov 12, 2023 10:30 pm
by MXRobo
@i_ri Great, personally, I'd change the textual notification output, and I do NOT know this stuff, I'm just throwing what seems reasonably relevant at the fan.
I didn't try it because I can not even write a script or know where to keep it!
And fehlix's second one, keybind is the idea and what I tried last night, horrible attempt - and it should have responded, "cannot complete childlike command".
I have a caps lock light in the keyboard so I don't really need it, but I still like fehlix's very much, only if I had my druthers, I'd like it better if the notification for on was larger than the notification for being off – or only notified for on.
Hey Jerk! Caps ON!
This would be nice for the insert key too.
Nice, and nice toy!
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Mon Nov 13, 2023 1:46 am
by i_ri
"(MX-Cees) conky
by Jerry3904 » Sun Nov 12, 2023 3:38 pm
Did you get a working line using that key_caps_lock?" Yes. It prints On or prints Off.
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Tue Nov 14, 2023 6:04 am
by Jerry3904
Thanks.
I'm trying to have it show
only when caps lock is on. Thought this would work but it doesn't, so would be interested in and grateful for any suggestions
Code: Select all
${alignc}${if_match "${key_caps_lock} == 1"}${color5} Caps Lock: ${key_caps_lock} ${endif}
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Tue Nov 14, 2023 6:21 am
by fehlix
:
Code: Select all
${alignc}${if_match "${key_caps_lock}" == "On"}${color5} Caps Lock: ${key_caps_lock} ${endif}
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Tue Nov 14, 2023 6:40 am
by Jerry3904
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.
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Tue Nov 14, 2023 6:51 am
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
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Tue Nov 14, 2023 11:55 am
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}
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Tue Nov 14, 2023 12:31 pm
by Jerry3904
It works that way if translation is not a problem. I was thinking of increasing the size too.
Re: Is there any way to show a notification when Caps Lock is pressed?
Posted: Fri Jan 12, 2024 9:09 pm
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.
