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