2

My system: Ubuntu 11.10 latest updates with custom gtk3 theme

This is the output of .xsession-errors:

WARN 2012-01-15 21:44:04 glib.glib-gobject :0 invalid uninstantiatable type (null)' in cast toBamfView'

WARN 2012-01-15 21:44:05 glib :0 Unable to fetch children: Method "Children" with signature "" on interface "org.ayatana.bamf.view" doesn't exist

What can I do now to enable shutdown button? If I press shutdown nothing happens.

thonixx
  • 862

1 Answers1

1

Ok - I don't know if You like it, but it is a somewhat solution:

create a text file PowerOff.sh (with gedit for example) and write there (if Your default shell is bash - if other You'll probably know what to do):

#!/bin/bash 
sudo shutdown -h now

Click it with Your right mouse button and in proerties: allow to execute as program.

It would be comfy to copy this file in some hidden location (i mean not to leave it on desktop).

After that You need to modify a file /etc/sudoers:

sudo gedit /etc/sudoers

at the end of this file add:

user ALL = NOPASSWD: /sbin/shutdown

where user is Your user name f.ex. thonixx if that is how you log in Ubuntu

OK, now create an activator on Your panel, click it with right mouse button, and choose:add to panel -> add activator -> your own activator -> type: program in terminal and choose Your created file PowerOff.sh

Now it should be possible to shutdown Your PC by clicking the activator on Your panel. if You wish You could even give it an icon of Your choice

In that manner You could possibly make other commands. Or even write a simple python wrapper to show a form letting You to choose if You want to reboot, shutdown, logout etc. I gave You the solution without poping out the shutdown dialog, because You didn't really mention which shutdown button makes this errors. You could make identical solution using the command:

gnome-session-save --shutdown-dialog

in bash file instead shutdown. In such case You would probably not need to edit /etc/sudoers

Regards

PS: for now it looks like a bug in Unity. try to google: org.ayatana.bamf.view

a few links:

using logout dialog from terminal or bash script

how to logout

how to edit permissions

how to write scripts in python

Misery
  • 3,484
  • wow thanks misery for this professional answer. i cant logoff and shutdown computer from the gnome dialog with the option to logout, shutdown and whatever you can choose there.

    one question: you mentioned "my panel" which panel you mean? unity launcher panel on the side? i cant right click there to create a launcher and i have unity, not gnome classic or gnome 3 ;)

    – thonixx Jan 27 '12 at 20:54
  • I used Unity only for a while, but as I remember You can add an activator to any panel (this left side panel, or the default panel appearing on the upper and lower screen borders). I found a tutorial about this (however in polish) and it seems a bit complicated. How about trying to make an activator on the desktop and dragging it on the panel? Will that work? – Misery Jan 27 '12 at 21:08
  • 1
    UPDATE: i have created a .desktop file which opens terminal and now there is the shutdown desktop launcher in unity and instead of clicking in the dialog i can click on launcher. its ok for me – thonixx Jan 27 '12 at 21:32