Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 16 Oct 2019, 00:43
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
How to show 'Caps Lock' on screen? (Solved)
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [12 Posts]  
Author Message
Mike Walsh


Joined: 28 Jun 2014
Posts: 5473
Location: King's Lynn, UK.

PostPosted: Tue 12 Mar 2019, 17:30    Post subject:  How to show 'Caps Lock' on screen? (Solved)
Subject description: When Caps Lock is on
 

Evening, kiddiwinks.

Got a wee poser for you.

I want to try doing something just for kicks. I want to set things up so that when I hit my 'Caps Lock' key, not only does the keyboard indicator light come on, but I get the words 'Caps Lock' come up on the screen in big letters.

A second press of the key will then make the words disappear again.

I think I can use the key-bindings section at the bottom of /etc/xdg/templates/_root_.jwmrc to set up a trigger for this.....but how would you actually script this? One press makes something appear, then a second press causes it to disappear again. Appear...disappear...appear...disappear...appear...disappear (you get the picture). I'm guessing it's time for me to learn a bit more Bash.

Any ideas, please? Any & all suggestions/advice much appreciated, as always.


Mike. Wink

Last edited by Mike Walsh on Tue 12 Mar 2019, 23:16; edited 1 time in total
Back to top
View user's profile Send private message 
trapster


Joined: 28 Nov 2005
Posts: 2119
Location: Maine, USA

PostPosted: Tue 12 Mar 2019, 18:33    Post subject:  

This is what I use in a script on my desktop to start and stop an application by clicking on it. (yad used an an example)

Code:
#!/bin/sh

pidof yad && killall yad  || yad --form --field="Test"

_________________
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog
Back to top
View user's profile Send private message Visit poster's website 
Keef


Joined: 20 Dec 2007
Posts: 971
Location: Staffordshire

PostPosted: Tue 12 Mar 2019, 19:01    Post subject:  

A bit crude, and not exactly what you wanted (you have to close the dialog box yourself), but it's a start. Run the script then press the caps-lock.

Code:
#!/bin/sh
# dialog box won't go away until caps is off and you press OK
# This will run forever unless you hit Ctrl+C

while : ; do
     
    state=$(xset -q | grep LED | cut -f 4 -d ":")
     
    if [ $state = "00000001" ] ; then

       gxmessage -ontop -center "CAPS-LOCK ON"
       
    fi

done


(I wouldn't recommend actually using this, it is just an example).
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1921
Location: Japan

PostPosted: Tue 12 Mar 2019, 23:02    Post subject:  

I use a CapsLock warning and I changed it to meet your requirements. Pressing CapsLock key puts up a red warning, pressing again kills it.

To make it really easy I use a desktop icon, but you can use other ways for the key binding. To make it clear: The icon is not meant to be pushed, so you may want to replace the 48x48px icon with a 1px icon and "hide" it somewhere on the desktop where it doesn't hurt. It's main function is to provide a keyboard shortcut for the included code.

- create a desktop icon
- change/add input fields according to screenshot
- add a keyboard shortcut (MUST of course be the CapsLock)

The code in the arguments field:
Code:
-c "sleep .1;[[ $(xset -q) =~ (Caps Lock: *off) ]] && busybox pkill MySwitch  || exec -a MySwitch gxmessage -bo  -c -fn 'bold 18' -bg red -fg white -nof -bu '' $'\n  CapsLock' " 
Works for me.
[EDIT 2019-3-14] Changed 'pkill' to 'busybox pkill' because of faulty pkill symlinks in some Puppies
cAPSLOCK.png
 Description   
 Filesize   25.32 KB
 Viewed   228 Time(s)

cAPSLOCK.png


Last edited by MochiMoppel on Wed 13 Mar 2019, 21:59; edited 3 times in total
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 5473
Location: King's Lynn, UK.

PostPosted: Tue 12 Mar 2019, 23:07    Post subject:  

Hallo, you two.

Thanks for the demos. After some hunting around on t'web, I've found something in the PPM of the 'buntu-based Pups that'll do the job.

It's called indicator-keylock. It doesn't put text on the screen, but what it does do is to place a visible indicator in the notification area, over to the right. Like so:-





In fact, you get one for each of the 3 'lock' keys. You get an 'A' for CapsLock; you get a '1' for NumLock, and you get a '↓' for ScrollLock.

You can get this as a .deb package, but there's a few necessary deps (I've just knocked up a package for Precise 571 from the .deb in the age-related Ubuntu 'old-releases' archive).....mainly libdbusmenu-glib & libdbusmenu-gtk3. Also libindicator, libappindicator, and libunique, but we're looking at less than 300kb of deps, so it's not exactly hurting the save-file.

If anybody's interested, I'm attaching the .pet below. Only for Precise 571, mind, and although I've included those deps mentioned above, I can't guarantee it'll necessarily work for anyone else. My 571 has had so much extra stuff added over the last 3 years or so, god only knows what I've got kicking around in /lib & /usr/lib by this time..!

