1

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

1
  • I solved the first part of this question. The terminal command is lxsession-default quit. Anyone have any idea how to modify the options?
    – P. Keating
    Mar 3, 2018 at 14:58

2 Answers 2

1

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.

1
  • Thank you for helping. Unfortunately this did not work for me. My /etc/polkit-1/ did not have a folder rules.d but I did create one and I also created the file 10-auth.rules and placed it in /etc/polkit-1/rules.d and copied in the code above. After restart all of the options were still present on the logout/shutdown menu and clicking suspend still caused by system to enter suspend mode.
    – P. Keating
    Mar 4, 2018 at 2:44
0

So after reading and researching more it does not look like it is possible to edit the logout session options without editing and recompiling the source code. So I did the next best thing; I used python and tkinter to make my own GUI program to shutdown or restart the pc.

It was really not difficult and I know anyone could throw this together but I'll post it here in case anyone else is interested or since it might help someone out.

  1. Install python (sudo apt-get install python)
  2. Install tkinter (sudo apt-get install python-tk)
  3. Install idle (sudo apt-get install idle)
  4. Open idle (idle)
  5. File --> New File
  6. Paste the following code:

#Test.py from Tkinter import * import os window = Tk() B1 = Button(window, text = "Shutdown", command = lambda: os.system('poweroff')) B2 = Button(window, text = "Reboot", command = lambda: os.system('reboot')) B3 = Button(window, text = "Quit", command = lambda: quit()) B1.pack() B2.pack() B3.pack() window.mainloop()

  1. In the new window where the code was pasted click File --> Save --> type name of file
  2. To invoke reboot, and poweroff without sudo privledges you must run the following sudo chmod a+s /sbin/poweroff and sudo chmod a+s /sbin/reboot. **Beware and be warned this will allow anyone to reboot or poweroff without sudo privileges so be careful **
  3. script can be run from terminal as follows: python /dir/to/file/name.py

Hope this helps someone! Here is a picture of the output (I will be working on making it look pretty over the next few days).

Program on left center of screen

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .