Create simple Space abstraction

Also move full spaces init to `enable`.
This commit is contained in:
Tor Hedin Brønner
2017-09-21 15:18:43 +02:00
parent 3246577447
commit 646a8b7bba
2 changed files with 15 additions and 4 deletions
+1
View File
@@ -28,6 +28,7 @@ function enable() {
// Hook up existing workspaces
for (let i=0; i < global.screen.n_workspaces; i++) {
let workspace = global.screen.get_workspace_by_index(i)
Tiling.spaces[i] = Space(workspace);
debug("workspace", workspace)
workspace.connect("window-added", dynamic_function_ref("add_handler"))
workspace.connect("window-removed", dynamic_function_ref("remove_handler"));
+14 -4
View File
@@ -29,14 +29,24 @@ panelBox.connect('show', () => {
});
});
Space = (workspace) => {
// Simplest way to get a straight array interface
let space = [];
space.workspace = workspace;
space.selectedWindow = null;
space.moving = false;
space.leftStack = 0;
space.rightStack = 0;
return space;
}
panelBox.connect('hide', () => {
panelBox.y = - panelBox.height;
});
spaces = []
for (let i=0; i < global.screen.n_workspaces; i++) {
spaces[i] = []
}
const spaces = []
window.spaces = spaces;
debug_all = true; // Consider the default value in `debug_filter` to be true
debug_filter = { "#preview": false };