PrintScreen key - in JWM? (partial solution)

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
miriam
Posts: 373
Joined: Wed 06 Dec 2006, 23:46
Location: Queensland, Australia
Contact:

PrintScreen key - in JWM? (partial solution)

#1 Post by miriam »

I've been trying to get various hotkeys sorted out in my Puppy (Lupu 528). This is something I've been meaning to do for some time, however the PrintScreen key has me stumped.

ROX sees it -- put an icon on the desktop, right-click it, choose "Edit Item" from the popup menu, click on the button with "They keyboard shortcut is:" written above it, and labelled "(click to set)". This will open a small borderless window waiting to accept a keypress. If you press the PrintScreen key then ROX will label the button "Print". Though it will ignore the hotkey if you actually try to use it -- I don't know if this is a problem with ROX or JWM (I suspect the latter).

xev sees it -- run xev in a terminal and it will open a window that waits for key and mouse events. If you press the PrintScreen key it will display a lot of information about the key down and key up events, but the important part is: keycode 111 (keysym 0xff61, Print)

I've tried adding a line to my /root/.jwm/jwmrc-personal file:
<Key key="Print">exec:/root/script/snapshot.sh</Key>
(snapshot.sh is my own small bash script that takes snapshots, adding a numbered suffix to the file and incrementing it each time).
But it doesn't work.

I have a workaround...
open a terminal and run xbindkeys_config
This opens a window that lets me set hotkeys and associate them with actions. This lets me associate the PrintScreen key with my screenshot script, but I'd like a more general solution.

Anybody got any ideas?

---

Incidentally, I have the "Windows" and "Menu" keys working nicely with JWM. I'd been wanting to do this for some time, but finally got the push to do it when JWM's assignment of the F12 key to the Puppy Menu conflicting with Blender3D's use of the F12 key to render a scene just got too annoying. Here's how I did it:
I opened /etc/xdg/templates/_root_.jwmrc and /root/.jwm/jwmrc-personal in text editors and commented out the assignment of F12, F1, and F2 keys, then, in /root/.jwm/jwmrc-personal only, I added the following lines:
<Key key="Menu">root:3</Key>
<Key mask="4" key="Menu">window</Key>

The first line maps the Menu key to the main Puppy Menu.

The second line maps the Windows key + Menu key to the window menu -- the menu you get if you right-click on any window titlebar.

The Menu key is usually between the right Windows key and the right Control key.

The Windows key is that annoyingly labelled key between the Ctrl and Alt keys on the left and between the Alt and Menu keys on the right. When using it as a key mask in JWM you have to call it "4", which apparently stands for Mod4 or Modifier 4. In older versions of JWM I think you could refer to it as "H" for Hyper key, but my memory is a little fuzzy on that. You can use the xmodmap command to see the modifiers.

(Hmmm... I must make some alternative keytops for my Windows keys to put little penguins on them instead.)
[color=blue]A life! Cool! Where can I download one of those from?[/color]

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

Re: PrintScreen key - in JWM? (partial solution)

#2 Post by MochiMoppel »

miriam wrote:I've tried adding a line to my /root/.jwm/jwmrc-personal file:
<Key key="Print">exec:/root/script/snapshot.sh</Key>
(snapshot.sh is my own small bash script that takes snapshots, adding a numbered suffix to the file and incrementing it each time).
But it doesn't work.
This works for me:
<Key keycode="111">exec:/root/script/snapshot.sh</Key>

User avatar
miriam
Posts: 373
Joined: Wed 06 Dec 2006, 23:46
Location: Queensland, Australia
Contact:

#3 Post by miriam »

Yay!! It does! Thank you. :)

I don't know why it didn't occur to me to try the number keycode instead of the symbolic string.
Mindset, I guess... like that neat example where you ask someone:
"Spell 'hop'."
When they spell it you then ask,
"Spell 'shop'."
When they spell that you ask,
"What do you do when you come to a green light?"
Nine times out of 10 they will answer "stop" even if they know the trick. Mindset is a very powerful thing.
[color=blue]A life! Cool! Where can I download one of those from?[/color]

User avatar
miriam
Posts: 373
Joined: Wed 06 Dec 2006, 23:46
Location: Queensland, Australia
Contact:

#4 Post by miriam »

Hmmm... odd thing though... it won't take a modifier, for instance Ctrl-PrintScreen to start PupSnap.
[color=blue]A life! Cool! Where can I download one of those from?[/color]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#5 Post by musher0 »

Hello everyone.

Nope, no modifiers (aka as "masks") allowed with keycodes in jwm. Besides, the
PrintScreen key is already sort of a modifier.

Best regards.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#6 Post by MochiMoppel »

