From c98fe8556e276331ddfe7961bdf9d43515bf5b7a Mon Sep 17 00:00:00 2001 From: Simon Epstein Date: Thu, 2 Jul 2020 21:49:35 +0100 Subject: [PATCH] Avoid moving the top bar when it's stuck on primary With `topbar-follow-focus` set to false we still moved the topbar (to its own position). This caused issues with dash-to-panel with panels on all monitors. So only move the topbar to the primary monitor when `topbar-follow-focus` is toggled off by the user. There's still some issues with dash-to-panel and the workarea on secondary monitors, but this makes it at least somewhat usable. Co-authored-by: Simon Epstein --- topbar.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/topbar.js b/topbar.js index a08bd3e..b435bfc 100644 --- a/topbar.js +++ b/topbar.js @@ -539,13 +539,15 @@ function enable () { signals.connect(Settings.settings, 'changed::topbar-follow-focus', (settings, key) => { let monitors = Tiling.spaces.monitors; + if (!settings.prefs.topbar_follow_focus) { + moveTopBarTo(Main.layoutManager.primaryMonitor); + } let to = setMonitor(Main.layoutManager.focusMonitor); let space = monitors.get(to); updateWorkspaceIndicator(space.workspace.index()); for (let [workspace, space] of Tiling.spaces) { space.layout(); } - }); signals.connect(panelBox, 'show', () => { @@ -622,8 +624,16 @@ function setWorkspaceName (name) { } function setMonitor(monitor) { - if (!prefs.topbar_follow_focus) - monitor = Main.layoutManager.primaryMonitor; + if (prefs.topbar_follow_focus) { + moveTopBarTo(monitor); + } else { + monitor = Main.layoutManager.primaryMonitor + } + panelMonitor = monitor; + return monitor; +} + +function moveTopBarTo(monitor) { let panelBox = Main.layoutManager.panelBox; panelMonitor = monitor; panelBox.set_position(monitor.x, monitor.y);