SEARCH

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

You are not logged in.

#101 2011-02-28 19:26:14

mcarni
#! CrunchBanger
Registered: 2009-02-10
Posts: 130

Re: OBLogout - replacement logout script for Openbox - Version 0.2

better late than never....

had a similar problem and solved it, as Awebb suggested by:

Had to edit /etc/oblogout.conf and change "usehal" to "false" to get it to work.
But otherwise great package

found it on

https://bbs.archlinux.org/viewtopic.php … 34#p806234

M

Offline

Be excellent to each other!

#102 2011-02-28 20:00:25

ali
#! Die Hard
Registered: 2010-05-31
Posts: 1,034

Re: OBLogout - replacement logout script for Openbox - Version 0.2

i got really pissed because i couldn't find what i was looking for so i rearranged the code, now everything is in 1 file
but still i have that weird image spin

0019e.th.png


#! /usr/bin/python

try:
    import os
    import sys
    import ConfigParser
    import StringIO
    import logging
    import gettext
    import string
    import gtk
    import cairo
    import pygtk
    pygtk.require('2.0')
    from PIL import Image, ImageFilter
except:
    sys.exit()

class OpenboxLogout():
    kill_me = "kill `ps -ef | grep /usr/bin/oblogout-2 | grep -v grep | awk '{print $2}'` && "
    cmd_shutdown = kill_me + "dbus-send --system --print-reply  --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager  org.freedesktop.ConsoleKit.Manager.Stop"
    cmd_restart = kill_me + "dbus-send --system --print-reply  --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager  org.freedesktop.ConsoleKit.Manager.Restart"
    cmd_suspend = kill_me + "dbus-send --system --print-reply  --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend"
    cmd_hibernate = kill_me + "dbus-send --system --print-reply  --dest=org.freedesktop.UPower /org/freedesktop/UPower  org.freedesktop.UPower.Hibernate"
    cmd_logout = kill_me + "openbox --exit"

    def __init__(self):
          
        # Load configuration file
    self.opacity = 50
        self.bgcolor = gtk.gdk.color_parse("black")
        blist = "suspend, logout, restart, shutdown"
        self.shortcut_keys = [('cancel', 'Escape'), ('suspend', 'S')]
    self.img_path = "/usr/share/themes/ob-logout/foom"
    
    self.button_list = map(lambda button: string.strip(button), blist.split(","))
        
    gettext.install('oblogout', 'usr/share/locale', unicode=1)      
                                        
        # Start the window
        self.__init_window()
        
    def __init_window(self):       
        # Start pyGTK setup       
        self.window = gtk.Window()        
        
        self.window.connect("destroy", self.quit)
        self.window.connect("key-press-event", self.on_keypress)
        self.window.connect("window-state-event", self.on_window_state_change)
        
        if not self.window.is_composited():
            # Window isn't composited, enable rendered effects
            self.rendered_effects = True
        else:
            # Link in Cairo rendering events
            self.window.connect('expose-event', self.on_expose)
            self.window.connect('screen-changed', self.on_screen_changed)
            self.on_screen_changed(self.window)
            self.rendered_effects = False
        
        self.window.set_size_request(620,200)
        self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("black"))
                   
        self.window.set_decorated(False)
        self.window.set_position(gtk.WIN_POS_CENTER)
        
        # Create the main panel box
        self.mainpanel = gtk.HBox()
        
        # Create the button box
        self.buttonpanel = gtk.HButtonBox()
        self.buttonpanel.set_spacing(10)
        
        # Pack in the button box into the panel box, with two padder boxes
        self.mainpanel.pack_start(gtk.VBox())
        self.mainpanel.pack_start(self.buttonpanel, False, False)
        self.mainpanel.pack_start(gtk.VBox())
                
        # Add the main panel to the window
        self.window.add(self.mainpanel)
         
        for button in self.button_list:
            self.__add_button(button, self.buttonpanel)        
                                          
        if self.rendered_effects == True:    
            w = gtk.gdk.get_default_root_window()
            sz = w.get_size()
            pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,False,8,sz[0],sz[1])
            pb = pb.get_from_drawable(w,w.get_colormap(),0,0,0,0,sz[0],sz[1])
            # Convert Pixbuf to PIL Image
            wh = (pb.get_width(),pb.get_height())
            pilimg = Image.fromstring("RGB", wh, pb.get_pixels())
            
            pilimg = pilimg.point(lambda p: (p * self.opacity) / 255 )

            # "Convert" the PIL to Pixbuf via PixbufLoader
            buf = StringIO.StringIO()
            pilimg.save(buf, "ppm")
            del pilimg
            loader = gtk.gdk.PixbufLoader("pnm")
            loader.write(buf.getvalue())
            pixbuf = loader.get_pixbuf()

            # Cleanup IO
            buf.close()
            loader.close()

            pixmap, mask = pixbuf.render_pixmap_and_mask()
            # width, height = pixmap.get_size()
        else:
            pixmap = None
    
        self.window.set_app_paintable(True)
        self.window.resize(gtk.gdk.screen_width(), gtk.gdk.screen_height())
        self.window.realize()
                
        if pixmap:
            self.window.window.set_back_pixmap(pixmap, False)
        self.window.move(0,0)
        
    def on_expose(self, widget, event):
       
        cr = widget.window.cairo_create()
    
        if self.supports_alpha == True:
            cr.set_source_rgba(1.0, 1.0, 1.0, 0.0) # Transparent
        else:
            cr.set_source_rgb(1.0, 1.0, 1.0) # Opaque white
    
        # Draw the background
        cr.set_operator(cairo.OPERATOR_SOURCE)
        cr.paint()

        (width, height) = widget.get_size()
        cr.set_source_rgba(self.bgcolor.red, self.bgcolor.green, self.bgcolor.blue, float(self.opacity)/100)
       
        cr.rectangle(0, 0, width, height)
        cr.fill()
        cr.stroke()
        return False
        
    def on_screen_changed(self, widget, old_screen=None):
       
        # To check if the display supports alpha channels, get the colormap
        screen = widget.get_screen()
        colormap = screen.get_rgba_colormap()
        if colormap == None:
            colormap = screen.get_rgb_colormap()
            self.supports_alpha = False
        else:
            self.supports_alpha = True
    
        # Now we have a colormap appropriate for the screen, use it
        widget.set_colormap(colormap)

    def on_window_state_change(self, widget, event, *args):
        if event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN:
            self.window_in_fullscreen = True
        else:
            self.window_in_fullscreen = False

    def __add_button(self, name, widget):
        """ Add a button to the panel """
    
        box = gtk.VBox()
   
        image = gtk.Image()
        if os.path.exists("%s/%s.svg" % (self.img_path, name)):
            image.set_from_file("%s/%s.svg" % (self.img_path, name))
        else:
            image.set_from_file("%s/%s.png" % (self.img_path, name))
        image.show()
        
        button = gtk.Button()
        button.set_relief(gtk.RELIEF_NONE)
        button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("black"))
        button.set_focus_on_click(False)
        button.set_border_width(0)
        button.set_property('can-focus', False) 
        button.add(image)
        button.show()
        box.pack_start(button, False, False)
        button.connect("clicked", self.click_button, name)
        
        label = gtk.Label(_(name))
        label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
        box.pack_end(label, False, False)
        
        widget.pack_start(box, False, False)

    def click_button(self, widget, data=None):
        if (data == 'logout'):
            os.system(self.cmd_logout)
            
        elif (data == 'restart'):
            os.system(self.cmd_restart)
                
        elif (data == 'shutdown'):
            os.system(self.cmd_shutdown)
                
        elif (data == 'suspend'):
            os.system(self.cmd_suspend)
                
        elif (data == 'hibernate'):
            os.system(self.cmd_hibernate) 
                    
        gtk.main_quit()
            
    def on_keypress(self, widget=None, event=None, data=None):
        for key in self.shortcut_keys:
            if event.keyval == gtk.gdk.keyval_to_lower(gtk.gdk.keyval_from_name(key[1])):
                self.click_button(widget, key[0])
   
    def quit(self, widget=None, data=None):
        gtk.main_quit()

    def run_logout(self):
        self.window.show_all()
        gtk.main()


