PrintScreen key - in JWM? (partial solution)
PrintScreen key - in JWM? (partial solution)
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.)
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]
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Re: PrintScreen key - in JWM? (partial solution)
This works for me: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.
<Key keycode="111">exec:/root/script/snapshot.sh</Key>
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.
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]
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Hmmm...odd, because that's exactly what I'm using; Ctrl+Printscreen to take a snapshot via mtPaint:miriam wrote:Hmmm... odd thing though... it won't take a modifier, for instance Ctrl-PrintScreen to start PupSnap.
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>
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Don't worry, I can't hear youmusher0 wrote:Maybe I spoke through my hat
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>
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...
http://www.murga-linux.com/puppy/viewtopic.php?p=722237
I got brain freeze trying to take it all in...
Oh boy... 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.
Thank you for helping me see my mistake.
[color=blue]A life! Cool! Where can I download one of those from?[/color]
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!
Thank you!
[color=blue]A life! Cool! Where can I download one of those from?[/color]
Ok, ok, don't throw any more at me, I believe you!MochiMoppel wrote:Don't worry, I can't hear youmusher0 wrote:Maybe I spoke through my hat
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>
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
"Supremacy" makes it sound like a comment from the colonial era!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...
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
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
that causes a screen capture in mpaint when the prtsc key is pressed.
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>