! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
A way to launch suspend or hibernate from terminal would be nice
Status:
RESOLVED: WONTFIX
Severity:
enhancement
Product:
Xfce4-power-manager
Component:
General

Comments

Description Jarno Suni 2009-10-10 14:36:34 CEST
Gnome power manager includes command gnome-power-cmd by which you can suspend/hibernate from command line as normal user. By that you can shutdown and reboot, too. I couldn't find anything like that for xfce4-power-manager. 

The commands for suspend and hibernate should not lock screen by default, or there should be different commands for both behaviors. "xflock4 ; xfce4-power-cmd suspend" or such could be used to have screen locked anyway. (By the way, the menu of xfce4-power-manager's tray icon could have separate items for locked and unlocked suspend and hibernate, too.)

You could use such commands to e.g. hibernate after finishing some task automatically.
Comment 1 Ali Abdallah editbugs 2009-10-11 14:30:00 CEST
(In reply to comment #0)
> Gnome power manager includes command gnome-power-cmd by which you can
> suspend/hibernate from command line as normal user. By that you can shutdown
> and reboot, too. I couldn't find anything like that for xfce4-power-manager. 
> 
> The commands for suspend and hibernate should not lock screen by default, or
> there should be different commands for both behaviors. "xflock4 ;
> xfce4-power-cmd suspend" or such could be used to have screen locked anyway.
> (By the way, the menu of xfce4-power-manager's tray icon could have separate
> items for locked and unlocked suspend and hibernate, too.)
> 
> You could use such commands to e.g. hibernate after finishing some task
> automatically.

But this already exists in some sence, you can use.

dbus-send --session --print-reply --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Suspend

And you replaced Suspend with Hibernate, Shutdown etc...

This will work for all the power managers including gpm, kpowesave, xfpm, i don't think having a wrapper to these method called xfce4-power-manager-cmd is a good idea, since whatever you write to use this command will not work for gpm and vice versa, but the dbus command will work for all the people.
Comment 2 Jarno Suni 2009-10-11 14:59:33 CEST
(In reply to comment #1)
 
> dbus-send --session --print-reply --dest=org.freedesktop.PowerManagement
> /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Suspend
> 
> And you replaced Suspend with Hibernate, Shutdown etc...
> 
> This will work for all the power managers including gpm, kpowesave, xfpm, i
> don't think having a wrapper to these method called xfce4-power-manager-cmd is
> a good idea, since whatever you write to use this command will not work for gpm
> and vice versa, but the dbus command will work for all the people.

Can that command save Xfce session for future logins, if you Shutdown?

There is not way to choose in the command whether you want to lock screen for suspend and hibernate.

Do you mean an xfce4-power-cmd that would be a shell script including the dbud-send command would not work?

dbus-send --session --print-reply --dest=org.freedesktop.PowerManagement
/org/freedesktop/PowerManagement org.freedesktop.PowerManagement."$1"

The syntax of such a script would be simpler than the dbus-send command's syntax.
Comment 3 Jarno Suni 2009-10-11 15:10:44 CEST
(In reply to comment #2)
 
> Do you mean an xfce4-power-cmd that would be a shell script including the
> dbud-send command would not work?

It does work: gnome-power-cmd is that kind of shell script, but it is included in gnome-power-manager package.
Comment 4 Jarno Suni 2009-10-11 21:05:36 CEST
(In reply to comment #3)

> It does work: gnome-power-cmd is that kind of shell script, but it is included
> in gnome-power-manager package.

It is included in gnome-power-manager package version 2.24.2-2ubuntu8, but it is not in 2.28.0-0ubuntu3.
Comment 5 Ali Abdallah editbugs 2009-10-12 07:47:45 CEST
(In reply to comment #4)
> (In reply to comment #3)
> 
> > It does work: gnome-power-cmd is that kind of shell script, but it is included
> > in gnome-power-manager package.
> 
> It is included in gnome-power-manager package version 2.24.2-2ubuntu8, but it
> is not in 2.28.0-0ubuntu3.

Yes because now it is easy to invoke all standard methods with dbus-send.
Comment 6 Jarno Suni 2009-10-12 14:58:51 CEST
(In reply to comment #5)
> Yes because now it is easy to invoke all standard methods with dbus-send.

gnome-power-cmd uses dbus-send in gnome-power-manager 2.24.2-2ubuntu8, but maybe they removed it from the later version of the package because it was not gnome-power-manager specific.

Anyway, if you want to control whether e.g. suspend locks screen from command line, you have to disable screen locking in power manager preferences, and decide whether you run xflock4 before the respective dbus-send command.
Comment 7 Jarno Suni 2009-10-12 15:18:05 CEST
(In reply to comment #6)
 
> Anyway, if you want to control whether e.g. suspend locks screen from command
> line, you have to disable screen locking in power manager preferences, and
> decide whether you run xflock4 before the respective dbus-send command.

Unfortunately, screen would not be locked then by e.g. when suspending by closing laptop lid, when hibernating using the power button. I.e. locking would be an exception. You can't choose to leave screen unlocked as an exception.
Comment 8 Ali Abdallah editbugs 2011-09-09 10:56:04 CEST
version 0.8.x no longer supported.

Bug #5853

Reported by:
Jarno Suni
Reported on: 2009-10-10
Last modified on: 2011-09-09

People

Assignee:
Ali Abdallah
CC List:
0 users

Version

Attachments

Additional information