class Usage(Exception):
    def __init__(self, msg):
        self.msg = msg

def main(argv = sys.argv):
    
    # Start the application
    app = OpenboxLogout()
    app.run_logout() 
    return 0

if __name__ == "__main__":
    sys.exit(main())

Last edited by ali (2011-02-28 20:01:53)

Offline

#103 2011-03-01 09:00:45

Kuno
#! Die Hard
From: Osnabrück - DE
Registered: 2009-01-09
Posts: 611

Re: OBLogout - replacement logout script for Openbox - Version 0.2

ali wrote:

i got really pissed because i couldn't find what i was looking for so i rearranged the code, now everything is in 1 file
but still i have that weird image spin

Maybe i don't quite understand, what you mean by "image spin" - but if you just want that coloured icons, you posted in that other thread, change "/usr/share/themes/ob-logout/foom" to "/usr/share/themes/ob-logout/oxygen".

Offline

#104 2011-03-01 09:01:48

ali
#! Die Hard
Registered: 2010-05-31
Posts: 1,034

Re: OBLogout - replacement logout script for Openbox - Version 0.2

look at the background in my picture

Offline

#105 2011-03-01 09:31:56

Kuno
#! Die Hard
From: Osnabrück - DE
Registered: 2009-01-09
Posts: 611

