Page 2 of 4

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:

Code: Select all

sh -c 'xset -q | grep Caps'

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:
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.

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
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.

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
:rofl:

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