optionally attach notification to systray. fixes #3123
This commit is contained in:
parent
377d8e9081
commit
7590a57f66
|
@ -249,6 +249,7 @@ class Config:
|
|||
'use_latex': [opt_bool, False, _('If True, Gajim will convert string between $$ and $$ to an image using dvips and convert before insterting it in chat window.')],
|
||||
'change_status_window_timeout': [opt_int, 15, _('Time of inactivity needed before the change status window closes down.')],
|
||||
'max_conversation_lines': [opt_int, 500, _('Maximum number of lines that are printed in conversations. Oldest lines are cleared.')],
|
||||
'attach_notifications_to_systray': [opt_bool, False, _('If True, notification windows from notification-daemon will be attached to systray icon.')],
|
||||
}
|
||||
|
||||
__options_per_key = {
|
||||
|
|
|
@ -503,8 +503,17 @@ class DesktopNotification:
|
|||
except AttributeError:
|
||||
version = [0, 3, 1] # we're actually dealing with the newer version
|
||||
if version > [0, 3]:
|
||||
if version >= [0, 3, 2]:
|
||||
if gajim.interface.systray_enabled and \
|
||||
gajim.config.get('attach_notifications_to_systray'):
|
||||
x, y = gajim.interface.systray.img_tray.window.get_position()
|
||||
x_, y_, width, height, depth = \
|
||||
gajim.interface.systray.img_tray.window.get_geometry()
|
||||
pos_x = x + (width / 2)
|
||||
pos_y = y + (height / 2)
|
||||
hints = {'x': pos_x, 'y': pos_y}
|
||||
else:
|
||||
hints = {}
|
||||
if version >= [0, 3, 2]:
|
||||
hints['urgency'] = dbus.Byte(0) # Low Urgency
|
||||
hints['category'] = dbus.String(ntype)
|
||||
self.notif.Notify(
|
||||
|
@ -526,7 +535,7 @@ class DesktopNotification:
|
|||
dbus.String(self.title),
|
||||
dbus.String(self.text),
|
||||
dbus.String(''),
|
||||
{},
|
||||
hints,
|
||||
dbus.UInt32(timeout*1000),
|
||||
reply_handler=self.attach_by_id,
|
||||
error_handler=self.notify_another_way)
|
||||
|
|
Loading…
Reference in New Issue