You are not logged in.

#1 2010-12-25 19:54:21

Veljac
Member
Registered: 2010-01-25
Posts: 54
Website

shutdown script for awesome wm

I`m writing a shutdown script for my awesome wm.
it looks like this

[c!/bin/bash

ACTION=`zenity --width=90 --height=200 --list --radiolist --text="Select logout action" --title="Logout" --column "Choice" --column "Action" TRUE Shutdown FALSE Reboot FALSE LockScreen FALSE Suspend`

if [ -n "${ACTION}" ];then
  case $ACTION in
  Shutdown)
    #zenity --question --text "Are you sure you want to halt?" &&
    dbus-send --system --print-reply \
    --dest=org.freedesktop.ConsoleKit \
    /org/freedesktop/ConsoleKit/Manager \
    org.freedesktop.ConsoleKit.Manager.Stop
    ;;
  Reboot)
    #zenity --question --text "Are you sure you want to reboot?" && gksudo reboot
    dbus-send --system --print-reply \
    --dest=org.freedesktop.ConsoleKit \
    /org/freedesktop/ConsoleKit/Manager \
    org.freedesktop.ConsoleKit.Manager.Restart
    ;;
  Suspend)
    #gksudo pm-suspend
    dbus-send --system --print-reply --dest=org.freedesktop.Hal \
    /org/freedesktop/Hal/devices/computer \
    org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0

    ;;
  LockScreen)
    slock
    ;;
  esac
fi

and i makedd it executable with chmod +x. But it sims that she is not working.When i run it as root the script works.And when i run it like user onli suspend semams to working.

Offline

#2 2010-12-25 20:39:33

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: shutdown script for awesome wm

You don't have to use the deprecated hal! Here are my scripts which I use(d). All you need is

exec ck-launch-session awesome

in your .xinitrc.

shutdown

#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

reboot

#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart

hibernate

#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.DeviceKit.Power" /org/freedesktop/DeviceKit/Power org.freedesktop.DeviceKit.Power.Hibernate

and suspend

#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.DeviceKit.Power" /org/freedesktop/DeviceKit/Power org.freedesktop.DeviceKit.Power.Suspend

Last edited by Army (2010-12-25 20:42:09)

Offline

#3 2010-12-25 21:17:21

Veljac
Member
Registered: 2010-01-25
Posts: 54
Website

Re: shutdown script for awesome wm

same thing.nothin.but thus time i got an error msg in terminal

Error org.freedesktop.ConsoleKit.Manager.NotPrivileged: Not Authorized

Offline

#4 2010-12-25 21:28:38

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,771

Re: shutdown script for awesome wm


Mr Green

Offline

#5 2010-12-25 21:44:04

Veljac
Member
Registered: 2010-01-25
Posts: 54
Website

Re: shutdown script for awesome wm

i tried editing policykit.conf but /etc/PolicyKit/PolicyKit.conf give that /etc/PolicyKit/PolicyKit.conf: No such file or directory
but policykit but policykit is instaled.

Offline

#6 2010-12-25 22:13:53

Veljac
Member
Registered: 2010-01-25
Posts: 54
Website

Re: shutdown script for awesome wm

i delited dbus-send --system --print-reply \
    --dest=org.freedesktop.ConsoleKit \
    /org/freedesktop/ConsoleKit/Manager \
    org.freedesktop.ConsoleKit.Manager.Stop

and putt xterm -e sudo shutdown -h now and this works

Offline

#7 2012-12-27 08:50:56

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: shutdown script for awesome wm

you could gksudo shutdown -h now to avoid the xterm

Offline

#8 2012-12-27 09:19:39

Into the Pit
Member
Registered: 2010-09-04
Posts: 36

Re: shutdown script for awesome wm

you could also use systemd for that.

Meh, did not see the date of the Thread …

Last edited by Into the Pit (2012-12-27 09:21:04)

Offline

#9 2012-12-27 09:44:39

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: shutdown script for awesome wm

oops... didn't see that either hmm
Is there a way to suspend without asking for a pass?

Offline

#10 2012-12-27 16:01:19

gulafaran
Member
Registered: 2011-02-09
Posts: 14

Re: shutdown script for awesome wm

start x properly so you get a proper session https://wiki.archlinux.org/index.php/Ge … ermissions , then just do shutdown -h now . no need for sudo or anything similiar

Offline

#11 2012-12-27 17:32:13

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,079

Re: shutdown script for awesome wm

ttouch, I am sure in the last 2 years since the last post in this thread, the op figured it out. Infact he mentions it that it works in his last post. Please do not necrobump.

Policy for reference :: https://wiki.archlinux.org/index.php/Fo … Bumping.22


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

Board footer

Powered by FluxBB