You are not logged in.

#1 2011-08-20 01:21:11

krax
Member
Registered: 2011-08-20
Posts: 2

Zenity shutdown script with Consolekit

Somehow we are at the new stage hal deprecated and its  changes is not easy for newbies to follows.  also changing sudoers is a dirty and not safe trick So:

The need for zenity script with these feature:

@ Consolekit +dbus
@Logout
@shoutdown
@restart
@suspend { should we add resume to rc.conf daemons arry? if yes where? at the end?}
@my be cancel

is really being felt.

So if someone how is able to change the old zentiy openbox script comes forward and do the job; we are all appreciating.

Last edited by krax (2011-08-20 01:29:30)

Offline

#2 2011-12-24 15:22:38

arpinux
Member
From: montréal, france
Registered: 2011-12-23
Posts: 14
Website

Re: Zenity shutdown script with Consolekit

hi,
aphelion, a friend of mine, did a shutdown script using zenity with all those features. the script is used in his debian-based livecd: Aphelive with awesome as window-manager.
here is the script (fr)... just need little edit for using in openbox:

#!/bin/sh
ACTION=`zenity --width=90 --height=255 --list --radiolist --text="Selectionner une action" --title="Logout" --column "Choice" --column "Action" TRUE Eteindre FALSE Redemarrer FALSE Suspendre FALSE Hiberner FALSE Verrouiller FALSE Deconnecter`
if [ -n "${ACTION}" ];then
case $ACTION in
  Eteindre)
    dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
    ;;
  Redemarrer)
    dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
    ;;
  Verrouiller)
    xscreensaver-command -lock
    ;;
  Suspendre)
   dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
   ;;
  Hiberner)
   dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
   ;;
  Deconnecter)
   echo "awesome.quit()" | awesome-client
   ;;
  esac
fi

and what it looks like:
aphelive_shutdown.png
hope you could adapt it to your session smile
sources: https://github.com/Aphelion/Aphelive

Offline

#3 2011-12-25 05:59:28

pablokal
Administrator
From: Nijmegen, Holland
Registered: 2010-10-12
Posts: 3,609
Website

Re: Zenity shutdown script with Consolekit

Translation and adapted for openbox:

#!/bin/sh
ACTION=`zenity --width=90 --height=255 --list --radiolist --text="Choose" --title="Logout" --column "Choice" --column "Action" TRUE Exit FALSE Reboot FALSE Suspendre FALSE Hibernate FALSE Lock FALSE Disconnect`
if [ -n "${ACTION}" ];then
case $ACTION in
  Exit)
    dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
    ;;
  Restart)
    dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
    ;;
  Lock)
    xscreensaver-command -lock
    ;;
  Suspend)
   dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
   ;;
  Hibernate)
   dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
   ;;
  Logout)
   echo "openbox --exit"
   ;;
  esac
fi

Not tested yet.


Getting your questions answered here at ArchBang Forums
Please! Always give hardware info, if there is a chance that 's relevant: #lspci -vnn
On Arch(bang) and Openbox: http://stillstup.blogspot.com/

Offline

#4 2012-01-03 21:02:18

hymie
Member
Registered: 2011-02-25
Posts: 66

Re: Zenity shutdown script with Consolekit

I've still not figured out how to use keyboard shortcuts with "zenity". Is it possible at all, as with "gxmessage"?

gxmessage "Sure you want to quit?" -center -title "== Quit Session =="\
 -default "Cancel" -buttons "_Cancel:100,_Reboot:101,_Shutdown:102"
case $? in
100)
	;;
101)
	dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart ;;
102)
	dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop ;;
esac

Here you might use the mouse or the Alt-c, Alt-r or Alt-s key. I'm trying more and more to switch using the keyboard shortcuts since the mouse starts causing me a tennis elbow ;-))
But in "openbox" there's "oblogout". What's wrong with that?

Offline

#5 2012-01-04 16:03:16

hymie
Member
Registered: 2011-02-25
Posts: 66

Re: Zenity shutdown script with Consolekit

I think keychaining should also work in "openbox". These are the "Quit" keychains that I have in "fluxbox" now:

Mod4 Q Mod4 L 	:Exit
Mod4 Q Mod4 R	:Exec dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
Mod4 Q Mod4 S	:Exec dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

It's just holding the "Super" key and typing "ql" for "logout", "qr" for "reboot" and "qs" for "shutdown"...

Offline

Board footer

Powered by FluxBB