WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Script with a wbar icon question.  (Read 2185 times)

Offline Phillip Nordwall

  • Newbie
  • *
  • Posts: 1
Script with a wbar icon question.
« on: September 25, 2011, 01:22:33 AM »
I'm trying to get a script I wrote to have an icon that launches it on the wbar. I've scaled it back to a simpler one that prompts for and IP address am still having problems.

I can run the script from a terminal and get prompted with no problem. I also get an Icon on the wbar, and an entry in the application menu but it doesn't do anything when I click either of them.

I have a tcz "wwu_send_sda.tcz" with the following structure that loads fine
/usr
/usr/bin
/usr/bin/wwu_send_sda
/usr/local
/usr/local/share
/usr/local/share/applications
/usr/local/share/applications/wwu_send_sda.desktop
/usr/local/share/pixmaps
/usr/local/share/pixmaps/wwu_send_sda.png

/usr/local/share/applications/wwu_send_sda.desktop contains the following
[Desktop Entry]
Type=Application
Name=wwu_send_sda
Exec=wwu_send_sda
Icon=wwu_send_sda
X-FullPathIcon=/usr/local/share/pixmaps/wwu_send_sda.png
Categories=Utility


/usr/bin/wwu_send_sda has permissions rwxr-xr-x and contains the following
#!/bin/sh
read -p "Enter the destination ip" destip
sudo swapoff -a
sudo dd if=/dev/sda bs=8225280 count=25999 | nc -w 30 $destip 2600


Any pointers on what I am doing wrong would be greatly appreciated.

Phillip Nordwall

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10992
Re: Script with a wbar icon question.
« Reply #1 on: September 25, 2011, 02:50:39 AM »
It's a CLI script, and you're launching it in the gui - it does start, but you can't see it.

Try "Exec=cliorx wwu_send_sda", cliorx is our wrapper for these cases.
The only barriers that can stop you are the ones you create yourself.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Script with a wbar icon question.
« Reply #2 on: November 06, 2011, 04:51:43 PM »
A great read thanks, as this addressed a similar issue I was having.

In my case the menu icon had to open a script located in the home directory which in turn opened a browser with a web page which could not be set using a browser home page options.  Using  home page option on a remastered ISO results in a browser's first use screen instead of the desired web page.

I found the cliorx command very helpful in ensuring the program was executed, unfortunately the wrapper opened two windows, always one blank terminal window and another window with the program regardless of whether the final program was one with a gui or a command line script.

In the end I settled for a /usr/local/share/applications/program Desktop Entry like
"Exec=./myscript"  or
"Exec=/home/tc/myscript"

myscript was made executable with chmod a+x myscript.sh

then of course within myscript a simple command to open a web page directly on opening

/usr/local/bin/browser http://apod.nasa.gov/apod/astropix.html  (or whatever)

I found other commands to work also like tc-run


Not sure why cliorx doesn't open the app in one window but the above works for me and will use this unless someone can show me a better way.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10992
Re: Script with a wbar icon question.
« Reply #3 on: November 07, 2011, 09:24:00 AM »
I assume your script was still running, this is why the terminal window still existed too. If the browser was the last thing to launch, using exec would have ended the script.
The only barriers that can stop you are the ones you create yourself.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Script with a wbar icon question.
« Reply #4 on: November 08, 2011, 12:22:10 AM »
Thanks for the heads up.   I'll have to examine the procedure.  I did notice WiFi using the wrapper cliorx without issue, makes me think all my attempts were not complete in some way.