miriam wrote:Hmmm... odd thing though... it won't take a modifier, for instance Ctrl-PrintScreen to start PupSnap.
Hmmm...odd, because that's exactly what I'm using; Ctrl+Printscreen to take a snapshot via mtPaint:

Code: Select all

<Key keycode="111" mask="C" >	exec:yaf-splash -fontsize large -bg yellow -timeout 3 -text "Ctrl+PrintScrn: Screen capture after 3 sec!";mtpaint -s</Key>

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#7 Post by musher0 »

Maybe I spoke through my hat... I'll have to try your tip, MochiMoppei.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#8 Post by MochiMoppel »

musher0 wrote:Maybe I spoke through my hat
Don't worry, I can't hear you :lol:

Actually you can have fun with almost any key. Try a CapsLock alert:

Code: Select all

<Key keycode="66">           exec:yaf-splash -border false -font 24 -fg white -bg red     -bg_gradient false -timeout 2 -text "CapsLock"</Key>
<Key keycode="66" mask="C">  exec:yaf-splash -border false -font 24 -fg white -bg green   -bg_gradient false -timeout 2 -text "Ctrl+CapsLock"</Key>
<Key keycode="66" mask="A">  exec:yaf-splash -border false -font 24 -fg white -bg blue    -bg_gradient false -timeout 2 -text "Alt+CapsLock"</Key>
<Key keycode="66" mask="S">  exec:yaf-splash -border false -font 24 -fg white -bg magenta -bg_gradient false -timeout 2 -text "Shift+CapsLock"</Key>
<Key keycode="66" mask="CA"> exec:yaf-splash -border false -font 24 -fg black -bg yellow  -bg_gradient false -timeout 2 -text "Ctrl+Alt+CapsLock"</Key>

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#9 Post by greengeek »

Don't know if it helps, but there is some great background including a discussion about supremacy of JWM over Rox here:
http://www.murga-linux.com/puppy/viewtopic.php?p=722237

I got brain freeze trying to take it all in...

User avatar
miriam
Posts: 373
Joined: Wed 06 Dec 2006, 23:46
Location: Queensland, Australia
Contact:

#10 Post by miriam »

Oh boy... :roll: I'm so blind sometimes. After scrutinising your line that works and mine that doesn't I finally noticed that I was using "key" instead of "keycode". One works for the symbolic string and the other for the number code. Oops.

Thank you for helping me see my mistake. :)
[color=blue]A life! Cool! Where can I download one of those from?[/color]

User avatar
miriam
Posts: 373
Joined: Wed 06 Dec 2006, 23:46
Location: Queensland, Australia
Contact:

#11 Post by miriam »

Wow, greengeek, this is wonderful information! I love finding out this kind of stuff. Now I truly understand the problem. And now I've fixed it, as detailed in the article I can use "Print" in JWM's key definitions. Yay!
Thank you!
[color=blue]A life! Cool! Where can I download one of those from?[/color]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#12 Post by musher0 »

MochiMoppel wrote:
musher0 wrote:Maybe I spoke through my hat
Don't worry, I can't hear you :lol:

Actually you can have fun with almost any key. Try a CapsLock alert:

Code: Select all

<Key keycode="66">           exec:yaf-splash -border false -font 24 -fg white -bg red     -bg_gradient false -timeout 2 -text "CapsLock"</Key>
<Key keycode="66" mask="C">  exec:yaf-splash -border false -font 24 -fg white -bg green   -bg_gradient false -timeout 2 -text "Ctrl+CapsLock"</Key>
<Key keycode="66" mask="A">  exec:yaf-splash -border false -font 24 -fg white -bg blue    -bg_gradient false -timeout 2 -text "Alt+CapsLock"</Key>
<Key keycode="66" mask="S">  exec:yaf-splash -border false -font 24 -fg white -bg magenta -bg_gradient false -timeout 2 -text "Shift+CapsLock"</Key>
<Key keycode="66" mask="CA"> exec:yaf-splash -border false -font 24 -fg black -bg yellow  -bg_gradient false -timeout 2 -text "Ctrl+Alt+CapsLock"</Key>
Ok, ok, don't throw any more at me, I believe you! :D
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#13 Post by musher0 »

greengeek wrote:Don't know if it helps, but there is some great background including a discussion about supremacy of JWM over Rox here:
http://www.murga-linux.com/puppy/viewtopic.php?p=722237

I got brain freeze trying to take it all in...
"Supremacy" makes it sound like a comment from the colonial era! :lol:
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#14 Post by jafadmin »

I know this is about JWM, but it might help some in the future to know how to do this in OpenBox as well.

I add the following in the Keybind section of /root/.config/openbox/rc.xml

Code: Select all

 <keybind key="0x6f">
      <action name="Execute">
        <command>mtpaint -s</command>
      </action>
    </keybind>
that causes a screen capture in mpaint when the prtsc key is pressed.

Post Reply