Desktop 'shortcuts'
-
- Posts: 6
- Joined: Tue Apr 10, 2012 4:07 pm
Desktop 'shortcuts'
Is there a way to make a Windows style desktop shortcut to run a shell script?
I made script to start the VPN, connect to a remote desktop and shut down VPN when finished. It works
great via command line. But it would be nice to just click an icon.
I am new to Linux so I don't know a whole lot.
Linux Mint 12 LXDE
I made script to start the VPN, connect to a remote desktop and shut down VPN when finished. It works
great via command line. But it would be nice to just click an icon.
I am new to Linux so I don't know a whole lot.
Linux Mint 12 LXDE
-
- Posts: 72
- Joined: Wed Dec 15, 2010 9:37 pm
- Location: Victoria, BC, Canada
Re: Desktop 'shortcuts'
You can create a desktop icon, which is actually a text file. I've done that for a few icon short-cuts on my Lubuntu desktop.bjackson60 wrote:Is there a way to make a Windows style desktop shortcut to run a shell script?
I made script to start the VPN, connect to a remote desktop and shut down VPN when finished. It works
great via command line. But it would be nice to just click an icon.
I am new to Linux so I don't know a whole lot.
Linux Mint 12 LXDE
Here's an example of the one I have that shows up as "Trash", the name of the file is app_trash.desktop so I can have a Trash desktop icon:
Code: Select all
[Desktop Entry]
Encoding=UTF-8
Name=Trash
Comment=Open Trash folder in PCManFM
Icon=/home/username/.extra-icons/trashcan-128x128(c).png
Exec=/usr/bin/pcmanfm trash:///
Terminal=false
Type=Application
The key line is "Exec=/path/command". You have to do things a wee bit differently if it's a shell or bash file you want to execute. This is an example from another desktop Icon I have for running Nix Note; the free Evernote clone:
Code: Select all
[Desktop Entry]
Encoding=UTF-8
Name=Nix
Comment=RunNixNote
Icon=/home/username/.extra-icons/Nevernote-164x308.png
Exec=sh /usr/share/nixnote/nixnote.sh
Terminal=false
Type=Application
Note how you run the shell with "Exec=sh /path/shellname.sh"
Hope that helps get you started. It works fine for me!
Enjoy!
~*~ M_Mynaardt ~*~
LXDE is your computer's Friend!
Always trust LXDE!
LXDE is your computer's Friend!
Always trust LXDE!
-
- Posts: 6
- Joined: Tue Apr 10, 2012 4:07 pm
Re: Desktop 'shortcuts'
Thanks! I'll play around with this when I get off work.
Edit: Couldn't wait! This works perfectly!!! Thanks M_Mynaardt
Edit: Couldn't wait! This works perfectly!!! Thanks M_Mynaardt
-
- Posts: 72
- Joined: Wed Dec 15, 2010 9:37 pm
- Location: Victoria, BC, Canada
Re: Desktop 'shortcuts'
No problem!bjackson60 wrote:Thanks! I'll play around with this when I get off work.
Edit: Couldn't wait! This works perfectly!!! Thanks M_Mynaardt
Now you've got a template for making whatever LXDE icons your heart desires!
Enjoy!
~*~ M_Mynaardt ~*~
LXDE is your computer's Friend!
Always trust LXDE!
LXDE is your computer's Friend!
Always trust LXDE!
-
- Posts: 6
- Joined: Tue Apr 10, 2012 4:07 pm
Re: Desktop 'shortcuts'
OK, now I have another problem that I don't understand. The shortcut worked like a charm. (Thanks again) But I noticed my script was not disconnecting from the VPN. I edited the script only prepending sudo to the existing line 'vpnc-disconnect'. When I saved the file I noticed the screen refreshed and the icon moved to a new location. The shortcut now does nothing when clicked. The script still works from the command line. Has editing the script file broken something
-
- Posts: 72
- Joined: Wed Dec 15, 2010 9:37 pm
- Location: Victoria, BC, Canada
Re: Desktop 'shortcuts'
I know you can't do much about the order of icons on an LXDE desktop. You're sort of stuck with that. But that ought not affect whether or not they work.bjackson60 wrote:OK, now I have another problem that I don't understand. The shortcut worked like a charm. (Thanks again) But I noticed my script was not disconnecting from the VPN. I edited the script only prepending sudo to the existing line 'vpnc-disconnect'. When I saved the file I noticed the screen refreshed and the icon moved to a new location. The shortcut now does nothing when clicked. The script still works from the command line. Has editing the script file broken something
Does your script file name have any spaces in it? Or the path it's in? Sometimes that's a problem. Try putting the entire shell scrip name, including the path, in quotation marks. That might help a bit.
I'm not an expert on scripts, though. I've limited experience with those. So if the problem is the script itself, I'm not sure how to fix that off the top.
~*~ M_Mynaardt ~*~
LXDE is your computer's Friend!
Always trust LXDE!
LXDE is your computer's Friend!
Always trust LXDE!
-
- Posts: 6
- Joined: Tue Apr 10, 2012 4:07 pm
Re: Desktop 'shortcuts'
It's driving me nuts! The script is working perfectly, but the desktop icon just doesn't. Oh well, I'll just command line it and go learn some more.
-
- Posts: 72
- Joined: Wed Dec 15, 2010 9:37 pm
- Location: Victoria, BC, Canada
Re: Desktop 'shortcuts'
Maybe you might need to do this first:bjackson60 wrote:It's driving me nuts! The script is working perfectly, but the desktop icon just doesn't. Oh well, I'll just command line it and go learn some more.
Go to the directory that Shell file is in.
From the terminal, try one of the two commands:
Code: Select all
~$ chmod +x shell_name.sh
~$ chmod 755 shell_name.sh
What do the contents of your .desktop icon file look like? If it worked once, there might just be an easily overlooked "oopsies" in there. I myself often get tripped up on little things that are easily overlooked.
And anyway, this is what you call learning by "trial and error" - which really means "mostly error"…
The 'being driven nuts' bit sounds very familiar indeed! Been there, done that!
~*~ M_Mynaardt ~*~
LXDE is your computer's Friend!
Always trust LXDE!
LXDE is your computer's Friend!
Always trust LXDE!
-
- Posts: 6
- Joined: Tue Apr 10, 2012 4:07 pm
Re: Desktop 'shortcuts'
I tried the chmod deal already, and checking permissions through the gui reports what I expected.
I did change the exec line to something bogus and it bitches about it when I run it, so it is obviously trying. I'm looking into that a little closer.
I did change the exec line to something bogus and it bitches about it when I run it, so it is obviously trying. I'm looking into that a little closer.