From 24b67ccab3f0d1bc216f39fd4dc24c561fcf56ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Thu, 21 Sep 2017 00:11:25 +0200 Subject: [PATCH] Fix statusbar regression Main.layoutManager.panelBox is the correct way to reference the panel when checking if it's visible or not. --- extension.js | 16 ++-------------- tiling.js | 17 +++++------------ 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/extension.js b/extension.js index 850c5f9..f42f96f 100644 --- a/extension.js +++ b/extension.js @@ -2,6 +2,7 @@ const Extension = imports.misc.extensionUtils.getCurrentExtension(); const Tiling = Extension.imports.tiling; const Gio = imports.gi.Gio; const Meta = imports.gi.Meta; +const Main = imports.ui.main; function init() { // Hook up new workspaces @@ -11,20 +12,7 @@ function init() { function enable() { debug('enable') - - window.statusbar = undefined; - - statusbar = undefined; - global.stage.get_first_child().get_children().forEach((actor) => { - if ("panelBox" == actor.name) { - statusbar = actor - } - }) - // The above doesn't work, we need to find a signal to get the statusbar out - // In the meantime just set the height manually - statusbar_height = 41; - - global.screen.connect("workspace-added", dynamic_function_ref('workspace_added')) + global.screen.connect("workspace-added", dynamic_function_ref('workspace_added')); global.screen.connect("workspace-removed", dynamic_function_ref('workspace_removed')); global.display.connect('window-created', dynamic_function_ref('window_created')); diff --git a/tiling.js b/tiling.js index c911a06..99acfeb 100644 --- a/tiling.js +++ b/tiling.js @@ -17,14 +17,7 @@ margin_lr = 20 // How much the stack should protrude from the side stack_margin = 75 -// statusbar = undefined -// global.stage.get_first_child().get_children().forEach((actor) => { -// if ("panelBox" == actor.name) { -// statusbar = actor -// } -// }) -// The above is run too early -statusbar_height = 41 +statusbar_height = Main.layoutManager.panelBox.height; workspaces = [] for (let i=0; i < global.screen.n_workspaces; i++) { @@ -143,9 +136,9 @@ ensure_viewport = (meta_window, force) => { // Hack to ensure the statusbar is visible while there's a fullscreen // windows in the workspace. TODO fade in/out in some way. - // if (!statusbar.visible) { - // statusbar.visible = true; - // } + if (!Main.layoutManager.panelBox.visible) { + Main.layoutManager.panelBox.visible = true; + } let x = frame.x; let y = statusbar_height + margin_tb; @@ -156,7 +149,7 @@ ensure_viewport = (meta_window, force) => { if (meta_window.fullscreen) { // Fullscreen takes highest priority x = 0, y = 0; - // statusbar.visible = false; + Main.layoutManager.panelBox.visible = false; } else if (required_width <= global.screen_width) { let leftovers = global.screen_width - required_width;