什么是shutdown命令?
我想在13.04中为启动器创建一个关闭图标。 在以前版本的Ubuntu中,我使用了这个桌面文件并将其放入启动器中:
.local / share / applications / indicator-session-shutdown.desktop
[Desktop Entry] Name=Shut Down TryExec=/usr/lib/indicator-session/gtk-logout-helper Exec=/usr/lib/indicator-session/gtk-logout-helper --shutdown Icon=system-shutdown Terminal=false Type=Application OnlyShowIn=Unity; Categories=System; Version=1.0 X-Ubuntu-Gettext-Domain=indicator-session
我怀疑是否
/usr/lib/indicator-session/gtk-logout-helper --shutdown
仍然是13.04中的正确命令。
这是旧关机对话框的屏幕截图:
这是一个带有新关机对话框的屏幕截图:
尝试:
gnome-session-quit
有关更多选项:
gnome-session-quit --help
根据手册,支持以下选项:
--logout Prompt the user to confirm logout. This is the default behavior. --power-off Prompt the user to confirm system power off. --reboot Prompt the user to confirm system reboot. --force Ignore any inhibitors. --no-prompt End the session without user interaction. This only works with --logout.
或者看看dbus-monitor,这是命令:
dbus-send --print-reply --dest="org.gnome.Shell" /org/gnome/SessionManager/EndSessionDialog org.gnome.SessionManager.EndSessionDialog.Open uint32:2 uint32:0 uint32:60 array:objpath:/org/gnome/SessionManager/EndSessionDialog
要获得精确的对话框,唯一的方法是通过dbus,因为gnome-sesion-quit
只显示通用的四选项对话框。 我通过看dbus-monitor
得到了这个。 这是命令:
dbus-send --print-reply --dest="org.gnome.Shell" /org/gnome/SessionManager/EndSessionDialog org.gnome.SessionManager.EndSessionDialog.Open uint32:2 uint32:0 uint32:60 array:objpath:/org/gnome/SessionManager/EndSessionDialog