(extension)
| 96 | let workspaceSettings; |
| 97 | export let inGrab; |
| 98 | export function enable(extension) { |
| 99 | inGrab = false; |
| 100 | |
| 101 | displayConfig = new Utils.DisplayConfig(); |
| 102 | saveState = saveState ?? new SaveState(); |
| 103 | |
| 104 | gsettings = extension.getSettings(); |
| 105 | backgroundSettings = new Gio.Settings({ |
| 106 | schema_id: 'org.gnome.desktop.background', |
| 107 | }); |
| 108 | interfaceSettings = new Gio.Settings({ |
| 109 | schema_id: "org.gnome.desktop.interface", |
| 110 | }); |
| 111 | |
| 112 | signals = new Utils.Signals(); |
| 113 | grabSignals = new Utils.Signals(); |
| 114 | |
| 115 | workspaceChangeTimeouts = []; // init array to hold timeouts |
| 116 | |
| 117 | // setup actions on gap changes |
| 118 | let marginsGapChanged = () => { |
| 119 | Utils.timeout_remove(timerId); |
| 120 | timerId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, () => { |
| 121 | spaces.mru().forEach(space => { |
| 122 | space.layout(true, { |
| 123 | callback: () => { |
| 124 | const selected = spaces.activeSpace?.selectedWindow; |
| 125 | allocateClone(selected); |
| 126 | }, |
| 127 | }); |
| 128 | }); |
| 129 | timerId = null; |
| 130 | return false; // on return false destroys timeout |
| 131 | }); |
| 132 | }; |
| 133 | gsettings.connect('changed::vertical-margin', marginsGapChanged); |
| 134 | gsettings.connect('changed::vertical-margin-bottom', marginsGapChanged); |
| 135 | gsettings.connect('changed::window-gap', marginsGapChanged); |
| 136 | const changedBorder = () => { |
| 137 | spaces.forEach(s => { |
| 138 | Settings.prefs.selection_border_size <= 0 ? s.hideSelection() : s.showSelection(); |
| 139 | if (s.selectedWindow) { |
| 140 | allocateClone(s.selectedWindow); |
| 141 | } |
| 142 | }); |
| 143 | }; |
| 144 | gsettings.connect('changed::selection-border-size', changedBorder); |
| 145 | gsettings.connect('changed::selection-border-radius-top', changedBorder); |
| 146 | gsettings.connect('changed::selection-border-radius-bottom', changedBorder); |
| 147 | |
| 148 | backgroundGroup = Main.layoutManager._backgroundGroup; |
| 149 | |
| 150 | workspaceSettings = new WorkspaceSettings(extension); |
| 151 | spaces = new Spaces(); |
| 152 | let initWorkspaces = () => { |
| 153 | try { |
| 154 | spaces.init(); |
| 155 | } catch (e) { |
nothing calls this directly
no test coverage detected