VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Author Topic: Need Help adding desktop icon  (Read 1677 times)

Uta

  • Member
  • *
  • Posts: 20
Need Help adding desktop icon
« on: April 04, 2008, 09:26:54 am »

I am trying to add a desktop icon that when clicked will shutdown the laptop.
I am doing this to make it very easy for the person I am giving my laptop to, (elderly, limited mouse skills) to shutdown.
A howto would be great.
I am using 5.9 "LITE" (jwm)
I'd like to use the: /usr/share/icons/menu-Exit.png

Thanks.

Logged

M0E-lnx

  • Administrator
  • Vectorian
  • *****
  • Posts: 3256
Re: Need Help adding desktop icon
« Reply #1 on: April 04, 2008, 11:43:07 am »

Easy way to do this would be to create a shutdown script
Code: [Select]
mcedit ~/.shutdown.sh
[code]
In the file, add these simple lines
[code]
#!/bin/bash
sudo /sbin/shutdown -t3 -h now
exit 0
[code]

If you are running PCMANFM with icons on the desktop here is what you do
open a terminal, cd to the ~/Desktop directory
make a copy of one of the .desktop files in it and name it "shutdown.desktop"
[code]
cp home.desktop shutdown.desktop
[code]
edit the file and change these lines
[code]
mcedit shutdown.desktop
Exec=sh ~/.shutdown.sh # This is the script you created previously
Name=Shutdown
Icon=/usr/share/icons/menu-Exit.png
Leave the rest of the file alone

That should give you your desktop icon...


This could be annoying though... if they mistakenly click the wrong icon, then you'd have them asking you to "fix" it all the time..[/code][/code][/code][/code][/code][/code]

Uta

  • Member
  • *
  • Posts: 20
Re: Need Help adding desktop icon
« Reply #2 on: April 04, 2008, 03:01:36 pm »

First thank you for responding.
I think something is amiss in my desktop file. I had already deleted my home.desktop so had to work with an opera.desktop to create my shutdown.desktop file. It reads:

[Desktop Entry]
Encoding=UTF-8
Exec=sh ~/.shutdown.sh
Name=Shutdown
GenericName=shutdown
Icon=/usr/share/icons/menu-Exit.png
Terminal=false
Categories=GTK;System;Settings;
Type=Application
NotShowIn=KDE
--------------------------
double clicking does nothing.
--------------------------
my .shutdown.sh file is in my user's directory and reads:

#!/bin/bash
sudo /sbin/shutdown -t3 -h now
exit 0
---------------------------

Is my shutdown.desktop info wrong?
Logged

M0E-lnx

  • Administrator
  • Vectorian
  • *****
  • Posts: 3256
Re: Need Help adding desktop icon
« Reply #3 on: April 04, 2008, 03:05:28 pm »

seems to be fine... try this in the exec line instead
Code: [Select]
Exec=sudo /sbin/shutdown -t3 -h now
[code]
That will bypass the script and see if that works
[/code]

Uta

  • Member
  • *
  • Posts: 20
Re: Need Help adding desktop icon
« Reply #4 on: April 04, 2008, 03:12:03 pm »

<smiling>
It worked!
Thank you for your knowledge and patience--
Logged