Author Topic: Multimedia keyboard buttons configuration for Openbox  (Read 3879 times)

Offline unist

  • Full Member
  • ***
  • Posts: 158
Multimedia keyboard buttons configuration for Openbox
« on: December 29, 2011, 03:28:48 PM »
I have Openbox 2011-08 and I want to configure the keyboard multimedia buttons for my Delux Keyboard model K5300. I already did it, but the button for e-mail goes to Evolution and I have Sylpheed 3.1.2 and the button for Home needs Nautilus and I have PCManFM 0.9.10. Can I configure Multimedia Keys to use my software? Thank you.
Registered Linux user #547260

Offline djohnston

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6227
  • I don't do Windows
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #1 on: December 29, 2011, 03:33:48 PM »
What package/program are you using to configure the keyboard?
Bare metal                           VBox
AMD Athlon 7750 Dual-Core    Single core
4GiB RAM                              1GiB RAM
nVidia GeForce FX 5200          64MB video
LXDE 32bit                            KDE 64bit

Registered Linux User #416378

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #2 on: December 29, 2011, 05:17:48 PM »
Hi,

A trick in Openbox consists in using music software in which is it possible to configure the multimedia keyboard. ie : audacious allows that, with minimum effort, from within the preferences. Else, on my laptop, I ticked the switches in the section "Preferences > Hotkeys" in Volumicon. That works !

Otherwise, same question as djohnston. :)

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #3 on: December 29, 2011, 07:50:29 PM »
What package/program are you using to configure the keyboard?

It is Acme 2.4.3
Registered Linux user #547260

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #4 on: December 29, 2011, 08:12:40 PM »
Hi melodie, thank you for your post. I am exploring hotkeys in VLC 1.1.13, but I don't see an option that I can  use for e-mail or file manager. If it is there, I don't recognize it. I don't have Audacious installed. I also have gnome-mplayer 1.0.4 but still have not used it. I'll see there.
Registered Linux user #547260

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #5 on: December 30, 2011, 04:16:41 AM »
Hi melodie, thank you for your post. I am exploring hotkeys in VLC 1.1.13, but I don't see an option that I can  use for e-mail or file manager. If it is there, I don't recognize it. I don't have Audacious installed. I also have gnome-mplayer 1.0.4 but still have not used it. I'll see there.


Hi unist,

Would you try this method and let us know if it works ?

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #6 on: December 30, 2011, 12:57:32 PM »
melodie: I have Keytouch 2.3 and ran it. My keyboard (Delux K5300) was not listed, then I edited it and saved it. I tried several options for the special keys: default-setting, program and special action. In all cases I obtained no response from the special keys. I tried opening xev but I didn't recognize codes for the special keys in displayed listing.
I ran again Acme 2.4.3 and special keys for Volume Up, Volume Down, Play/Pause, Eject, and Web Browser worked fine, but e-mail button pointed to Evolution and File Manager to Nautilus that I don't have. Is there a way to change default behavior for these two buttons in Acme 2.4.3?
Registered Linux user #547260

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #7 on: December 30, 2011, 06:16:20 PM »
Hi,
I don't know about gui Acme and Keytouch. In the article I pointed to it says about editing rc.xml for this purpose. This is what I was suggesting you to try. Would you backup your actual rc.xml file and try to add keycodes to it the way it is described in the above said blog ?

BTW, Happy New Year !

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline djohnston

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6227
  • I don't do Windows
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #8 on: December 30, 2011, 09:45:33 PM »
I am exploring hotkeys in VLC 1.1.13, but I don't see an option that I can  use for e-mail or file manager. If it is there, I don't recognize it.

For hotkeys, the trick seems to be editing the values in /etc/hotkeys.conf. Here's a portion of the file:

# WebBrowser=mozilla
# Email=mozilla -mail
# Calculator=xcalc
# FileManager=gmc
# MyComputer=gmc
# MyDocuments=gmc

Uncomment the lines for the functions you want and enter the executable to go along with it. For example,
WebBrowser=firefox

I tried opening xev but I didn't recognize codes for the special keys in displayed listing.

It's hard to catch if you move the mouse. Leave the mouse in the small white window with a black circle, then press the key on your keyboard. Shown below is the keycode generated when turning the volume bezel up:

KeyRelease event, serial 42, synthetic NO, window 0x4600001,
    root 0x18f, subw 0x0, time 29257681, (111,129), root:(487,236),
    state 0x10, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES


I ran again Acme 2.4.3 and special keys for Volume Up, Volume Down, Play/Pause, Eject, and Web Browser worked fine, but e-mail button pointed to Evolution and File Manager to Nautilus that I don't have. Is there a way to change default behavior for these two buttons in Acme 2.4.3?

