1

I want to be able to launch bash scripts and software, basically any command, using global shortcuts on LXDE running on RPi3 B. For example I want to be able to launch a script with the Alt + Shift + K key combination.

I know how to do this in Ubuntu but how do I do it in this environment?

1 Answer 1

2

Your window manager, Openbox, handles keyboard shortcut bindings. LXDE is just your desktop environment, and doesn't actually handle drawing the windows and receiving key presses, so even though you're using LXDE, you still need to work with Openbox. They provide a handy guide on how to setup bindings for whatever you like, but here are the important steps:

  1. You can set up bindings in ~/.config/openbox/rc.xml. If you don't have that, you can copy it from /etc/xdg/openbox/rc.xml.

  2. You'll see some contents in your rc.xml file, like this:

    <keyboard>
        <keybind key="A-F4">
            <action name="Close"/>
        </keybind>
        ...
    </keyboard>
    

    (I omitted some of the default bindings for brevity, but this shows you the general structure.)

  3. You will want to add this (near the end, most likely, after the last </keybind>):

    <keybind key="A-S-k">
        <action name="Execute">
            <command>/home/pi/example.sh --flags</command>
        </action>
    </keybind>
    

    (replace the /home/pi/example.sh --flags example with your desired script; A-S-k represents Alt+Shift+K, and remember that if you change this, letters should be lower-case – see this section for all modifiers)

  4. Save the file, and restart. Your new key binding should then be ready to use!

Not the answer you're looking for? Browse other questions tagged or ask your own question.