This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[Solved] How do I edit the Leave options in the App Launcher

Tags: None
(comma "," separated)
mparillo
Registered Member
Posts
28
Karma
0
OS
Specifically, I would like to remove (or hide) the Sleep and Hibernate options.

Last edited by mparillo on Wed Dec 30, 2020 12:15 pm, edited 1 time in total.
mparillo
Registered Member
Posts
28
Karma
0
OS
I found this (https://bbs.archlinux.org/viewtopic.php ... 3#p1261353) but (1) it seems like a hack to me, (2) I wonder if it interferes with updates, and (3) it is old.
mparillo
Registered Member
Posts
28
Karma
0
OS
This (https://forums.opensuse.org/showthread. ... ost2654709) seems to indicate that the previous post is indeed not recommended, but it only covers suspend.
bakumohan
Registered Member
Posts
1
Karma
0
please update the answer here as well :)
mparillo
Registered Member
Posts
28
Karma
0
OS
bakumohan wrote:please update the answer here as well :)


Use Polkit: https://wiki.archlinux.org/index.php/Po ... _hibernate

Note: I could not edit this directly with kate nor change to the directory.
If the below is too newbie-friendly, please do not be insulted.
I had to use vim (some distros install vi instead, so use vi instead of vim, and other distros install nano, so the commands will differ):
Launch your terminal (Konsole)
Code: Select all
sudo vim /etc/polkit-1/rules.d/10-disable-suspend.rules


Enter your sudo password. Since my file was empty, my cursor was at the top. If there were many entries, you should be able to put your cursor at the end of any rule block. To switch to insert mode, type:
Code: Select all
i

Then paste (Ctrl Shift v) the new rule:
Code: Select all
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.suspend" ||
        action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
        action.id == "org.freedesktop.login1.hibernate" ||
        action.id == "org.freedesktop.login1.hibernate-multiple-sessions")
    {
        return polkit.Result.NO;
    }
});

You are still in insert mode, so you want to issue commands again, so hit escape to put yourself back in command mode. then to save and exit:
Code: Select all
:wq


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]