Problems at use | Problèmes à l'utilisation
Subscription date : 30 November 2010
Messages : 31
|
One would think there would be a simple command anyone could use to stop X and get back to the gdm login prompt. But I haven't been able to find it after trying a bunch of different commands I turned up with Google.
I'm just running Compiz as my WM in Ubuntu 10.04 Minimal CD, no Gnome, no KDE, no XFCE.
"service gdm restart" crashes X back to a text screen, but with no prompt.
Do you have a suggestion of a way to get to gdm's login screen, rather than rebooting the system.
Lane |
Subscription date : 30 November 2010
Messages : 31
|
In my search, I did turn up a nice script to create a window for logout/restart/shutdown:
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import os
class DoTheLogOut:
# Cancel/exit
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def onkeypress(self, widget, event):
if event.keyval == gtk.keysyms.Escape:
gtk.main_quit()
return False
def lost_focus(self, widget, event):
if self.focus_check:
gtk.main_quit()
return False
# Logout
def logout(self, widget):
os.system("skill -TERM $DESKTOP_SESSION")
# Reboot
def reboot(self, widget):
os.system("dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart")
# Shutdown
def shutdown(self, widget):
os.system("dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop")
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_title("Exit? Choose an option:")
self.window.set_resizable(False)
self.window.set_position(1)
self.window.connect("delete_event", self.delete_event)
self.window.set_border_width(20)
# Create a box to pack widgets into
self.box1 = gtk.HBox(False, 0)
self.window.add(self.box1)
# Create cancel button
self.button1 = gtk.Button("_Cancel")
self.button1.set_border_width(10)
self.button1.connect("clicked", self.delete_event, "Changed me mind :)")
self.box1.pack_start(self.button1, True, True, 0)
self.button1.show()
# Create logout button
self.button2 = gtk.Button("_Log out")
self.button2.set_border_width(10)
self.button2.connect("clicked", self.logout)
self.box1.pack_start(self.button2, True, True, 0)
self.button2.show()
# Create reboot button
self.button3 = gtk.Button("_Reboot")
self.button3.set_border_width(10)
self.button3.connect("clicked", self.reboot)
self.box1.pack_start(self.button3, True, True, 0)
self.button3.show()
# Create shutdown button
self.button4 = gtk.Button("_Shutdown")
self.button4.set_border_width(10)
self.button4.connect("clicked", self.shutdown)
self.box1.pack_start(self.button4, True, True, 0)
self.button4.show()
self.focus_check = True
self.window.connect("focus-out-event", self.lost_focus)
self.window.connect("key-press-event", self.onkeypress)
self.box1.show()
self.window.show()
def main():
gtk.main()
if __name__ == "__main__":
gogogo = DoTheLogOut()
main()
Unfortunately, the line that's supposed to execute a logout doesn't do anything:
os.system("skill -TERM $DESKTOP_SESSION")
At the author's suggestion I tried "echo $DESKTOP_SESSION" and it returned "fusion". Substituting that for the variable didn't do anything, but using "compiz" caused Compiz to crash, but it left me with the desktop and not the gdm prompt.
Lane |
fabounet, Monday 03 January 2011 à 14:56
|
|
Subscription date : 30 November 2007
Messages : 17118
|
if you use gdm as the session manager, then you should use it to leave it/change user/shot down/etc
and the logout applet can use it, so if Gnome is detected by the dock (or forced with "cairo-dock -e gnome"), you should be able to log out. |
Problems at use | Problèmes à l'utilisation
|