Help with command codes for Dock launchers

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
mintnoob

Help with command codes for Dock launchers

Post by mintnoob »

Trying to find the following command codes for couple of my custom Dock launchers:

- suspend

- synaptic (using "synaptic" works, but needs a code option along with it because it says "Starting without administration privileges.")
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Aging Technogeek

Re: Help with command codes for Dock launchers

Post by Aging Technogeek »

I have not found a launch code for suspend, but this should work for synaptic (it did when I tried it) - "gksu synaptic" then enter your password.
User avatar
euthypro
Level 3
Level 3
Posts: 104
Joined: Wed Jan 17, 2007 12:10 pm
Location: Dumaguete, Philippines

Re: Help with command codes for Dock launchers

Post by euthypro »

If you don't have it already: sudo apt-get install powermanagement-interface

Make your launcher. Command will be: pmi action suspend

Angel

Edit: This works for Mint 9. Just noticed you have Mint 8, so I'm not sure it will work for you.
mintnoob

Re: Help with command codes for Dock launchers

Post by mintnoob »

Aging Technogeek wrote:this should work for synaptic (it did when I tried it) - "gksu synaptic" then enter your password.
Sweet! Someone told me that code before on this forum, but couldn't find where that was. Thanks again!
mintnoob

Re: Help with command codes for Dock launchers

Post by mintnoob »

euthypro wrote:If you don't have it already: sudo apt-get install powermanagement-interface

Make your launcher. Command will be: pmi action suspend
Thanks, that worked! One thing though, after suspending and then opening my laptop lid, it just goes straight to the desktop without any security measures of asking for my password. Is there an extra option code to use to do this, or is it just not an option for this method?
vincent

Re: Help with command codes for Dock launchers

Post by vincent »

Ubuntu/Mint has a suspend command built in, via pm-utils (i.e. you don't actually need this "powermanagement-interface" package). It's:

Code: Select all

sudo pm-suspend
However, this is somewhat inconvenient to use if you want to use this with a Dock or some unprivileged application launchers; you'll need root privileges to run this command, the same with "sudo reboot" or "sudo shutdown -h now", i.e. you can't actually suspend, hibernate, reboot, or shutdown your computer without root privileges. The only reason why you don't need to enter in your password when shutting down via your graphical user interface is because your X server requires root privileges to operate, and it's been like that for 20-something years already (it's also one of the key reasons why it's generally not advisable to run X on something like a server).
mintnoob

Re: Help with command codes for Dock launchers

Post by mintnoob »

vincent wrote:Ubuntu/Mint has a suspend command built in, via pm-utils (i.e. you don't actually need this "powermanagement-interface" package). It's:

Code: Select all

sudo pm-suspend
So that only works in the terminal?
User avatar
euthypro
Level 3
Level 3
Posts: 104
Joined: Wed Jan 17, 2007 12:10 pm
Location: Dumaguete, Philippines

Re: Help with command codes for Dock launchers

Post by euthypro »

@mintnoob,

Can't tell you whether it can be made to ask for a password. I was just playing with AWN to see what can be done with it. Tried the "sudo pm-suspend" command, with no joy.

I have never been asked for a password on "resume" whether I suspend from terminal, the GUI, or by closing the lid. Always went straight to the desktop.Never occurred to me to ask since I don't need that kind of security on my laptop. Maybe someone else knows better than I do.

Don't know what dock you are using, but AWN has it's own applet that brings up the GUi for "logout" or "lock screen" or "shutdown" with options to suspend, restart or hibernate.

Angel
vincent

Re: Help with command codes for Dock launchers

Post by vincent »

You don't have to use the terminal to run pm-suspend, you can run it from Gnome's Run Application window (ALT + F2), or whatever the KDE equivalent is, and by entering:

Code: Select all

gksudo pm-suspend
(Of course, replace "gksudo" with "kdesudo" if you're running KDE. Similarly, when calling Synaptic with root privileges, you should probably be using "kdesudo synaptic" instead of "gksudo synaptic" on a KDE desktop.)
Gksudo/kdesudo will (should) popup with a dialog asking for your password, similar to what you would find if you opened, say, Synaptic, with root privileges. Same concept. ;)

As for getting a password prompt at resume, that's a setting that can be easily tweaked. I don't know about KDE, but on Gnome, all you have to do is run "gconf-editor" from a terminal, search for the key "/apps/gnome-power-manager/lock/suspend", and change it to a value of "False".
User avatar
euthypro
Level 3
Level 3
Posts: 104
Joined: Wed Jan 17, 2007 12:10 pm
Location: Dumaguete, Philippines

Re: Help with command codes for Dock launchers

Post by euthypro »

Tried "gksudo pm-suspend" with a dock launcher. It works and does not ask for a password. I've just installed Ubuntu Tweaks for something else, and I see that it also has an option to lock the screen on suspend. Thanks, Vincent. Maybe mintnoob can do it your way and remove the extra package. I was just trying different things out of curiosity. When I want to suspend i just close the lid.

Angel
mintnoob

Re: Help with command codes for Dock launchers

Post by mintnoob »

vincent wrote:

Code: Select all

gksudo pm-suspend
(Of course, replace "gksudo" with "kdesudo" if you're running KDE.
That actually did the opposite, requested a password to suspend and not at resume! :lol:

I didn't do your suggested tweak yet. My suspend request for the launchers is not that important to me. Just setting up some bling with the dock and cool icon set I got going and they had an on/off icon, so I figured what the hell!
vincent

Re: Help with command codes for Dock launchers

Post by vincent »

euthypro wrote:Tried "gksudo pm-suspend" with a dock launcher. It works and does not ask for a password.
mintnoob wrote:That actually did the opposite, requested a password to suspend and not at resume!
I'm a bit confused now. :? It should actually ask for a password, since you need root privs to suspend.
User avatar
euthypro
Level 3
Level 3
Posts: 104
Joined: Wed Jan 17, 2007 12:10 pm
Location: Dumaguete, Philippines

Re: Help with command codes for Dock launchers

Post by euthypro »

I had tried "sudo pm-supend" and it asked for a password and did not work from the launcher. I expected "gksudo" to ask, so yesterday I made sure I had nothing else with root privileges open, waited, and tried it a a few times, logged out and back in and tried again. No password. I just tried it today, and it is asking, so I guess my sudo privilege was kept for all that time. Don't know why? My bad. :oops:
vincent

Re: Help with command codes for Dock launchers

Post by vincent »

You would have to wait for 15 minutes after the last root-privileged program you started, for you to get another password prompt the next time you open another program that requires root privileges to function. Logging out and logging back in does not change this (rebooting/shutting down will, however). The 15-minute value can be changed though, if you think that's too short or too long.
Locked

Return to “Beginner Questions”