
在 OpenSUSE 12.1 x86_64、Gnome 3.2 上。我想從 Gnome(Shell)選單中刪除掛起和休眠選項,如下所示
- 在我看來,掛起對桌面來說沒有任何意義
- hibernate 有輕微的鎖定傾向
我發現我應該使用 polkit 來設定這些權限。我已經刪除了一個名為90-disable-suspend.conf
(也嘗試過90-disable-suspend.pkla
)的文件,/etc/polkit-1/localauthority.conf.d
其中包含以下內容:
[Disable Suspend]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate;org.freedesktop.upower.suspend
ResultAny=no
ResultInactive=no
ResultActive=no
但是,運行pkcheck --action-id org.freedesktop.upower.suspend --process $$
不會列印任何內容,退出代碼為 0 ,並且選單項目仍然存在。 AFAICT 這些是透過gnome-shell-extension-alt-status-menu
包提供的。
如何從 Gnome Shell 選單中刪除掛起和休眠條目並僅保留關閉電源?
答案1
該目錄/etc/polkit-1/localauthority.conf.d
是為設定檔保留的。
您應該將檔案放在 的子目錄中/var/lib/polkit-1/localauthority
並擴展名為.pkla
.該目錄/etc/polkit-1/localauthority
也應該沒問題,但可以透過升級/安裝的軟體包進行修改,所以最好避免它。
答案2
這個問題有一個非常簡單的答案。
去/usr/sbin
。刪除符號連結pm-hibernate
和pm-suspend
。pm-suspend-hybrid
現在,當從選單中選擇「暫停」或「休眠」時,它只會執行「鎖定畫面」。
如果您想讓我更加確定,請轉到/usr/lib/pm-utils/bin
並移動pm-action
到,pm-action.mv
因為這是上述符號連結指向的可執行檔。