Page 1 of 1

Keyboard Shortcut for Shell Script and Help with Obkey

Posted: Fri Jul 14, 2017 4:47 am
by dalton_daley
I am new to the LXDE desktop and I have a .sh file that disables my trackpad .. on other desktop environments I have been able to assign it to a Keyboard Shortcut to toggle it back and forth, but I am not able to find out how to set it as a shortcut on LXDE. I have Obkey installed and see it in the menu .. but it won't open and when I try to open in through Terminal I get this:

Traceback (most recent call last):
File "/usr/bin/obkey", line 40, in <module>
ob.load(path)
File "/usr/lib/python2.7/dist-packages/obkey_classes.py", line 1668, in load
self.dom = xml.dom.minidom.parse(path)
File "/usr/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
return expatbuilder.parse(file)
File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 922, in parse
fp = open(file, 'rb')
IOError: [Errno 2] No such file or directory: '/home/dalton/.config/openbox/rc.xml'

I have Python installed and updated to the latest version per Terminal as well so not exactly sure what is going on. I would appreceiate any help getting Obkey working and setting my .sh script on a Keyboard Shortcut.

Thanks so much for your help in this matter

Dalton

Re: Keyboard Shortcut for Shell Script and Help with Obkey  Topic is solved

Posted: Sun Jul 16, 2017 5:22 pm
by seppalta
Set up an application keybinding in ~/.config/openbox/rc.xml directly. See the second part of the "Keybindings Menus" section of http://lxlinux.com/openbox.html for details for an applications keybinding. Use the path to your shell script as the command.

Re: Keyboard Shortcut for Shell Script and Help with Obkey

Posted: Mon Jul 17, 2017 7:20 am
by peteralan
Set up an application keybinding in ~/.config/openbox/rc.xml directly.

Re: Keyboard Shortcut for Shell Script and Help with Obkey

Posted: Wed Jul 19, 2017 3:25 pm
by dalton_daley
seppalta wrote:Set up an application keybinding in ~/.config/openbox/rc.xml directly. See the second part of the "Keybindings Menus" section of http://lxlinux.com/openbox.html for details for an applications keybinding. Use the path to your shell script as the command.
Thank you for your response ... I was looking through that section you mention in Keybindings Menu's and I believe you are referring to this:

<!--Keybindings for running applications-->

<keybind key="C-A-a">
<action name="Execute">
<startupnotify>
<enabled>true</enabled>
<name>pcmanfm-menu</name>
</startupnotify>
<command>pcmanfm -n menu://applications/</command>
</action>
</keybind>

I was also looking at the openbox folder and I don't have rc.xml .. I have lxde-rc.xml. As for the path to my shell script it is /home/dalton/Documents/Scripts/toggle-touchpad.sh

So if I understand you correctly it would be setup as the following:

<!--Keybindings for running applications-->

<keybind key="C-A-t">
<action name="Execute">
<startupnotify>
<enabled>true</enabled>
<name>toggle-touchpad</name>
</startupnotify>
<command>pcmanfm -n menu://home/dalton/Documents/Scripts/toggle-touchpad.sh/</command>
</action>
</keybind>

Re: Keyboard Shortcut for Shell Script and Help with Obkey

Posted: Thu Jul 20, 2017 4:53 pm
by seppalta
Almost got it. Pcmanfm has nothing to do with executing the shell script. The command part should be the following:

Code: Select all

/home/dalton/Documents/Scripts/toggle-touchpad.sh
Test C-A-t first, to be sure it isn't already used. You can use just about any combination that isn't already in use. Also, be sure toggle-touchpad.sh is executable. Just right-click on it and go to Properties>Permissions>Execute and choose anyone.

Re: Keyboard Shortcut for Shell Script and Help with Obkey

Posted: Mon Jul 24, 2017 6:22 am
by dalton_daley
seppalta wrote:Almost got it. Pcmanfm has nothing to do with executing the shell script. The command part should be the following:

Code: Select all

/home/dalton/Documents/Scripts/toggle-touchpad.sh
Test C-A-t first, to be sure it isn't already used. You can use just about any combination that isn't already in use. Also, be sure toggle-touchpad.sh is executable. Just right-click on it and go to Properties>Permissions>Execute and choose anyone.
Yea I had copied and pasted it and wasn't thinking lol .. thank you so much for your help with this .. got it working!!! :-)

Thank you again so much for your help with this

Dalton