fix for systray visibility (gihub #14)
This commit is contained in:
parent
2e51380be5
commit
9b7a920e0d
|
@ -108,6 +108,8 @@ def _run(args):
|
|||
GObject.timeout_add(3000, check_for_listener)
|
||||
|
||||
GObject.timeout_add(10, check_for_listener, True)
|
||||
if icon:
|
||||
GObject.timeout_add(1000, ui.status_icon.check_systray, icon, window)
|
||||
Gtk.main()
|
||||
|
||||
if listener[0]:
|
||||
|
|
|
@ -283,6 +283,7 @@ def create(title, name, max_devices, systray=False):
|
|||
return True
|
||||
|
||||
def _set_has_systray(w, systray):
|
||||
# print ("set has systray", systray, w._has_systray)
|
||||
if systray != w._has_systray:
|
||||
w._has_systray = systray
|
||||
if systray:
|
||||
|
|
|
@ -38,18 +38,24 @@ def create(window, menu_actions=None):
|
|||
lambda icon, button, time, menu:
|
||||
menu.popup(None, None, icon.position_menu, icon, button, time),
|
||||
menu)
|
||||
return icon
|
||||
|
||||
|
||||
def check_systray(icon, window):
|
||||
# use size-changed to detect if the systray is available or not
|
||||
def _size_changed(i, size, w):
|
||||
import logging
|
||||
logging.info("size-chagend %s %s", size, w)
|
||||
def _check_systray(i2, w2):
|
||||
logging.info("check_systray %s %s", i2.is_embedded(), i2.get_visible())
|
||||
w2.set_has_systray(i2.is_embedded() and i2.get_visible())
|
||||
# first guess
|
||||
GObject.timeout_add(250, _check_systray, i, w)
|
||||
# just to make sure...
|
||||
GObject.timeout_add(1000, _check_systray, i, w)
|
||||
icon.connect('size-changed', _size_changed, window)
|
||||
# GObject.timeout_add(1000, _check_systray, i, w)
|
||||
|
||||
return icon
|
||||
_size_changed(icon, None, window)
|
||||
icon.connect('size-changed', _size_changed, window)
|
||||
|
||||
|
||||
_PIXMAPS = {}
|
||||
|
|
Loading…
Reference in New Issue