Topic: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

Here's the backstory. I started on XFCE but I didn't like it so I switched to OpenBox. OpenBox is much better, however there was one problem. The volume control keys didn't work. I thus read up and did this workaround( http://crunchbanglinux.org/forums/topic … ol-solved/ ) on my rc.xml.

Did it work? Certainly, but there is still one more minor problem. See when I adjusted the brightness or sound on my XFCE install there was a popup on the upper right corner that showed me how much brightness or volume I was at. Don't know what that popup is called but hopefully I described it well enough for you guys to know what I'm talking about. Anyway, even after the workaround however that popup didn't appear for the volume.

I am aware that there are multiple ways to get a hotkey to perform a task. For example when I press the brightness up button the brightness increases and the popup comes up showing me where I'm at. Clearly that hotkey increases the brightness and also invokes the indicator popup display where its at. I want the same thing to be for sound. Thus I want to see to what action the brightness increase button is mapped so that i can get my volume control buttons working analogously.

I tried searching rc.xml to see to what commands the brightness increase/decrease were mapped so that I could see how to invoke that popup. Sadly no luck. Please help me out here folks.

Last edited by hiushoz (2011-08-31 04:09:34)

Re: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

you can try the command

amixer get Master

it should display the value of your volume (in the terminal). if that is the info you want to see you just have to find out how to send it to the "notify-send" command or something similar. then you put the commands in a script and bind the script to you keys with the rc.xml file.
I advise you to read the man pages for amixer and notify-send.
good luck
luc

Re: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

This actually is one of the most discussed topics here in the forums, I keep stumbling over such threads, but - strangely enough - never when I search for relevant keywords lol

http://crunchbanglinux.org/forums/topic … ind-in-ob/

One of them.

I'm so meta, even this acronym

Re: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

@luc:
Thanks man I'll look into it. My friend says that the program responsible for those notifications is called notify-osd. If I'm understanding you correctly notify-send is the way that you communicate with notify-osd?

@Awebb:
The volume control buttons work. I'm just trying to get the notify-osd popup working.

Re: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

@hiushoz: yes you do e.g. $ notify-send "Whatever man" and it'll pop-up "whatever man"...I know that with python you can get other stuff like an image, etc. You might have to install libnotify-bin for it to work.

Leave the gun. Take the cannoli.

Re: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

I know it's not exactly the most elegant solution, but I use for Compiz standalone and Openbox the xfce4-notifyd, it captures such events automatically.

I'm so meta, even this acronym

Re: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

@mahatman2:
Thanks man. And yes I did need to install it. The only question I have is how do things like cb-fortune pop up without that? I'll need to read the cb-fortune script more carefully I guess...

Also after quite some searching by a friend he found this other link on the forums that solved my exact problem. I will drop it here so that it'll hopefully help others as well:
http://crunchbanglinux.org/forums/post/115248/#p115248

Re: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

Though the above solution worked and the system now behaves as I want it too, I still do wonder though how the brightness increase button worked automatically? What action does it invoke. The link my friend found certainly does the job but I still feel like there must be a more elegant way. Also I want my system to work consistent.

Thus while the issue motivating the question was resolved the original question stands. How can I know to what action a hotkey is mapped? In Openbox? In general?

Re: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

^ It's b/c the cb-fortune script is in python, afaik. As to the other, good luck man. IDK about that hmm

Leave the gun. Take the cannoli.

Re: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

gedit ~/.config/openbox/rc.xml  -> "Keybindings" section -> example: <keybind key C-A-w> means Ctrl+Alt+w, and it should open this or that <command>.

Another way: we want to know the hex code of the key w (or a media key, Fn key, brightness key etc.)

xev -> press the w key and read the value behind keycode 25  (in brackets), there is a hex code - for example 0x77. This hex code you can put in rc.xml like <keybind key="C-A-0x77 ">

The keycode can be used to map a key to another value, using xmodmap. This is helpful if you have a broken key or you don't like the position of certain keys.

In general, xev shows you which event is called when pressing and releasing a certain key. xmodmap can map a certain key to another keycode (and thus position). rc.xml is the keybinding configuration for openbox.

Nothing right in the left brain. Nothing left in the right brain.

Re: [SOLVED98%]How can I know EXACTLY to what command a hotkey is mapped?

@machinebacon:
Thanks man. The curious thing is this. While I get the expected result when I press the volume control keys for example:

KeyRelease event, serial 40, synthetic NO, window 0x2800001,
    root 0x105, subw 0x0, time 11945207, (203,265), root:(797,553),
    state 0x0, keycode 121 (keysym 0x1008ff12, XF86AudioMute), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

When I press brightness up or down I get results that I can't make sense of:

FocusOut event, serial 42, synthetic NO, window 0x2800001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 42, synthetic NO, window 0x2800001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 42, synthetic NO, window 0x0,
    keys:  1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

MappingNotify event, serial 42, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

FocusOut event, serial 42, synthetic NO, window 0x2800001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 42, synthetic NO, window 0x2800001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 42, synthetic NO, window 0x0,
    keys:  1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

This gives me no indication that the key was recognized and furthermore no indication of the fact the it lowers brightness. Shouldn't there be something like XF86VideoBrighten? or something? I still don't know what action the brightness increase buttons evoke from the system. They work but how? What command do they give the system? What am I to make of this strange output of xev?