From 22f3af96b94cecc357a0613a5769f0dc9e5dc903 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Sat, 3 Dec 2016 17:00:18 +0100 Subject: [PATCH] fix(tray): Handle visibility change Ref #211 --- src/x11/tray.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/x11/tray.cpp b/src/x11/tray.cpp index d7c10249..83e51290 100644 --- a/src/x11/tray.cpp +++ b/src/x11/tray.cpp @@ -165,6 +165,9 @@ const tray_settings tray_manager::settings() const { // {{{ void tray_manager::bootstrap(tray_settings settings) { // {{{ m_opts = settings; query_atom(); + + // Listen for visibility change events on the bar window + g_signals::bar::visibility_change = bind(&tray_manager::bar_visibility_change, this, placeholders::_1); } // }}} /** @@ -191,11 +194,6 @@ void tray_manager::activate() { // {{{ return; } - // Listen for visibility change events on the bar window - if (!m_restacked && !g_signals::bar::visibility_change) { - g_signals::bar::visibility_change = bind(&tray_manager::bar_visibility_change, this, std::placeholders::_1); - } - // Attempt to get control of the systray selection then // notify clients waiting for a manager. acquire_selection(); @@ -779,7 +777,7 @@ void tray_manager::process_docking_request(xcb_window_t win) { // {{{ * toggle the tray window whenever the visibility of the bar window changes. */ void tray_manager::bar_visibility_change(bool state) { // {{{ - if (m_hidden == !state) { + if (!m_activated || m_restacked || m_hidden == !state) { return; }