I can't figure acme out. I've looked at every acme file that's installed. At first, I thought the program values were hardcoded. But, pressing the E-Mail key on mine calls for thunderbird, and on yours it calls for Evolution. Pressing the WWW key on mine calls for /usr/lib/firefox-6.0.2/firefox about:blank, which appears to be a system default somewhere, but I can't find it. I've dug through all the /etc/xdg files and ~/.config/openbox/rc.xml and found nothing, so far. On my system doing set | grep BROWSER shows BROWSER=midori, and set | grep MAIL shows MAIL=claws-mail. So, Acme isn't getting its program defaults from the environment set.

The /usr/share/acme-2.4.3/README file is pretty much useless. There is no man page. Searching the internet for an hour turns up very sparse information which is often conflicting and is very old. Acme doesn't appear to be maintained any more. Bottom line is that without documentation, it's a guessing game, so far.
Bare metal                           VBox
AMD Athlon 7750 Dual-Core    Single core
4GiB RAM                              1GiB RAM
nVidia GeForce FX 5200          64MB video
LXDE 32bit                            KDE 64bit

Registered Linux User #416378

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #9 on: December 31, 2011, 03:47:09 AM »
For hotkeys, the trick seems to be editing the values in /etc/hotkeys.conf.

Hi,
I don't have this file in my system. What package brings it in ? Is it "hotkeys - A program to use the special keys on internet/multimedia keyboards" ?

Quote
KeyRelease event, serial 42, synthetic NO, window 0x4600001,
    root 0x18f, subw 0x0, time 29257681, (111,129), root:(487,236),
    state 0x10, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES

Have you tried what the guy in the page I gave says ?
Quote
Here, the key "www" has for code XF86HomePage
Now you need to edit the file rc.xml: $ leafpad .config / openbox / rc.xml and add before </ keyboard>
<keybind key="XF86HomePage">
<action name="Execute">
<command> google-chrome </ command>
</ action>
</ keybind>
We must do the same for each of the multimedia keys and restart openbox. Your shortcuts now work.

I don't have a multimedia keyboard in use just now, so I didn't try, but I suppose this can work. And once the rc.xml file is opened (geany is a better editor than leafpad imo, with the colors in the text) it is pretty easy to do a search in the menu Search to seek for "</ keyboard>".

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline djohnston

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6227
  • I don't do Windows
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #10 on: December 31, 2011, 02:04:14 PM »
I don't have this file in my system. What package brings it in ? Is it "hotkeys - A program to use the special keys on internet/multimedia keyboards" ?

Yes, that's the one.

Have you tried what the guy in the page I gave says ?
Quote
Here, the key "www" has for code XF86HomePage
Now you need to edit the file rc.xml: $ leafpad .config / openbox / rc.xml and add before </ keyboard>
<keybind key="XF86HomePage">
<action name="Execute">
<command> google-chrome </ command>
</ action>
</ keybind>
We must do the same for each of the multimedia keys and restart openbox. Your shortcuts now work.

No, I haven't installed keytouch-editor yet. I will, though. But, I wonder if it will work with ~/.config/openbox/lxde-rc.xml. I have 2 LXDE desktops and 2 Openbox. The keyboard is shared by one LXDE and one Openbox. The other two are standalones.
Bare metal                           VBox
AMD Athlon 7750 Dual-Core    Single core
4GiB RAM                              1GiB RAM
nVidia GeForce FX 5200          64MB video
LXDE 32bit                            KDE 64bit

Registered Linux User #416378

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #11 on: December 31, 2011, 03:43:59 PM »
I don't have this file in my system. What package brings it in ? Is it "hotkeys - A program to use the special keys on internet/multimedia keyboards" ?

Yes, that's the one.

Good to know ! It is probably very light. I should add it to all Openbox versions ! Could be useful sometimes.
Quote
Have you tried what the guy in the page I gave says ?
Quote
Here, the key "www" has for code XF86HomePage
Now you need to edit the file rc.xml: $ leafpad .config / openbox / rc.xml and add before </ keyboard>
<keybind key="XF86HomePage">
<action name="Execute">
<command> google-chrome </ command>
</ action>
</ keybind>
We must do the same for each of the multimedia keys and restart openbox. Your shortcuts now work.

No, I haven't installed keytouch-editor yet. I will, though. But, I wonder if it will work with ~/.config/openbox/lxde-rc.xml. I have 2 LXDE desktops and 2 Openbox. The keyboard is shared by one LXDE and one Openbox. The other two are standalones.