Re: OBLogout - replacement logout script for Openbox - Version 0.2

ali wrote:

look at the background in my picture

Aah, thanks - now it's clear. Honestly, i've never seen that before nor experienced myself... sad

Offline

#106 2011-03-04 04:18:38

Pagoda
Member
Registered: 2011-03-02
Posts: 12

Re: OBLogout - replacement logout script for Openbox - Version 0.2

Is this script still being developed? If not does this still work in Statler?
/cheers

Update:
Ok I installed the .deb and if I run oblogout in a terminal all is working.
What else do I need to do so I can use it from the menu?

Update: Solved!

Last edited by Pagoda (2011-03-04 05:58:31)

Offline

#107 2011-05-27 13:36:30

bartp
Member
From: London
Registered: 2011-05-13
Posts: 28

Re: OBLogout - replacement logout script for Openbox - Version 0.2

Kuno wrote:
ali wrote:

look at the background in my picture

Aah, thanks - now it's clear. Honestly, i've never seen that before nor experienced myself... sad

Same issue here:
2011-05-27--1306503155_1366x768_scrot.png

How to fix it?

Offline

#108 2011-05-27 13:57:47

Unia
#! Die Hard
From: The Netherlands
Registered: 2010-07-17
Posts: 3,114

Re: OBLogout - replacement logout script for Openbox - Version 0.2

I think you need to have compositing on. Do you have it off?


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
      Github || Deviantart

Offline

#109 2011-05-27 14:05:11

bartp
Member
From: London
Registered: 2011-05-13
Posts: 28

Re: OBLogout - replacement logout script for Openbox - Version 0.2

No, I didn't have it on, turning it on fixed the issue.

Thanks a lot.

Offline

#110 2012-01-02 08:52:42

shauder
New Member
Registered: 2012-01-02
Posts: 5

Re: OBLogout - replacement logout script for Openbox - Version 0.2

Is there any way when in dual monitors to have it center on one monitor instead of centered between both?

Offline

#111 2012-01-02 13:30:34

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 9,047

Re: OBLogout - replacement logout script for Openbox - Version 0.2

^ I think that may have something to do with tint2 and strut policies.


while ( ! ( succeed = try() ) );
We've earned a reputation as a nice, friendly community; please help us keep it that way.

Offline

#112 2012-01-02 21:56:36

shauder
New Member
Registered: 2012-01-02
Posts: 5

Re: OBLogout - replacement logout script for Openbox - Version 0.2

pvsage wrote:

^ I think that may have something to do with tint2 and strut policies.

What do you mean?  I need to center it on one monitor, not across both.

logout.png

Last edited by shauder (2012-01-02 21:56:49)

Offline

#113 2012-01-02 23:00:12

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 9,047

Re: OBLogout - replacement logout script for Openbox - Version 0.2

