From 90dd89b7d2eb0486512a2b7a22dcbb457f64bea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20L=C3=BCbbemeier?= Date: Tue, 22 Dec 2020 16:47:50 +0100 Subject: [PATCH] Add options to isolate monitors and hide empty spaces --- Settings.ui | 80 ++++++++++++++++++ prefs.js | 16 ++++ schemas/gschemas.compiled | Bin 6368 -> 6488 bytes ....shell.extensions.org-scrollwm.gschema.xml | 10 +++ settings.js | 3 +- tiling.js | 26 ++++-- 6 files changed, 126 insertions(+), 9 deletions(-) diff --git a/Settings.ui b/Settings.ui index 80f805e94..746a9e446 100644 --- a/Settings.ui +++ b/Settings.ui @@ -644,6 +644,86 @@ + + + True + True + + + True + False + 12 + 12 + 6 + 6 + 32 + + + True + False + True + Isolate monitors when switching workspaces + 0 + + + 0 + 0 + + + + + True + True + + + 1 + 0 + + + + + + + + + True + True + + + True + False + 12 + 12 + 6 + 6 + 32 + + + True + False + True + Show empty workspaces when switching workspaces + 0 + + + 0 + 0 + + + + + True + True + + + 1 + 0 + + + + + + diff --git a/prefs.js b/prefs.js index 96fca540f..535414ab7 100644 --- a/prefs.js +++ b/prefs.js @@ -157,6 +157,22 @@ class SettingsWidget { state); }); + let isolateMonitors = this.builder.get_object('isolate-monitors'); + isolateMonitors.state = + this._settings.get_boolean('isolate-monitors'); + isolateMonitors.connect('state-set', (obj, state) => { + this._settings.set_boolean('isolate-monitors', + state); + }); + + let showEmptySpaces = this.builder.get_object('show-empty-spaces'); + showEmptySpaces.state = + this._settings.get_boolean('show-empty-spaces'); + showEmptySpaces.connect('state-set', (obj, state) => { + this._settings.set_boolean('show-empty-spaces', + state); + }); + // Workspaces diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index 57d82b90df73321294e47216ed0b93916231ab3f..3834e9b17c9b6d317cf49050aa50b3f008de6293 100644 GIT binary patch delta 1542 zcmYjRTS!z<6g`^LL&w*hhofc=WH4pdN(+qeK~zXsNF_)aIL=(1i!*bFd++!Na|)6I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oZg50BlHtEbD?~SIej&9zG)M%AH2#iZ_@Jf6Llio0dBN@dcqF+AZ|!NQ($4+>ACG0 zXaTGU54bpyw5b%*lI=_`@1%)^Ai^iHpv9rX3+=!EV7 zqxa&y%<0|8d!Pw07ccB%PVYf}7}|idQT=1%D06!5=w|3v@VKUPEpvLl&>rZ1knf+I zm}3VoLYxSC3_Q5Ct)4kOZy1E$2II$$SMdPSS0H}~{Q&-*8~%sm>A4fL&@Vu??zWiI z^F^27aMXYo!|ff&cNH&q!%Bodfxz`=fAR+UD&$+CJneSQ%ozFsX~rDWN@D<8OR>Ff zzjTr9QM(974_L{hm4n2xws47XuX>}cQjLL*kkxNUX~qpb zVL5utl4(P7-r|@^ZwRLYqa*lb4dD=#N}?Q|B~T5p^`){|43Cu-8(z9tQYZQL<>As+rGt+Ubpf8#!K23zph&rP+ zaGif?4W67O589b%%)lCwmbBH7Z@3LhbIe#Ysi&f{&rIvRmg88d`RTDNGm^FOMake the top bar follow the focused monitor + + false + Isolate monitors when switching workspaces + + + + true + Show empty workspaces when switching workspaces + + 0.25 Duration of animations in seconds diff --git a/settings.js b/settings.js index 31187dfe1..61c773ad3 100644 --- a/settings.js +++ b/settings.js @@ -34,7 +34,8 @@ var prefs = {}; ['window-gap', 'vertical-margin', 'vertical-margin-bottom', 'horizontal-margin', 'workspace-colors', 'default-background', 'animation-time', 'use-workspace-name', 'pressure-barrier', 'default-show-top-bar', 'swipe-sensitivity', 'swipe-friction', - 'cycle-width-steps', 'cycle-height-steps', 'topbar-follow-focus'] + 'cycle-width-steps', 'cycle-height-steps', 'topbar-follow-focus', + 'isolate-monitors', 'show-empty-spaces'] .forEach((k) => setState(null, k)); function setVerticalMargin() { diff --git a/tiling.js b/tiling.js index 093f38a13..43c3fc1d1 100644 --- a/tiling.js +++ b/tiling.js @@ -1776,9 +1776,7 @@ class Spaces extends Map { TopBar.fixTopBar(); const scale = 0.9; let space = this.spaceOf(workspaceManager.get_active_workspace()); - let mru = [...this.stack]; - this.monitors.forEach(space => mru.splice(mru.indexOf(space), 1)); - mru = [space, ...mru]; + let mru = this._getMru(); if (Main.panel.statusArea.appMenu) Main.panel.statusArea.appMenu.container.hide(); @@ -1848,6 +1846,22 @@ class Spaces extends Map { } } + _getMru() { + let mru = [...this.stack]; + let activeSpace = this.spaceOf(workspaceManager.get_active_workspace()); + if (prefs.isolate_monitors) { + mru = mru.filter( + (space) => space !== activeSpace && space.monitor === activeSpace.monitor, + ); + } else { + this.monitors.forEach((space) => mru.splice(mru.indexOf(space), 1)); + } + if (!prefs.show_empty_spaces) { + mru = mru.filter((space) => space.length > 0); + } + return [activeSpace, ...mru]; + } + selectStackSpace(direction, move) { // if in sequence preview do not run stack preview @@ -1856,11 +1870,7 @@ class Spaces extends Map { } const scale = 0.9; - let space = this.spaceOf(workspaceManager.get_active_workspace()); - let mru = [...this.stack]; - - this.monitors.forEach(space => mru.splice(mru.indexOf(space), 1)); - mru = [space, ...mru]; + let mru = this._getMru() if (!inPreview) { this._initWorkspaceStack();