Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 :/

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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?

share|improve this answer
    
Thank you this is a great a great workaround. I going to adopt this ! –  martin-mystere Nov 15 '12 at 11:16

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

share|improve this answer
    
Hi and thanks !! I have no such files indicator-session-* in /usr/share/applications... Might these files are used with the regular unity ? –  martin-mystere Oct 16 '12 at 8:24
    
There is a kind of answer here : bugs.launchpad.net/ubuntu/+source/indicator-session/+bug/… but it seems it will not be fixed in 12.04 LTS ? –  martin-mystere Oct 16 '12 at 12:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.