Oh, that's different than the issues we've had with tint2 and application window placement in the past.  I'm not sure how you'd fix this particular issue; I don't know the code for OBLogout & don't use it.  You may be able to set an application rule for it in rc.xml, specifying it starts on the first monitor.


while ( ! ( succeed = try() ) );
We've earned a reputation as a nice, friendly community; please help us keep it that way.

Offline

#114 2012-01-02 23:20:36

shauder
New Member
Registered: 2012-01-02
Posts: 5

Re: OBLogout - replacement logout script for Openbox - Version 0.2

Yeah I am not sure either, I tried editing some of the python code and rebuilding it but I had no luck =/

Offline

#115 2012-01-02 23:20:37

shauder
New Member
Registered: 2012-01-02
Posts: 5

Re: OBLogout - replacement logout script for Openbox - Version 0.2

Yeah I am not sure either, I tried editing some of the python code and rebuilding it but I had no luck =/

Offline

#116 2012-01-03 00:02:34

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 9,047

Re: OBLogout - replacement logout script for Openbox - Version 0.2

Try adding this to the applications section in rc.xml:

  <application name="oblogout">
    <position>
      <x>center</x>
      <y>center</y>
      <monitor>1</monitor>
      # specifies the monitor in a xinerama setup.
      # 1 is the first head, or 'mouse' for wherever the mouse is
    </position>
  </application>

Not sure about the application name because, as I said, I don't use OBLogout.  Probably best to put this right above

  </applications>
</openbox_config>

at the end of rc.xml.


while ( ! ( succeed = try() ) );
We've earned a reputation as a nice, friendly community; please help us keep it that way.

Offline

#117 2012-01-03 00:33:21

shauder
New Member
Registered: 2012-01-02
Posts: 5

Re: OBLogout - replacement logout script for Openbox - Version 0.2

pvsage wrote:

Try adding this to the applications section in rc.xml:

  <application name="oblogout">
    <position>
      <x>center</x>
      <y>center</y>
      <monitor>1</monitor>
      # specifies the monitor in a xinerama setup.
      # 1 is the first head, or 'mouse' for wherever the mouse is
    </position>
  </application>

Not sure about the application name because, as I said, I don't use OBLogout.  Probably best to put this right above

  </applications>
</openbox_config>

at the end of rc.xml.

TY for taking the time to help, I was able to accomplish what I wanted to do by using this,

  <application name="oblogout">
    <position>
      <x>left</x>
      <y>center</y>
      <monitor>0</monitor>
      # specifies the monitor in a xinerama setup.
      # 1 is the first head, or 'mouse' for wherever the mouse is
    </position>
  </application>

Offline

#118 2012-03-17 14:34:37

madwoollything
#! Member
Registered: 2009-06-29
Posts: 51

Re: OBLogout - replacement logout script for Openbox - Version 0.2

I've just downloaded oblogout_0.2-1-0ubuntu2_all.deb and installed using Gdebi.

I tried to find the README file that is referred to in the early posts ..... not sure I'm looking in the right place.
When I go to log out I'm still getting the original logout dialogue and oblogout does not appear to work as shown in the screenshots.

What am I doing wrong ..... I'm guessing it is something to do Statler now using cb-exit rather than openbox-logout??

SORTED ..... just replaced cb-exit in menu with oblogout

Last edited by madwoollything (2012-03-17 14:40:10)

Offline

#119 2012-10-30 12:02:35

madwoollything
#! Member
Registered: 2009-06-29
Posts: 51

Re: OBLogout - replacement logout script for Openbox - Version 0.2

I've just been playing around with Madbox 12.04 and have been configuring the openbox menu.

One thing which has me baffled is how to launch the logout script in Madbox.
(The LXDE menu is not simple to understand or I would just copy the command from the existing LXDE menu).

I've tried oblogout which does not work. I then used /usr/share/oblogout and that gives me a permissions error unless I'm root.

How do you set up a command in the menu that will launch oblogout for an ordinary user?
(I don't want to just change the permissions on the oblogout script as this seems to be not he best solution)

Anyone any ideas what I could try?

ANSWER: /usr/share/oblogout/oblogout

Last edited by madwoollything (2012-10-30 12:36:44)

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.

Debian Logo