Hu hu ! I was not talking about using keytouch-editor, but pure text editor : add block texts for multimedia keyboards in the file /home/user/.config/openbox/rc.xml !

:D

That seems so simple ! It has to work ! Uh, I have to try it (don't have the right devices under hand just now... )

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline djohnston

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6227
  • I don't do Windows
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #12 on: December 31, 2011, 03:50:20 PM »
Hu hu ! I was not talking about using keytouch-editor, but pure text editor : add block texts for multimedia keyboards in the file /home/user/.config/openbox/rc.xml !

:D

That seems so simple ! It has to work ! Uh, I have to try it (don't have the right devices under hand just now... )

Well, I've just glanced at the article you linked to, so far. I'll give it a shot. But, probably not tonight.  ;)
Bare metal                           VBox
AMD Athlon 7750 Dual-Core    Single core
4GiB RAM                              1GiB RAM
nVidia GeForce FX 5200          64MB video
LXDE 32bit                            KDE 64bit

Registered Linux User #416378

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #13 on: December 31, 2011, 04:10:41 PM »
Details about a xml block text, for who needs to learn to read them:

A xml file has some similarities with html files. It has a start tag, and an end tag. For example, a xml file could start with a header, stating what type of file and which version, such as this one in rc.xml:
<?xml version="1.0" encoding="UTF-8"?>

Then it has a comment, which as such is not read by system (here openbox)

<!-- Do not edit this file, it will be overwritten on install.
        Copy the file to $HOME/.config/openbox/ instead. -->

so in Geany text editor it is displayed in a grey color, which shows it is indeed commented and therefore not active.

A comment is a text between the 2 signs: <!-- and -->

Then a first start tag:
<openbox_config xmlns="http://openbox.org/3.4/rc">

and at the very end of the file, the end tag which closes the above tag:
</openbox_config>

the first tag contains an information which gives detail about "xmlns", but it could also have no information (I don't know what this information is used for... if needed I can ask other people knowing more xml than I do).

other tags are nested inside the main one above described.

Other tags nested, for example the tag for  keyboard, as we are interested here about the multimedia keyboard:

The tag starts with:
  <keyboard>

and ends with:

  </keyboard>

and in between are nested a bunch of commands. Here the detail for one (the first I meet with just after the start keyboard tag):
    <!-- Keybindings for desktop switching -->
    <keybind key="C-Left">
      <action name="DesktopLeft">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>

There is a comment, then at the line just after, a keybind key : if you press together Ctrl (symbolized by the C letter) together with the left arrow of the keyboard, you will start the action described at the following line : (action name = Desktopleft) display the next desktop available on the left (if you are not already using it).

the tag "dialog" ? No idea. The tag wrap ? same, no idea (if you guess... or if you know, I am always interested to learn more).

Each opened tag must be closed:     <keybind key="C-Left"> is closed with     </keybind> and the other informations/commands are nested in it.       <action name="DesktopLeft"> is closed with  </action> and the other infos are nested in it.

Each main action has it's own tag and the set of informations nested in it. This is why it does not seem too difficult to add the keybind keys directly in the file, once we know that, and after getting the explanation from this blog.

<keybind key="XF86HomePage">
<action name="Execute">
<command> google-chrome </ command>
</ action>
</ keybind>


XF86HomePage will be replaced by whatever you find out with xev while pressing the button for the Mail, google-chrome by the Mail client you use... and you will create one full block text such as the one above for each button you want to configure on your keyboard.

You will create all these block texts just before the end tag   </keyboard> and you can even start with a comment to find it easily each time you need it, for exemple:

<!-- My own personal Multimedia --brand-model-- keyboard keys -->

What do you think ? Who wants to try and say how it goes ?

Well, I've just glanced at the article you linked to, so far. I'll give it a shot. But, probably not tonight.  ;)



:)

I wanted to add details about how to deal with the xml file, for anyone (unist maybe ?) who might need it. Who knows if I can also learn more... :)

Happy New Year ! It's 13 past midnight here !!! :D









« Last Edit: January 02, 2012, 04:36:20 AM by melodie »
melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: Multimedia keyboard buttons configuration for Openbox
« Reply #14 on: January 01, 2012, 08:16:18 PM »
Dear melodie and djohnston: I am reading all posts from you in this thread and I am happy to see that this discussion has led to rich interchanges between you two. I will carefully review all your valuable information in order to understand it and then apply your suggestions. I am a Linux newbie user eager to learn and experiment. My PCLOS Openbox is in my home, so I use it at nights once I return from my job. Tomorrow I will be on it. Have a wonderful 2012!!!
Registered Linux user #547260