Frank Golden Posted June 22, 2006 Share Posted June 22, 2006 (edited) Hi All,Anyone know how to create a desktop shortcut (icon) to shutdown computer.I know about using 'sudo halt' in a launcher but it causes filebrowser to open and display on restart. I just want a desktop icon I can click that will just close Ubuntunormally and shut down machine like using the multi-choice icon in the panel but without the choice window.There has got to be a commmand with appropriate switches that the machine uses when I click the Quitbutton in the panel applet (the one that has restart,hibernate,change users etc). If I knew what that was I could make a launcher that would duplicate the Quit behavior. When I create a launcher usingsudo halt or sudo /sbin/shutdown h- now or anything like this and click on it the machine goes to black screenwith Ubuntu version info and a password prompt. If I wait about 10 seconds the second half of the GUI versionof the shutdown screen appears and computer shuts down. When I restart the last thing that happensis File Browser opens in /home/frankgolden.I have sudo setup to not use password if that makes a difference. (I know it's not secure, but I am only userand behind a NAT router firewall)BTW, switched back to password required now commands cause terminal and gedit to open as well as FileBrowser???? Edited June 22, 2006 by Frank Golden Quote Link to comment Share on other sites More sharing options...
teacher Posted June 22, 2006 Share Posted June 22, 2006 Take a look here: http://forums.scotsnewsletter.com/index.ph...14&t=503&st=236I believe that should do the trick for you. Quote Link to comment Share on other sites More sharing options...
Urmas Posted June 22, 2006 Share Posted June 22, 2006 Or...http://www.ubuntuforums.org/showthread.php...hlight=shutdown(#23)... not very stylish approach, but... Quote Link to comment Share on other sites More sharing options...
Bruno Posted June 22, 2006 Share Posted June 22, 2006 Good Plan Frank !! . . . This is the first thing I do after every distro install: make my "special" Reboot and Shutdown buttons . . . . . . I could not live without them :hysterical: Bruno Quote Link to comment Share on other sites More sharing options...
_Ralph_ Posted June 22, 2006 Share Posted June 22, 2006 Good Plan Frank !! . . . This is the first thing I do after every distro install: make my "special" Reboot and Shutdown buttons . . . . . . I could not live without them :thumbsup: BrunoFor a quick restart or shutdown look at : http://jthz.com/puter/ Shutz .exe Quote Link to comment Share on other sites More sharing options...
striker Posted June 22, 2006 Share Posted June 22, 2006 _Ralph_, we're talking linux here, you posted a link to windows applications. Quote Link to comment Share on other sites More sharing options...
teacher Posted June 22, 2006 Share Posted June 22, 2006 Me thinks he wandered in by mistake and does not know what Linux is! Ralph, stay for a while, and we will show you ways to make your computer work that you have not seen before. Quote Link to comment Share on other sites More sharing options...
Frank Golden Posted June 23, 2006 Author Share Posted June 23, 2006 Take a look here: http://forums.scotsnewsletter.com/index.ph...14&t=503&st=236I believe that should do the trick for you. No good when restart FileBrowser and gedit launch. Quote Link to comment Share on other sites More sharing options...
Bruno Posted June 23, 2006 Share Posted June 23, 2006 Hi FrankHere is what you do . . . close all apps . . . then log out ( once ) the usual ( old ) way and log back in . . . now the FileBrowser and gedit should not start. ( you start with an "empty session" ) . . . . After that you can use the shutdown and reboot buttons. Bruno Quote Link to comment Share on other sites More sharing options...
Frank Golden Posted June 23, 2006 Author Share Posted June 23, 2006 (edited) Hi FrankHere is what you do . . . close all apps . . . then log out ( once ) the usual ( old ) way and log back in . . . now the FileBrowser and gedit should not start. ( you start with an "empty session" ) . . . . After that you can use the shutdown and reboot buttons. BrunoThat did the trick!!! Creating a launcher must involve filebrowser and gedit running in background. So if I use launcher without shutting down the "normal" way. The command to save/remember settingsdutifully restarts those apps on system startup?? Am I correct that the shortcut I created doesn't do the exact same thing as choosing Quit from the Log off,switch user...button in panel. For instance when I use the "normal" method in Ubuntu 6.06 LTS a verbose shutdown GUI displays in two parts at end of second screenthe computer powers down. Using the shortcut I created the first screen is a black screen with white lettersthat says "Ubuntu 6.06 LTS tty1frankgolden-laptop login:_"after a few seconds ~10 the second "normal" GUI screen appears and the computer shutsdown. I also don't have to listen to the Ubuntu shutdown sound. Edited June 23, 2006 by Frank Golden Quote Link to comment Share on other sites More sharing options...
Frank Golden Posted June 23, 2006 Author Share Posted June 23, 2006 (edited) That did the trick!!! Creating a launcher must involve filebrowser and gedit running in background. So if I use launcher without shutting down the "normal" way. The command to save/remember settingsdutifully restarts those apps on system startup?? Am I correct that the shortcut I created doesn't do the exact same thing as choosing Quit from the Log off,switch user...button in panel. For instance when I use the "normal" method in Ubuntu 6.06 LTS a verbose shutdown GUI displays in two parts at end of second screenthe computer powers down. Using the shortcut I created the first screen is a black screen with white lettersthat says "Ubuntu 6.06 LTS tty1frankgolden-laptop login:_"after a few seconds ~10 the second "normal" GUI screen appears and the computer shutsdown. I also don't have to listen to the Ubuntu shutdown sound.Premature with the celebration. Sometimes it works sometimes it doesn't.I doesn't make any sense. It's hit or miss as to whether file browser starts or not using my shortcut.There has got to be something special about the "normal" shutdown method. Or else it's black magic,voodoo or just the sick sense of humor of the developers. I just give up. :wacko:Thanks Everyone Edited June 23, 2006 by Frank Golden Quote Link to comment Share on other sites More sharing options...
Urmas Posted June 23, 2006 Share Posted June 23, 2006 :'( ... have you seen this? It's "Hoary old", but...http://www.ubuntuforums.org/showthread.php...wn+desktop+icon Quote Link to comment Share on other sites More sharing options...
Frank Golden Posted June 23, 2006 Author Share Posted June 23, 2006 (edited) :'( ... have you seen this? It's "Hoary old", but...http://www.ubuntuforums.org/showthread.php...wn+desktop+icon Nope, all that command "gnome-session-save --kill" does is bring up the menu you get if you click thepanel icon (log out, lock screen, switch users, hibernate, restart, shutdown). I think what is needed is a shortcut to scriptthat runs this command first then automatically picks the shutdown option. The panel button or the createdlauncher appears to only work properly if you have "system>preferences>settings> Ask on logout and Automatically save changes to sessions boxes checked. If you have neither box checked and click the shortcut or panel button you are logged off to GUI login screen where you can either login again or choose from a dropdown on left bottom to restart, shutdown etc. I you have only "ask on logout" checked and shutdownis chosen from menu options next restart causes file browser and sessions dialog box to display. If only"Automatically save changes to sessions" is checked the computer logs off and brings up the GUI log in screen like above.There has to be a simple solution to this. There is in my mind no real reason that shutting down a computerneeds to be so interactive. In the XP side of my machine a simple desktop shortcut does the trick.Although I realize that Windows has a large registry to remember settings etc. thee should be some way to automate this simple function and it should be an option in Ubuntu. Edited June 23, 2006 by Frank Golden Quote Link to comment Share on other sites More sharing options...
Bruno Posted June 23, 2006 Share Posted June 23, 2006 Hi FrankIf you use Kubuntu a Gnome-related command like "gnome-session-save --kill" will not do the trick ( because you use KDE )Anyway I checked my 6.06 Kubuntu install . . . and this is what I have:The properties of the 2 buttons ( I have them on the taskbar near the clock ): Button title: StopDescriptionExecutable: sudo /sbin/shutdown -h nowCommandline arguments:Run in a terminal ( NOT ticked ) Button title: RebootDescriptionExecutable: sudo /sbin/rebootCommandline arguments:Run in a terminal ( NOT ticked )And most important . . . "$ sudo cat /etc/sudoers" on the last line shows:bruno ALL=(ALL) NOPASSWD: /sbin/shutdown -h now, /sbin/rebootNow when I hit the button . . . . it reboots or stops the system . . . . when I log back in my screeen starts with the KDE desktop.If your problem keeps coming back you could do:Personal __> Kde components --> Session manager = Start with empty session.I did not have to do this myself because I do not have the same problem. Bruno Quote Link to comment Share on other sites More sharing options...
Frank Golden Posted June 23, 2006 Author Share Posted June 23, 2006 (edited) Hi FrankIf you use Kubuntu a Gnome-related command like "gnome-session-save --kill" will not do the trick ( because you use KDE )Anyway I checked my 6.06 Kubuntu install . . . and this is what I have:The properties of the 2 buttons ( I have them on the taskbar near the clock ):And most important . . . "$ sudo cat /etc/sudoers" on the last line shows:Now when I hit the button . . . . it reboots or stops the system . . . . when I log back in my screeen starts with the KDE desktop.If your problem keeps coming back you could do:Personal __> Kde components --> Session manager = Start with empty session.I did not have to do this myself because I do not have the same problem. BrunoI don't have Kubuntu. I am using Ubuntu with the gnome desktop. Do not have any start with empty session in gnome and no I don't want to switch to Kubuntu. Can you help me create a script that will, when activated open my Quit menu and choose the shutdown option from there automatically. I can then create a launcher for the script. I have tried all you guys have told me with no success. Apparently gnome handles this seeminglysimple task differently than KDE, though why it does completely defies logic. In my limited experience with Linux there seems to be a lot of that going around Edited June 23, 2006 by Frank Golden Quote Link to comment Share on other sites More sharing options...
Bruno Posted June 23, 2006 Share Posted June 23, 2006 Sorry Frank . . . I really thought you used KDE . . . . . . . . . my bad !Sure I will help you with the script . . but I will have to know what commands should be in the script. ( I not a Gnome-guy )As far as I can see the following script should do the trick: #!/bin/bashsudo /sbin/shutdown -h now#End scriptor#!/bin/bashgnome-session-savesudo /sbin/shutdown -h now#End scriptcall it "stop" make it executable with "chmod 755 stop" and add the line ( see above ) to the /etc/sudoers file using "visudo"Next make a shortcut on your desktop pointing at /home/frank/stopB) Bruno Quote Link to comment Share on other sites More sharing options...
Urmas Posted June 23, 2006 Share Posted June 23, 2006 (edited) If you want to change the behaviour of "Exit button" to the way it was in Breezy:System Tools -> gconf-editor / > apps > gnome-power-manager > action_power_buttonThe action to take when the system power button is pressed. Valid values are "suspend", "hibernate", "interactive", "shutdown" and "nothing".The Dapper default is "interactive". Change it to "shutdown".I know, I know... still not what you were looking for... (See (in Terminal): man shutdown) Edited June 23, 2006 by Urmas Quote Link to comment Share on other sites More sharing options...
Frank Golden Posted June 23, 2006 Author Share Posted June 23, 2006 (edited) Sorry Frank . . . I really thought you used KDE . . . . . . . . . my bad !Sure I will help you with the script . . but I will have to know what commands should be in the script. ( I not a Gnome-guy )As far as I can see the following script should do the trick:orcall it "stop" make it executable with "chmod 755 stop" and add the line ( see above ) to the /etc/sudoers file using "visudo"Next make a shortcut on your desktop pointing at /home/frank/stopB) BrunoWell the second script seemed to work though I had to log off and on the normal way to reset my machinelike we did earlier. When I click shortcut a dialog box appears for a second or so that says my gnome session has been saved. It has an OK button but don't stay around long enough for me to click it. The black screen with"Ubuntu 6.06 LTS tty1frankgolden-laptop login:_in white letters appears for a few seconds, then a flash of a screen appears for 100ms maybe with a lot of white characters and finally the final Ubuntu GUI shutdown screen. At this point the computer powers down. This will work as a work around but there is a big difference between the shut down behavior of this scriptand the normal interactive one. I wish I knew what the exact command clicking on the shutdownbutton in the interactive menu was/does. BTW, When you click on the panel button the screen dims while you make your choice.? If that helps.The action to take when the system power button is pressed. Valid values are "suspend", "hibernate", "interactive", "shutdown" and "nothing".The Dapper default is "interactive". Change it to "shutdown".I know, I know... still not what you were looking for...Urmas all this does is change the hardware button and the result is the same file browser starts at bootup. Edited June 23, 2006 by Frank Golden Quote Link to comment Share on other sites More sharing options...
Bruno Posted June 23, 2006 Share Posted June 23, 2006 The black screen with"Ubuntu 6.06 LTS tty1frankgolden-laptop login:_in white letters appears for a few seconds, then a flash of a screen appears for 100ms maybe with a lot of white characters and finally the final Ubuntu GUI shutdown screen. At this point the computer powers down.Hi Frank . . . this is exactly the same I get when shutting down IF I boot my Kubuntu with the "splash=verbose" boot option . . . . . ( If however I use the "splash=silent" I do not see this behavior because the splash hides it )The "splash=verbose" makes that during boot I see ALL the bootmessages ( what I like to see ) and it is the setting I usually use . . . . . and in that case when I shutdown from the terminal ( I often do ) or with the button I created I do get the black screen with login for a second before it really powers down.So there is nothing to worry about and it is "normal" behavior. . . . . As long as you can power down we will have to use this workaround :DB) Bruno Quote Link to comment Share on other sites More sharing options...
Frank Golden Posted June 23, 2006 Author Share Posted June 23, 2006 (edited) Hi Frank . . . this is exactly the same I get when shutting down IF I boot my Kubuntu with the "splash=verbose" boot option . . . . . ( If however I use the "splash=silent" I do not see this behavior because the splash hides it )The "splash=verbose" makes that during boot I see ALL the bootmessages ( what I like to see ) and it is the setting I usually use . . . . . and in that case when I shutdown from the terminal ( I often do ) or with the button I created I do get the black screen with login for a second before it really powers down.So there is nothing to worry about and it is "normal" behavior. . . . . As long as you can power down we will have to use this workaround :DB) BrunoI got ya. The workaround while not as elegant seems to work and saves mouse clicks. Will play around with scripts trying to fine tune (read:break my Ubuntu install) my Ubuntu shutdown behavior. That's the reason I have a partimage copy of my stable install for. Right. Hey Guys and Ladies thanks for the help with this . Edited June 23, 2006 by Frank Golden Quote Link to comment Share on other sites More sharing options...
Urmas Posted June 23, 2006 Share Posted June 23, 2006 https://launchpad.net/distros/ubuntu/+sourc...ager/+bug/49214 Quote Link to comment Share on other sites More sharing options...
Frank Golden Posted June 23, 2006 Author Share Posted June 23, 2006 https://launchpad.net/distros/ubuntu/+sourc...ager/+bug/49214Apparently this problem is part of a bug. Quote Link to comment Share on other sites More sharing options...
striker Posted June 23, 2006 Share Posted June 23, 2006 Me thinks he wandered in by mistake and does not know what Linux is! Ralph, stay for a while, and we will show you ways to make your computer work that you have not seen before. Yep ! Quote Link to comment Share on other sites More sharing options...
Frank Golden Posted June 23, 2006 Author Share Posted June 23, 2006 (edited) Yep ! Or ways to break it you ain't seen before either. Edited June 23, 2006 by Frank Golden Quote Link to comment Share on other sites More sharing options...
striker Posted June 23, 2006 Share Posted June 23, 2006 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.