You are not logged in.

#1 2012-12-26 22:51:05

douglasr
Member
Registered: 2012-12-21
Posts: 19

[Solved] Openbox Keybinding Issues

Hello, just another Arch user here!

As a college student I often need to walk away from my laptop for short intervals of time for one reason or another. While either I, or a friend, are close enough to ensure that nobody walks off with it, I'd like to lock it before I leave it. I run LXDE, so I could click the power button and select lock, but it would be so much faster if I could simply press CTRL-ALT-L to that same end.

As a result I tried to edit my Openbox keybindings to add a keybinding that would execute xscreensaver-comand --lock when those keys were pressed. . . but it didn't work at all. I next wrote a bash script that would run the command. The script executed just fine on its own, but when I tried to call it using a keybinding in the rc.xml file it again didn't work. So I tried editing the lxde-rc.conf and tried both things again. Still nothing.

I don't think it is a problem with my syntax--I've copied it exactly from the example given in the rc.xml--and I've spent at last an hour searching the internet for a solution. Here is a copy of the syntax of a command that came with the rc.xml that does work:

 <keybind key="W-e">
    <action name="Execute">
      <startupnotify>
        <enabled>true</enabled>
        <name>Konqueror</name>
      </startupnotify>
      <command>kfmclient openProfile filemanagement</command>
    </action>
  </keybind>

and here is the command that I wrote, which doesn't:

<keybind key="C-A-l">
    <action name="Execute">
           <command>xscreensaver-command --lock</command>
    </action>
  </keybind>

The only difference is the lack of the <startupnotify> tag, which is also lacking on many of the examples that I found on the internet (and I tried keeping it, to no effect) and the command that is called. For my bash script it looks like this:

<keybind key="C-A-l">
    <action name="Execute">
           <command>bash ~/bin/auto-lock</command>
    </action>
  </keybind>

and I also tried:

<keybind key="C-A-l">
    <action name="Execute">
           <command>~/bin/auto-lock</command>
    </action>
  </keybind>

And it is not just this command that is giving me issues. As a test, I copied the working example exactly and tried to launch Chromium and Firefox--neither of those worked either.

My back is to a wall here, and I could really use some help. I have all these high and mighty plans about manually inputing all of my laptop's FN keybindings that don't work in Linux as is, but if I can't even run a basic command like this that will never happen!

Thanks,

Douglas

P.S. While I'm here, I may as well ask, what is the proper notation to use in the <keybind key=""> tag for my laptop's function key? I'm guessing FN, but somehow I think that would be too easy!

Resolution:

Copy the full syntax, including the <startup notify> tags and all within them. You must edit the lxde.rc.xml and not the rc.xml (they are both in the ~/.config/openbox directory). And then you must either reboot or run "openbox --reconfigure" in order to reload Openbox and have it recognize the keybindings.

Last edited by douglasr (2012-12-27 20:40:10)

Offline

#2 2012-12-26 22:57:48

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [Solved] Openbox Keybinding Issues

Please use code tags when pasting to the boards https://wiki.archlinux.org/index.php/Fo … s_and_Code, like so:

    <keybind key="C-S-L">
        <action name="Execute">
                <startupnotify>
                <enabled>false</enabled>
                <name>Lock Screen</name>
                </startupnotify>
                <command>xscreensaver-command -lock</command>
        </action>
    </keybind>

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2012-12-26 23:05:32

douglasr
Member
Registered: 2012-12-21
Posts: 19

Re: [Solved] Openbox Keybinding Issues

Ah, okay. I'd seen it but never bothered to look up how it was done. Thank you, I'll modify the post right away. I apologize for taking up some of your time over such a trivial matter that I should I have already known about.

Offline

#4 2012-12-27 19:14:01

douglasr
Member
Registered: 2012-12-21
Posts: 19

Re: [Solved] Openbox Keybinding Issues

Just an update on my efforts. I've retried writing the whole thing in both the rc.xml and lxde-rc.xml files like this.

    <keybind key="C-A-l">
        <action name="Execute">
                <startupnotify>
                <enabled>false</enabled>
                <name>Lock Screen</name>
                </startupnotify>
                <command>xscreensaver-command --lock</command>
        </action>
    </keybind>

Again to not effect. I've tried flipping the position of C and A in the keybind key (A-C-l), and tried using shift instead of alt (C-S-l). I've tried using a capital "L" instead of a lowercase one. Honestly I doubt that the problem has anything to do with my syntax though, not anymore. I cannot see a single functional difference between my syntax and the syntax of everything else in the file. Unless I'm messing up the formatting of how to write in the command to execute between the <command> tags anyway (but all the examples I've found online have done it the same way that I'm doing it).

I've spent more time searching the internet too, but I cannot find anything that is remotely helpful. I'm at a complete loss as to how to resolve this problem. I'm on the verge of giving up and making do without keybindings. . . or at least downloading that GUI for setting them up that I seem to recall was mentioned in the Arch Wiki on the LXDE page.

Offline

#5 2012-12-27 19:29:02

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: [Solved] Openbox Keybinding Issues

Try using a different key sequence. Modify one of the keybinds in rc.xml that does work (for something else) and change it to your screenlock. Try specifying the full path to your script (don't use ~).

Are you restarting openbox after you modify rc.xml? You must either log out and back in again, or

openbox --reconfigure

in a terminal for changes to take effect.

Finally, if nothing else works, you could try xbindkeys. https://wiki.archlinux.org/index.php/Xbindkeys

Offline

#6 2012-12-27 20:38:11

douglasr
Member
Registered: 2012-12-21
Posts: 19

Re: [Solved] Openbox Keybinding Issues

Thank you. I had tried rebooting in the past by I guess I really did have a syntax issue that time so it didn't work, and I stopped trying it. The openbox --reconfigure command fixed the problem.

Offline

#7 2012-12-27 21:00:04

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: [Solved] Openbox Keybinding Issues

You're welcome, and thanks for marking it [Solved].

Offline

Board footer

Powered by FluxBB