LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-01-2016, 11:09 AM   #1
iFunction
Member
 
Registered: Nov 2015
Posts: 248

Rep: Reputation: Disabled
Configure hotkey for script


Hi there,

I have written a script that formats USB drives from a Raspberry Pi, and I have also managed to make it a command and a desktop icon click, all of which I am very proud of. The one bit I am now missing is how to run this using a hot key. Unfortunately something isn't quite right as I can set up the hotkey, but it doesn't really run the script, it does something as the "You haven't ejected your USB stick correctly! Go to Jail" message pops up in the bottom right corner, which inplies to me that it is doing something with the script, as the script does involve ejecting the usb stick at the end of the script. What it should do is open a terminal window and ask a question.

As a result, I think I know where my error is, but don't know where to look to get it right. So, I have edited the file /home/pi/.config/openbox/lsde-pi.xml with the following:
Code:
<keybind key="C-S-f">
   <action name="Execute">
      <command>formatusb</command>
   </action>
</keybind>
I have also changed the command to the full path of the script and the same thing happens. I am suspecting that the error is to do with the action name "Execute" but I can't be sure.

Can anybody shed a little light on this issue please as it is very curious.

Kind regards
iFunc
 
Old 03-01-2016, 03:46 PM   #2
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 183

Rep: Reputation: 39
Just for test purposes consider replacing formatusb by a simpler script and see if that runs correctly.
Your code for triggering the formatusb script seems fine.
Also doublecheck that formatusb works fine via the command line.
And check logs for permission issues.
 
1 members found this post helpful.
Old 03-01-2016, 04:00 PM   #3
K4rolis
LQ Newbie
 
Registered: Jan 2016
Posts: 23

Rep: Reputation: Disabled
I would think that if you actually want to see the terminal pop up, you'll need to do something along the lines of (xterm used as an example, look up man pages on the terminal you are using):
Code:
xterm -e formatusb
Making your config:
Code:
<keybind key="C-S-f">
   <action name="Execute">
      <command>xterm -e formatusb</command>
   </action>
</keybind>
Test it out by first doing something like:
Code:
<keybind key="C-S-f">
   <action name="Execute">
      <command>xterm -e 'echo Hi; sleep 5'</command>
   </action>
</keybind>
And build from there.
 
1 members found this post helpful.
Old 03-03-2016, 01:42 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 13,147
Blog Entries: 9

Rep: Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603
1) the default openbox rc.xml should already contain hotkey commands that you can use as a blueprint.
but from what you say, it seems to work on the openbox side.
2) judging from the notification you described, you are running some sort of desktop environment which is most probably set to automount removable devices. you should disable that feature (usually through the filemanagers preferences).
3) formatting a usb stick requires superuser privileges. have you taken that into account in your script?

to further help, we would need:
- information on your setup (desktop environment, modifications to default settings)
- contents of the formatusb script
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems writing script tied to a hotkey (Linux Mint 17, KDE) for Corsair K70 kbd Lurkr Linux - Newbie 6 06-15-2015 11:32 AM
configure script sends bad switches to daughter configure scripts Wells Linux - Software 7 10-10-2008 04:38 PM
hotkey customize alex2323 Linux - Newbie 1 09-30-2008 11:21 PM
Possible to have hotkey for screenshot? ryedunn Linux - Newbie 2 04-24-2004 05:53 PM
workspace hotkey banderson Red Hat 2 10-21-2003 10:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration