SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#51 2015-03-04 02:07:21

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: bl-exit script

Offline

Be excellent to each other!

#52 2015-03-04 02:33:50

tknomanzr
#! Die Hard
From: Heavener, OK
Registered: 2014-12-09
Posts: 777

Re: bl-exit script

sudo shutdown -r now

Offline

#53 2015-03-04 02:37:20

porkpiehat
#! Die Hard
Registered: 2012-10-02
Posts: 1,007

Re: bl-exit script

dbus is crap. I have not had it on my systems for many months. Almost as bad as consolekit.

But agree wuth JohnRaff -- if you can get what you want with dbus, go for it. Most people won't even know.

Last edited by porkpiehat (2015-03-04 02:39:11)

Offline

#54 2015-03-04 02:49:12

spacex
ew
From: Norway
Registered: 2015-01-17
Posts: 385
Website

Re: bl-exit script

The old cb-exit script still works in a systemd-setup. It's only the suspend call that needs a tweak, and there is no need to edit the sudoers file. This works in Jessie as long as you are using lightdm....

#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass

class cb_exit:
	def disable_buttons(self):
		self.cancel.set_sensitive(False)
		self.logout.set_sensitive(False)
		self.suspend.set_sensitive(False)
		self.reboot.set_sensitive(False)
		self.shutdown.set_sensitive(False)

	def cancel_action(self,btn):
		self.disable_buttons()
		gtk.main_quit()

	def logout_action(self,btn):
		self.disable_buttons()
		self.status.set_label("Exiting Openbox, please standby...")
		os.system("openbox --exit")

	def suspend_action(self,btn):
		self.disable_buttons()
		self.status.set_label("Suspending, please standby...")
		os.system("cb-lock")
		os.system("dbus-send --print-reply --system --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend boolean:true")
		gtk.main_quit()

	def reboot_action(self,btn):
		self.disable_buttons()
		self.status.set_label("Rebooting, please standby...")
		os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.ConsoleKit\" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart")

	def shutdown_action(self,btn):
		self.disable_buttons()
		self.status.set_label("Shutting down, please standby...")
		os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.ConsoleKit\" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop")

	def create_window(self):
		self.window = gtk.Window()
		title = "Log out " + getpass.getuser() + "? Choose an option:"
		self.window.set_title(title)
		self.window.set_border_width(5)
		self.window.set_size_request(500, 80)
		self.window.set_resizable(False)
		self.window.set_keep_above(True)
		self.window.stick
		self.window.set_position(1)
		self.window.connect("delete_event", gtk.main_quit)
		windowicon = self.window.render_icon(gtk.STOCK_QUIT, gtk.ICON_SIZE_MENU)
		self.window.set_icon(windowicon)

		
		#Create HBox for buttons
		self.button_box = gtk.HBox()
		self.button_box.show()
		
		#Cancel button
		self.cancel = gtk.Button(stock = gtk.STOCK_CANCEL)
		self.cancel.set_border_width(4)
		self.cancel.connect("clicked", self.cancel_action)
		self.button_box.pack_start(self.cancel)
		self.cancel.show()
		
		#Logout button
		self.logout = gtk.Button("_Log out")
		self.logout.set_border_width(4)
		self.logout.connect("clicked", self.logout_action)
		self.button_box.pack_start(self.logout)
		self.logout.show()
		
		#Suspend button
		self.suspend = gtk.Button("_Suspend")
		self.suspend.set_border_width(4)
		self.suspend.connect("clicked", self.suspend_action)
		self.button_box.pack_start(self.suspend)
		self.suspend.show()
		
		#Reboot button
		self.reboot = gtk.Button("_Reboot")
		self.reboot.set_border_width(4)
		self.reboot.connect("clicked", self.reboot_action)
		self.button_box.pack_start(self.reboot)
		self.reboot.show()
		
		#Shutdown button
		self.shutdown = gtk.Button("_Power off")
		self.shutdown.set_border_width(4)
		self.shutdown.connect("clicked", self.shutdown_action)
		self.button_box.pack_start(self.shutdown)
		self.shutdown.show()
		
		#Create HBox for status label
		self.label_box = gtk.HBox()
		self.label_box.show()
		self.status = gtk.Label()
		self.status.show()
		self.label_box.pack_start(self.status)
		
		#Create VBox and pack the above HBox's
		self.vbox = gtk.VBox()
		self.vbox.pack_start(self.button_box)
		self.vbox.pack_start(self.label_box)
		self.vbox.show()
		
		self.window.add(self.vbox)
		self.window.show()
		
	def __init__(self):
		self.create_window()


def main():
    gtk.main()

if __name__ == "__main__":
    go = cb_exit()
    main()

Offline

#55 2015-03-04 02:51:39

