diff --git a/hrafn.conf b/hrafn.conf index de5e15f..3e59d6b 100644 --- a/hrafn.conf +++ b/hrafn.conf @@ -3,4 +3,5 @@ debug=0 entries=20 refreshtime=5 trayicon=1 +taskbar_when_minimized=0 dbfile=~/.hrafn.db diff --git a/hrafn.py b/hrafn.py index 53de52f..4cd0c3b 100755 --- a/hrafn.py +++ b/hrafn.py @@ -29,8 +29,13 @@ class Hrafn(): if config.get('global', 'trayicon') == '1': self.use_trayicon = True + if config.get('global', 'taskbar_when_minimized') == '1': + self.taskbar_min = True + else: + self.taskbar_min = False else: self.use_trayicon = False + self.taskbar_min = True # Init the glade stuff here, so we don't have a race condition with # the lists-ready signal @@ -120,9 +125,10 @@ class Hrafn(): self.tray_icon.connect('activate', self.on_tray_icon_clicked) self.tray_icon.connect('popup-menu', self.on_tray_icon_popup) self.tray_menu = gtk.Menu() - quit_item = gtk.MenuItem(gtk.STOCK_QUIT) + quit_item = gtk.ImageMenuItem(gtk.STOCK_QUIT) quit_item.connect('activate', self.gtk_main_quit) - self.tray_menu.attach(quit_item, 0, 1, 0, 1) + self.tray_menu.append(quit_item) + quit_item.show() # Set the account label self.update_account_label() @@ -574,15 +580,18 @@ class Hrafn(): def on_tray_icon_popup(self, icon, button, activate_time): - self.tray_menu.popup(None, None, gtk.status_icon_position_menu, button, activate_time, self.tray_icon) + self.tray_menu.popup(None, None, gtk.status_icon_position_menu, button, activate_time, icon) def on_window_state_changed(self, window, event): if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED: if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED: self.minimized = True + if not self.taskbar_min: + self.window.set_property('skip-taskbar-hint', True) else: self.minimized = False + self.window.set_property('skip-taskbar-hint', False) def _check_config(self, config, config_file): @@ -599,8 +608,11 @@ class Hrafn(): if not config.has_option('global', 'trayicon'): config.set('global', 'trayicon', '1') new_data = True + if not config.has_option('global', 'taskbar_when_minimized'): + config.set('global', 'taskbar_when_minimized', '0') + new_data = True if not config.has_option('global', 'debug'): - config.set('global', 'trayicon', '0') + config.set('global', 'debug', '0') new_data = True if not config.has_option('global', 'dbfile'): config.set('global', 'dbfile', '~/.hrafn.db') @@ -623,6 +635,7 @@ parser.add_option('-c' ,'--config', dest="filename", default="~/.hrafn.conf", he parser.add_option('-n' ,'--no-resize', dest="resize", action='store_false', default=True, help="use the default window size instead of the size from the last session") (options, args) = parser.parse_args() +gtk.window_set_default_icon_from_file('ui/icon.svg') my_twitter = Hrafn(options.filename, options.resize) gtk.gdk.threads_init()