Ubuntu – Lubuntu 17.10 – Removing suspend, switch user, lock screen options from “Shutdown” Launcher

launcherlubuntupower-managementshutdown

I am working on a Lubuntu kiosk that is controlled fully by IR remote. So far everything works well except for rebooting and powering down. I have two related questions:

  1. Now I have 2 separate buttons on the remote; one that runs poweroff in terminal and one that runs reboot. However, I find this clumsy and would prefer to have one button on the remote launch the "Shutdown" Launcher (the power icon on the bottom right of desktop on Lubuntu 17.10) the same that would happen if you clicked the button with mouse. I am using xbindkeys to run my commands. Does anyone know the terminal command or have a script to launch the "Shutdown" launcher?

Edit: I solved this part of the question. The command in 17.10 is lxsession-default quit

  1. When "Logout Lubuntu 17.10 session?" pop-up appears I want the only options visible to be Shutdown, Reboot, and Cancel. I have tried many things from some older threads and older versions but have had not success in removing any of the options.

    enter image description here

    enter image description here

Not Working on 17.10:

  • gsettings set com.canonical.indicator.session suppress-logout-menuitem true

  • editing /usr/share/polkit-1/actions/org.freedesktop.login1.policy and setting <allow_active>no</allow_active> under the respective items

Best Answer

From https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html and https://bbs.archlinux.org/viewtopic.php?id=180798 I'd try creating or editing the file /etc/polkit-1/rules.d/10-auth.rules and including the following content:

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" ||
        action.id == "org.freedesktop.login1.lock-sessions"
        // switch user ?
        // logout ?
        ) {
        return polkit.Result.NO;
    }
    if (action.id == "org.freedesktop.login1.shutdown" ||
        action.id == "org.freedesktop.login1.reboot") {
        return polkit.Result.YES;
    }
});

I haven't been able to find the actions for switch user or logout, though.

Related Question