On Mon, Aug 11, 2014 at 5:05 AM, Johannes Geiss <johannes.ge...@web.de> wrote:
> Hello there,
>
> I have XFCE4 and Systemd running and I want to know if it is possible
> to disable or remove the buttons "Restart" and "Shut down" at the
> logout dialog (xfce4-session-logout).
>
> If so, how?

(Sorry I took so long, I was updating my system).

You want to disable only the buttons, or the functionality? For one
user, or several?

Assuming you want to disable the functionality for one user, this
disables both the functionality *AND* the buttons (they show up grayed
out):

$ cat /etc/polkit-1/rules.d/10-no-restart-shutdown.rules
polkit.addRule(function(action, subject) {
    if (subject.user == "myuser") {
        if (action.id.match("org.freedesktop.login1.power-off") ||
action.id.match("org.freedesktop.login1.reboot")) {
            return polkit.Result.NO;
        }
    }
});

Of course, change "myuser" for the user you want to disable this. You
can also use groups (subject.isInGroup("group")), or use "suspend" or
"hibernate" instead of "reboot".

This works for any desktop that uses systemd (logind, technically) for
session tracking: AFAIK, this should work for at least GNOME, Xfce,
and KDE.

Regards.
-- 
Canek Peláez Valdés
Profesor de asignatura, Facultad de Ciencias
Universidad Nacional Autónoma de México

Reply via email to