The binary's sym-linked into /root/Startup, so it'll run every time you fire Puppy up.

I'll mark this as 'Solved'. Thanks for the pointers anyway, guys; they got me searching around on a rather different tack to what I started out with; I got the link for this from StackOverflow, of all places.

---------------------------------------

@ Mochi:-

Sorry, mate; our posts crossed, I think. I posted at the same time as you, or shortly afterwards while I was editing...

I'm going to hang onto your script there, 'cos I've got an idea in mind for something else that I think I can modify it for. It certainly won't go to waste. Cheers!

(I came across 'xset q' during my research, so I see where you're going with that. I was initially thinking along the same lines myself.....using 'grep' to 'cut-out' the bit I needed, though how to implement the on/off part was where I'd got stuck.)


Mike. Wink

_________________
MY 'PUPPY' PACKAGES

Back to top
View user's profile Send private message 
ETP


Joined: 19 Oct 2010
Posts: 1166
Location: UK

PostPosted: Wed 13 Mar 2019, 03:38    Post subject:  

Hi Mike,

Two more alternative pets (64-bit & 32-bit) which I have been using in every Pup since 2017. Very Happy

www.murga-linux.com/puppy/viewtopic.php?p=963460&search_id=1330734512#963460

www.murga-linux.com/puppy/viewtopic.php?p=963428&search_id=1330734512#963428

_________________
Regards ETP

Kennels
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 5473
Location: King's Lynn, UK.

PostPosted: Wed 13 Mar 2019, 06:02    Post subject:  

@ ETP:-

Mornin', mate. Hey, thanks for those. I've installed it in Slacko 560 for now; running nicely.

I'll trial all these. The one I found in a couple of Pups; Mochi's in another couple, and this one of SFR's in yet two more. Give 'em a few weeks.....see which one I like the best.

I've got the same problem you mentioned, anyway. Following the (ahem!) 'coffee' incident with the old Dell's keyboard a couple of years ago, I now use a cheap'n'cheerful wireless one from PCWorld. Works great.....but NO indicator lights! (*grrrr*) Rolling Eyes

(For my use-case - with a dark grey title bar - and the state of my eyes ( Laughing ), black text on a white background seems to work best for me.....)





Let's see how I get on with 'em, shall we? Thanks again.

-----------------------------

@ Flash:-

Thanks for modifying the thread title. That's much clearer.....dunno what I was thinking last night. Cheers.


Mike. Wink

_________________
MY 'PUPPY' PACKAGES

Back to top
View user's profile Send private message 
fabrice_035


Joined: 28 Apr 2014
Posts: 642
Location: Bretagne / France

PostPosted: Wed 13 Mar 2019, 12:53    Post subject:  

Hello,
Just for info:
The MochiMoppel code (and idea) is very interessting but it's buggy sometimes. Gxmessage active remain, sometimes when I change the active window, or not, strange behavior Rolling Eyes
Regard

_________________
xenialpup 7.5 / Linux Kernel: 4.4.95 / Window Manager: JWM v2.3.7
Back to top
View user's profile Send private message 
pp4mnklinux


Joined: 23 Aug 2013
Posts: 350

PostPosted: Wed 13 Mar 2019, 13:39    Post subject: http://www.murga-linux.com/puppy/viewtopic.php?t=115651
Subject description: http://www.murga-linux.com/puppy/viewtopic.php?t=115651
 

http://www.murga-linux.com/puppy/viewtopic.php?t=115651
_________________
Distro: xenialpup64 7.5 XXL
Desktop Panel: JWM ~ FbBox 5.0

Last edited by pp4mnklinux on Thu 14 Mar 2019, 02:30; edited 2 times in total
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1921
Location: Japan

PostPosted: Wed 13 Mar 2019, 22:12    Post subject:  

fabrice_035 wrote:
The MochiMoppel code (and idea) is very interessting but it's buggy sometimes. Gxmessage active remain, sometimes when I change the active window, or not, strange behavior
I can't replicate your strange behavior. Try to increase the sleep time.
gxmessage relies on the results of xset, and xset must run only after the system has noticed the new key status. Normally 0.1sec should be enough but maybe some systems need more.

.

Last edited by MochiMoppel on Wed 20 Mar 2019, 08:10; edited 1 time in total
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 13343
Location: Arizona USA

PostPosted: Thu 14 Mar 2019, 00:04    Post subject:  

http://www.murga-linux.com/puppy/viewtopic.php?t=114189
pp4mnklinux had a similar problem back in August.
Back to top
View user's profile Send private message 
fabrice_035


Joined: 28 Apr 2014
Posts: 642
Location: Bretagne / France

PostPosted: Thu 14 Mar 2019, 06:12    Post subject:  

MochiMoppel wrote:
Normally 0.1sec should be enough but maybe some systems need more.


Right, 0.7s it's good

_________________
xenialpup 7.5 / Linux Kernel: 4.4.95 / Window Manager: JWM v2.3.7
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [12 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0596s ][ Queries: 13 (0.0098s) ][ GZIP on ]