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
Charlie Brown

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

#11 Post 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:

Code: Select all

sh -c 'xset -q | grep Caps'
You do not have the required permissions to view the files attached to this post.

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?

#12 Post 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
You do not have the required permissions to view the files attached to this post.

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?

#13 Post 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?

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

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

#14 Post by Jerry3904 »

It's in the xset -q output
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

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?

#15 Post 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}

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?

#16 Post 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:
Conky Variables [https://conky.cc/variables] wrote:
${key_caps_lock}

An indicator for Capital Lock key.

${key_num_lock}

An indicator for Number Lock key.

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?

#17 Post 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

User avatar
jeffreyC
Posts: 529
Joined: Mon May 27, 2019 10:39 am

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

#18 Post by jeffreyC »

MXRobo wrote: Sun Nov 12, 2023 9:16 am 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
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.

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

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

#19 Post by Jerry3904 »

Fluxbox would need to be completely rebuilt from scratch
:rofl:
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

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?

#20 Post 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
You do not have the required permissions to view the files attached to this post.

Post Reply

Return to “MX Help”