Unable to bind Print key in openbox

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
lithpr
Posts: 86
Joined: Thu 10 Mar 2011, 06:33

Unable to bind Print key in openbox

#1 Post by lithpr »

Hi!

Has anyone successfully been able to bind a command to the Print (PrtScn) key in Openbox in Lucid 5.2.5? The Pause key works, but Print and Scroll_Lock do not. It seems sensible to bind Print to execute scrot or mtpaintsnapshot.sh, but it is not working.

User avatar
pemasu
Posts: 5474
Joined: Wed 08 Jul 2009, 12:26
Location: Finland

#2 Post by pemasu »

I use for keybinding xbindkeys and xbindkeys-config apps. Then I drag symlink of xbindkeys to the /root/Startup to produce those keybindings.
You can get example .xbindkeysrc from fluppies, snow puppies, ice puppies, or most Iguleders puppies.

User avatar
lithpr
Posts: 86
Joined: Thu 10 Mar 2011, 06:33

#3 Post by lithpr »

Okay. thanks! I am familiar with xbindkeys, but I was hoping to use the OpenBox keybinding mechanism in rc.xml, and hoping there was an explanation for why the the Print key doesn't work in OpenBox in 5.2.5. xev shows it as working fine, but no joy using Print in rc.xml.

[Edit]
OTOH: i just tried xbindkeys, and it does work with the Print key. I guess "actually working" is a virtue :) Thanks pemasu.

It's funny, i had bundled up some scripts I use in rexbang with xbindkeys, hoping to make a pet that didn't conflict interfere with other peoples rc.xml, only to discover that many people are already using xbindkeys. I think i know why ;)

I would still love to hear from someone who managed to successfully use the Print key with rc.xml.

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#4 Post by Dougal »

I had this problem with JWM and managed to solve it by using the keycode number:

Code: Select all

<Key keycode="111">exec:mtpaint -s</Key>
You might want to make sure that it is actually recognized and not overlapped (like in my case):

Code: Select all

 xmodmap -pk | grep '(Print)'                                                       92         0xff61 (Print)  0xff15 (Sys_Req)                                    111         0xff61 (Print)  0xff15 (Sys_Req)    
The Openbox documentation (didn't work for me: google cache solved it), seems to imply they use the hex values:

Code: Select all

<keyboard>
  ...
  <keybind key="C-0x87">
    <action name="ShowMenu">
      <menu>root-menu</menu>
    </action>
  </keybind>
  ...
</keyboard>
so I guess you want replace the "C-0x87" with "0x6F" (assuming your Print key is 111... I just googled "111 in hex".)
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
lithpr
Posts: 86
Joined: Thu 10 Mar 2011, 06:33

#5 Post by lithpr »

Dougal,

BOOYAH! <keybind key="0x6F"> did the trick.

Thank you very much!

Lithpr

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#6 Post by DaveS »

I am currently trying to put together an Openbox tutorial here http://www.murga-linux.com/puppy/viewto ... 539#527539. Will try to add keybindings to that using the info here thanks.
Spup Frugal HD and USB
Root forever!

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

type xev

#7 Post by don570 »

To get the number associated with a key you just have to type 'xev' in
the terminal. However if it is assigned to a program already you have to
quit from X server and get a prompt to type 'xev'

I got the following good info from wikipedia...

Code: Select all

Using xev

Another way to get the keycodes of your keys is to use the graphical X program "xev" (without having to switch to a console environment). With the following line you can start xev and directly grep the important parts:

xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
In the example below I pressed the "a", "r", "c" and "h" keys and two of the media keys on my Dell keyboard. This gives me the following output:

38 a
27 r
54 c
43 h
153 NoSymbol
144 NoSymbol
This means that the "a", "r", "c" and "h" keys have the keycodes 38, 27, 54 and 43 and are properly bound while the media keys with the keycodes 153 and 144 have no function yet, which is indicated by "NoSymbol". If you press a key and nothing appears in the terminal, this means that the kernel doesn't see that key or that it is not mapped.
_______________________________________________________

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

Re: type xev

#8 Post by Dougal »

don570 wrote:To get the number associated with a key you just have to type 'xev' in
the terminal. However if it is assigned to a program already you have to
quit from X server and get a prompt to type 'xev'
My post above shows how to do it with xmodmap.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
lithpr
Posts: 86
Joined: Thu 10 Mar 2011, 06:33

#9 Post by lithpr »

i've used xev plenty of times, but it never occured to me to pipe it to filter the output. I've just scrooollllllllllled in the terminal. Very nice trick don570!

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

#10 Post by ASRI éducation »

Dougal wrote:replace the "C-0x87" with "0x6F" (assuming your Print key is 111... I just googled "111 in hex".)
Merci pour l'info.
;-)

Post Reply