porkpiehat
#! Die Hard
Registered: 2012-10-02
Posts: 1,007

Re: bl-exit script

haha "tweak" ew got his fix today

Last edited by porkpiehat (2015-03-04 02:54:00)

Offline

#56 2015-03-04 05:50:08

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: bl-exit script

Offline

#57 2015-03-04 13:05:42

spacex
ew
From: Norway
Registered: 2015-01-17
Posts: 385
Website

Re: bl-exit script

Offline

#58 2015-03-05 18:20:25

twoion
Emerald Caffeine
From: 星界
Registered: 2012-05-11
Posts: 1,648

Re: bl-exit script

################################################################
# MENU ENTRIES
# Format: COMMANDS[<menu label>]="<command line>"
################################################################

COMMANDS[Lock]="xscreensaver-command -lock"
COMMANDS[Suspend]="gksudo pm-suspend"
COMMANDS[Hibernate]="gksudo pm-hibernate"
COMMANDS[Log out]="pkill dwm"
COMMANDS[Reboot]="gksudo reboot"
COMMANDS[Power off]="gksudo poweroff"

Last edited by twoion (2015-03-05 18:27:39)

Offline

#59 2015-03-05 19:28:33

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: bl-exit script

@twoion -- very nice!

Suckless FTW!

So would this require an entry in /etc/sudoers to allow reboot/suspend/poweroff without a password?

Also, is it not the case that /sbin/reboot & /sbin/poweroff are not in a normal user's $PATH?

Are you suggesting that /sbin be added to $PATH?

Last edited by Head_on_a_Stick (2015-03-05 19:30:15)

Offline

#60 2015-03-05 19:50:11

twoion
Emerald Caffeine
From: 星界
Registered: 2012-05-11
Posts: 1,648

Re: bl-exit script

Offline

#61 2015-03-05 20:58:46

twoion
Emerald Caffeine
From: 星界
Registered: 2012-05-11
Posts: 1,648

Re: bl-exit script

Offline

#62 2015-03-05 21:16:54

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,634
Website

Re: bl-exit script

Keep going at that rate and it'll be bloated too big_smile

Offline

#63 2015-03-05 21:27:11

hhh
Cityspeak
Registered: 2010-08-04
Posts: 3,253

Re: bl-exit script

Offline

#64 2015-03-05 21:39:40

twoion
Emerald Caffeine
From: 星界
Registered: 2012-05-11
Posts: 1,648

Re: bl-exit script

Offline

#65 2015-03-05 21:47:52

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: bl-exit script

Icons on the buttons? Nooooo!

Offline

#66 2015-03-05 22:37:55

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: bl-exit script

		<separator label="Hanger"/>
		<item label="Punch Out">
			<action name="Execute">
				<command>terminator -e &quot;kill -9 -1&quot;</command>
			</action>
		</item>
		<item label="Re-Boot">
			<action name="Execute">
				<command>sudo /sbin/reboot</command>
			</action>
		</item>
		<item label="Power Down">
			<action name="Execute">
				<command>sudo /sbin/poweroff</command>
			</action>
		</item>
	</menu>
</openbox_menu>

Offline

#67 2015-03-06 00:53:45

twoion
Emerald Caffeine
From: 星界
Registered: 2012-05-11
Posts: 1,648

Re: bl-exit script

Offline

#68 2015-03-06 00:56:31

twoion
Emerald Caffeine
From: 星界
Registered: 2012-05-11
Posts: 1,648

Re: bl-exit script

Offline

#69 2015-03-06 04:05:56

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: bl-exit script

Oh I understand ... the dmenu thing is nice I like the ingenuity of it.  Mine was just a Q that's all.

Offline

#70 2015-03-06 11:47:18

twoion
Emerald Caffeine
From: 星界
Registered: 2012-05-11
Posts: 1,648

Re: bl-exit script

dmenuv -g <vertical alignment><horizontal alignment>

Last edited by twoion (2015-03-06 12:15:54)

Offline

#71 2015-03-06 20:43:18

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: bl-exit script

systemctl poweroff
systemctl reboot
systemctl suspend

Last edited by Head_on_a_Stick (2015-03-06 20:51:25)

Offline

#72 2015-03-06 23:01:50

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: bl-exit script

Does riding a bike all day give the game 'gait' cowboys had from riding horses all day?

Time to relax  wink

Offline

#73 2015-03-06 23:03:59

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: bl-exit script

Offline

#74 2015-03-12 19:11:58

twoion
Emerald Caffeine
From: 星界
Registered: 2012-05-11
Posts: 1,648

Re: bl-exit script

dmenuv -g <vertical alignment><horizontal alignment>

Offline

Be excellent to each other!

#75 2015-03-12 19:37:05

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: bl-exit script

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo