Removing suspend/hibernate from KDE menu

I’m using OpenSuse 13.1 with KDE and have been trying to remove the suspend & hibernate options from the KDE menu. What I’ve tried so far:

  • PolicyKit files in /usr/share/polkit-1/actions (changing allow_active for all permissions related to suspend/hibernate to “no”)
  • Adding related policies (e.g. org.freedesktop.login1.suspend) to /etc/polkit-defaults-privs.local
  • Replacing pm-is-supported with a script that does just “exit 1”

Despite doing this the options are still there and I can still suspend the system as a regular user.

Any help would be greatly appreciated.

I’m not sure why you think it matters.

I am managing to never hibernate or suspend. I simply avoid using those menu items.

Do not edit the files in /usr/share/polkit-1/actions!
Most changes have no effect anyway, and your changes are lost when installing updates.

Adding related policies (e.g. org.freedesktop.login1.suspend) to /etc/polkit-defaults-privs.local

Set “org.freedesktop.login1.suspend-multiple-sessions” to no as well there.

And you have to run “set_polkit_default_privs” afterwards to create the actual polkit rules files.

These lines in /etc/polkit-defaults-privs.local make the “Suspend” entry disappear in the KDE menu here and also prohibit “systemctl suspend”:

org.freedesktop.upower.suspend no
org.freedesktop.login1.suspend no
org.freedesktop.login1.suspend-multiple-sessions no

I’m not sure what uses upower, but better add it as well if you want to get rid of suspend completely.

For hibernate it should be similar.

Replacing pm-is-supported with a script that does just “exit 1”

pm-utils are obsolete and not even available in Factory anymore.
Nowadays systemd-logind takes care of suspend/hibernate. It does use pm-utils though if it is installed.

And KDE doesn’t call a script to check whether suspend/hibernate is available, but asks logind via DBUS.

Works like a charm! Thanks so much! :smiley: