I'm trying to create a keyboard shortcut but it doesn't work.
/usr/sbin/pm-suspend
returns "This utility may only be run by the root user." !!!
The built-in Suspend in Keyboard Shortcuts doesn't work either.
pmi action suspend
returns"The program 'pmi' is currently not installed. You can install it by typing:
sudo apt-get install powermanagement-interface"
Pressing Ctrl+Alt+Delete brings up the Shutdown Dialog but it doesn't have focus or is behind the current window
Some fixing is needed here....
Last edited by Rebelli0us; November 7th, 2009 at 06:21 PM.
Well, do
Then you can useCode:sudo apt-get install pmi
As far as being able to bind that to a keyboard shortcut ... I believe it's expected that your keyboard shortcut couldn't auto suspend because it requires root access. The workaround would be to bind it to "gksu pmi action suspend" possibly, but you'll still have to type your root password.Code:sudo pmi action suspend
I'm not sure how, but I'm guessing the right course of action would be to figure out how the "suspend" button works in gnome-gui ... maybe tie into that somehow and invoke the command that it invokes...?
~Fermmy
In Karmic:
Then run:Code:sudo apt-get install powermanagement-interface
And add this line, using your own username:Code:sudo visudo
Save (Ctrl + X).Code:yourusername ALL=NOPASSWD: /usr/sbin/pmi
Now you should not have to enter a password for this command.
Guides: Jamming and Music production launcher | PPA enabling system-wide JACK support | On the-fly Multiseat
Interested in: MPX for Ubuntu | Ubuntu Cluster
The "Suspend" command in Keyboard Shortcuts doesn't work. Why?
Also, why should a user have to type a password to suspend computer? That's bizarre.. machine is set to auto-suspend anyway..
** SOLUTION NOT REQUIRING ROOT/SUDO **
Introducing... gnome-power-control
No sudo, no root, no fuss!
I found the solutions in this thread and elsewhere inadequate, because they just bypassed the problem by using sudo. I have solved this problem by writing a simple script.
THE SCRIPT
SETUPCode:#!/bin/bash # # gnome-power-control # Author: AgenT case $1 in suspend) echo Suspending dbus-send --print-reply \ --system \ --dest=org.freedesktop.DeviceKit.Power \ /org/freedesktop/DeviceKit/Power \ org.freedesktop.DeviceKit.Power.Suspend ;; hibernate) echo Hibernating dbus-send --print-reply \ --system \ --dest=org.freedesktop.DeviceKit.Power \ /org/freedesktop/DeviceKit/Power \ org.freedesktop.DeviceKit.Power.Hibernate ;; *) echo Not supported command: '"'$1'"' echo Usage: $0 '<suspend|hibernate>' exit 1 ;; esac
1) Save the above as: gnome-power-control
2) Change file permissions to execute (right click on file -> properties -> permissions)
3) optional: move this script into your ~/bin/ folder for easy access!
USAGE
To suspend: gnome-power-control suspend
To hibernate: gnome-power-control suspend
BINDINGS
Once in your ~/bin/ folder, you can bind other programs to use this! For example, create a Compiz shortcut to execute gnome-power-control suspend, or create a launcher on your toolbar to do the same thing!
DOES NOT WORK?
If this does not work for you, you either don't have DeviceKit (in Ubuntu 9.10) or if you do, then your suspend/hibernate is not working correctly.
STOP!
Before you sign up to Dropbox, click here to read my post showing you how to get an additional 500mb free! That's 2.5GB of free space!
Thank you.
Is there a straightforward way to directly create a new file in /bin folder? .. like in windows right click > new.
So I created new file as you described, in Desktop, then tried to drag it to /bin folder... "access denied", it's sickening.... I thought it was MY computer.
So, how do I invoke command "gnome-power-control suspend" and assign it to a Keyboard shortcut?
Not into /bin/ but into ~/bin/ which is short for /home/YOUR_USERNAME/bin/
~ is short for your home directory.
And it's not sickening that you cannot add into /bin on Linux. It's one of the reasons why there are no viruses, etc. in Linux, but there are a TON on windows. It's called common sense security. Yes it's your computer, and yes, if you want to, you can add a file into /bin but only as root user. Again, common security, which Windows has always lacked.
If you want more information, I suggest reading up on the linux permission system.
STOP!
Before you sign up to Dropbox, click here to read my post showing you how to get an additional 500mb free! That's 2.5GB of free space!
Thanks again, I meant sickening in the sense that somebody with my experience cannot do simple things in Linux, even with your kind help. And "access denied" offers no help.
So I'm browsing, there is no BIN dir in /home/YOUR_USERNAME/ ??
I did a search, there's a dozen BIN dirs, I thought BIN is like windows\system32
I also tried executing "gnome-power-control" from where it is (desktop) but nothing happens. I did the "permissions" "allow execute". I just assume this is like a batch file, and once it works I can assign it a keyboard shortcut??
Help! Why is something simple so hard????
Just make one. Although it`s not there by default, it`s in your path by default, even if it`s not there.
Or it always used to be, using Hardy so things might have changed.
Edit -
Rereading that, it doesn`t sound very clear unless you understand paths. If a directory is in your path then you can execute any binary in that directory typing the name of the program.
To see what I mean, try typingOne of the first programs you`ll see is the very commonly used apt-get. I`m guessing you typeCode:ls /usr/bin/all the time.Code:sudo apt-get install blah blah blah
If /usr/bin was not in your path you would have to typebecause bash would not search /usr/bin to find it.Code:sudo /usr/bin/apt-get install blah blah blah
Other distros include ~/bin as a default directory, Ubuntu does not, but it does include ~/bin in your default path. So you can create ~/bin and bash will search it
To see which directories are in your path typeEdit 2 -Code:echo $PATH
I`m not sure that made it clearer, anyway, research your path if your interested
Last edited by nothingspecial; November 15th, 2009 at 07:31 PM.
Bookmarks