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 <simon.epstein@67bricks.com>
This commit is contained in:
Simon Epstein
2020-07-02 22:49:35 +02:00
committed by GitHub
co-authored by Simon Epstein
parent ac54a572db
commit c98fe8556e
+13 -3
View File
@@ -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);