Fix statusbar regression

Main.layoutManager.panelBox is the correct way to reference the panel when
checking if it's visible or not.
This commit is contained in:
Tor Hedin Brønner
2017-09-21 00:38:29 +02:00
parent b6cfd0eefd
commit 24b67ccab3
2 changed files with 7 additions and 26 deletions
+2 -14
View File
@@ -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'));
+5 -12
View File
@@ -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;