5

My goal is to allow user only to restart the system, and deny any shutdown (suspend, hibernate). I am running unity-2d.

I 've managed to deny suspend and hibernate with polkit policy files like explained in How to disable shutdown/reboot/suspend/hibernate?

I observed that is has somehow disable shutdown abilities, but hasn't removed "shutdown" entry from the indicator panel menu neither as well as the "shutdown..." button from the shutdown dialog. Pressing shutdown button at this point restarts lightdm, returning to the login screen.

My goal is to remove any "shutdown" action and button.

So, I 've added an ovveride file in /usr/share/glib-2.0/schemas that contains some rules:

[com.canonical.indicator.session]
suppress-shutdown-menuitem = true

(all suppress-*-menuitem has "false" value by default in the schema)

Compiling, restarting X, now there is an entry "close session..." in the indicator panel menu...: it's not what I want.

at this point, if I set another entry suppress-logout-menuitem to true I got no entry in the indicator panel menu.

Trying like this all combination doesn't give the opportunity to remove "shutdown" references/buttons without removing restart option.

All I want is to remove any reference to "shutdown" but keep a "restart" option somewhere in the indicator menu...

Thanks !

UPDATE ! I still don't have enough data to resolve my issue. The new data is an Ubuntu maintainer ( https://bugs.launchpad.net/ubuntu/+source/indicator-session/+bug/1015558 ) admits this as an issue that is resolved in 12.10 and is not going to be resolved in the LTS branch ! From my point of view, this is cleary a regression as I didn't have any problem to do this in 10.04.

At this point, even if I manage to modify the indicator-session code, any update from the mainstream ubuntu repo will break it :/

2 Answers 2

1

In case integration to the indicator menu is not a prerequisite we can always define a custom launcher or a custom application indicator calling the follwing command to allow system restart only:

/usr/lib/indicator-session/gtk-logout-helper -r

See also: What is the command to open the shutdown dialog?

1
  • Thank you this is a great a great workaround. I going to adopt this ! Nov 15, 2012 at 11:16
1

Unity -2d uses a declaritive view called

    GioDefaultApplication {
        id: defaultApplication
    }

    Application {
        id: application
        desktop_file: defaultApplication.desktopFile
    }

    visible: application.desktop_file != ""

    onClicked: dash.activateApplication(application)

     icon: "image://icons/" + application.icon
}

"Application" to launch a desktop file so you can do a couple of things. 1) remove the desktop files under /usr/share/applications/ They go as followed

  • Logout = indicator-session-logout.desktop

  • Suspend = indicator-session-lock-screen.desktop

  • Restart = indicator-session-restart.desktop

  • Switch Off = indicator-session-shutdown.desktop

By either editing these files and or removing them (backup 1st) will make the indacator error out

Other thing that you can do is open the source to unity-2d and make it so all things clicked = the desktop file that you like.

Hope that this helps

2

You must log in to answer this question.

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