Codebase list gnome-shell-extension-autohidetopbar / ae0dba2
New upstream version 20200627 Tobias Frost 3 years ago
10 changed file(s) with 417 addition(s) and 439 deletion(s). Raw diff Collapse all Expand all
55
66 all: hidetopbar.zip
77
8 schemas:
9 mkdir ./schemas/
10 glib-compile-schemas --strict --targetdir=./schemas/ .
8 schemas/gschemas.compiled:
9 glib-compile-schemas --strict ./schemas/
1110
12 hidetopbar.zip: schemas
11 hidetopbar.zip: schemas/gschemas.compiled
1312 zip hidetopbar.zip -r $(JS_FILES) metadata.json locale/*/*/*.mo schemas
1413
1514 clean:
16 rm -rf hidetopbar.zip schemas
15 rm -rf hidetopbar.zip schemas/gschemas.compiled
77 Maintained by Thomas Vogt.
88 With contributions by Philip Witte and Mathieu Lutfy.
99
10 Installing from gnome.org:
11 --------------------------
12
13 The recommended way of installing Hide Top Bar is via the official builds on
14 [gnome.org/.../hide-top-bar/](https://extensions.gnome.org/extension/545/hide-top-bar/).
15
16 If you're installing via a Chrome browser, make sure you read the
17 [GNOME Shell integration for Chrome Installation
18 Guide](https://wiki.gnome.org/Projects/GnomeShellIntegrationForChrome/Installation).
19
1020 Local installation:
1121 -------------------
1222
13 Compile the gsettings schema by running
14
15 make schemas
16
17 Install this in your extensions directory
18
19 ~/.local/share/gnome-shell/extensions/
20
21 and restart GNOME Shell. Example:
23 If you insist on installing from source, check out the source code into your local extensions directory, compile by running `make`, install and restart GNOME Shell. Example:
2224
2325 cd ~/.local/share/gnome-shell/extensions/
2426 git clone https://github.com/mlutfy/hidetopbar.git hidetopbar@mathieu.bidon.ca
2527 cd hidetopbar@mathieu.bidon.ca
26 make schemas
28 make
2729 cd ..
2830 gnome-extensions enable hidetopbar@mathieu.bidon.ca
2931 gnome-shell --replace &
3032
3133 The last commandline restarts GNOME Shell.
3234
33 You can also manage extensions from https://extensions.gnome.org/local/
35 Updating the language strings:
36 ------------------------------
3437
35 Installing from gnome.org:
36 --------------------------
38 Whenever you notice that there are localizable strings in Hide Top Bar that are not
39 covered by the strings in `./locale/`, you can regenerate the `*.pot`-file using the
40 following command:
3741
38 You can install the extension directly from
39 [gnome.org/.../hide-top-bar/](https://extensions.gnome.org/extension/545/hide-top-bar/).
40
41 If you're installing via a Chrome browser, make sure you read the
42 [GNOME Shell integration for Chrome Installation
43 Guide](https://wiki.gnome.org/Projects/GnomeShellIntegrationForChrome/Installation).
42 xgettext --output=./locale/hidetopbar.pot --language=JavaScript *.js
4443
4544 License:
4645 --------
4746
48 Copyright (c) 2013-2017 Thomas Vogt.
47 Copyright (c) 2013-2020 Thomas Vogt.
4948
5049 Copyright (c) 2012-2013 Mathieu Lutfy.
5150
77 */
88
99 const GLib = imports.gi.GLib;
10 const Lang = imports.lang;
11 const Mainloop = imports.mainloop;
1210 const Meta = imports.gi.Meta;
1311 const Shell = imports.gi.Shell;
1412
1917 const Convenience = Me.imports.convenience;
2018
2119 // A good compromise between reactivity and efficiency; to be tuned.
22 const INTELLIHIDE_CHECK_INTERVAL = 200;
20 const INTELLIHIDE_CHECK_INTERVAL = 100;
2321
2422 const OverlapStatus = {
2523 UNDEFINED: -1,
3634 // List of windows type taken into account. Order is important (keep the original
3735 // enum order).
3836 const handledWindowTypes = [
39 Meta.WindowType.NORMAL,
40 Meta.WindowType.DOCK,
41 Meta.WindowType.DIALOG,
42 Meta.WindowType.MODAL_DIALOG,
43 Meta.WindowType.TOOLBAR,
44 Meta.WindowType.MENU,
45 Meta.WindowType.UTILITY,
46 Meta.WindowType.SPLASHSCREEN
37 Meta.WindowType.NORMAL,
38 Meta.WindowType.DOCK,
39 Meta.WindowType.DIALOG,
40 Meta.WindowType.MODAL_DIALOG,
41 Meta.WindowType.TOOLBAR,
42 Meta.WindowType.MENU,
43 Meta.WindowType.UTILITY,
44 Meta.WindowType.SPLASHSCREEN
4745 ];
4846
49 /*
47 /**
5048 * A rough and ugly implementation of the intellihide behaviour.
5149 * Intallihide object: emit 'status-changed' signal when the overlap of windows
5250 * with the provided targetBoxClutter.ActorBox changes;
53 *
54 */
55
56 var intellihide = new Lang.Class({
57 Name: 'intellihide',
58
59 _init: function(settings, monitorIndex) {
60
51 */
52 var Intellihide = class HideTopBar_Intellihide {
53
54 constructor(settings, monitorIndex) {
6155 // Load settings
6256 this._settings = settings;
6357 this._monitorIndex = monitorIndex;
7367
7468 this._checkOverlapTimeoutContinue = false;
7569 this._checkOverlapTimeoutId = 0;
76
77 let stackingManager;
78 if (global.screen)
79 stackingManager = global.screen; // mutter < 3.29
80 else
81 stackingManager = global.display; // mutter >= 3.29
82
83 let monitorManager;
84 if (global.screen)
85 monitorManager = global.screen; // mutter < 3.29
86 else
87 monitorManager = Main.layoutManager; // mutter >= 3.29
70
71 this._trackedWindows = new Map();
8872
8973 // Connect global signals
9074 this._signalsHandler.add([
9175 // Listen for notification banners to appear or disappear
92 Main.messageTray.actor,
76 Main.messageTray,
9377 'show',
94 Lang.bind(this, this._checkOverlap)
95 ], [
96 Main.messageTray.actor,
78 this._checkOverlap.bind(this)
79 ], [
80 Main.messageTray,
9781 'hide',
98 Lang.bind(this, this._checkOverlap)
82 this._checkOverlap.bind(this)
9983 ], [
10084 // Add signals on windows created from now on
10185 global.display,
10286 'window-created',
103 Lang.bind(this, this._windowCreated)
87 this._windowCreated.bind(this)
10488 ], [
10589 // triggered for instance when the window list order changes,
10690 // included when the workspace is switched
107 stackingManager,
91 global.display,
10892 'restacked',
109 Lang.bind(this, this._checkOverlap)
93 this._checkOverlap.bind(this)
11094 ], [
11195 // when windows are alwasy on top, the focus window can change
11296 // without the windows being restacked. Thus monitor window focus change.
11397 this._tracker,
11498 'notify::focus-app',
115 Lang.bind(this, this._checkOverlap)
99 this._checkOverlap.bind(this)
116100 ], [
117101 // update wne monitor changes, for instance in multimonitor when monitor are attached
118 monitorManager,
102 Meta.MonitorManager.get(),
119103 'monitors-changed',
120 Lang.bind(this, this._checkOverlap )
104 this._checkOverlap.bind(this)
121105 ]);
122 },
123
124 destroy: function() {
106 }
107
108 destroy() {
125109 // Disconnect global signals
126110 this._signalsHandler.destroy();
127111
128112 // Remove residual windows signals
129113 this.disable();
130 },
131
132 enable: function() {
114 }
115
116 enable() {
133117 this._isEnabled = true;
134118 this._status = OverlapStatus.UNDEFINED;
135 global.get_window_actors().forEach(function(win) {
136 this._addWindowSignals(win.get_meta_window());
119 global.get_window_actors().forEach(function(wa) {
120 this._addWindowSignals(wa);
137121 }, this);
138122 this._doCheckOverlap();
139 },
140
141 disable: function() {
123 }
124
125 disable() {
142126 this._isEnabled = false;
143 global.get_window_actors().forEach(function(win) {
144 this._removeWindowSignals(win.get_meta_window());
145 }, this);
127
128 for (let wa of this._trackedWindows.keys()) {
129 this._removeWindowSignals(wa);
130 }
131 this._trackedWindows.clear();
146132
147133 if (this._checkOverlapTimeoutId > 0) {
148 Mainloop.source_remove(this._checkOverlapTimeoutId);
134 GLib.source_remove(this._checkOverlapTimeoutId);
149135 this._checkOverlapTimeoutId = 0;
150136 }
151 },
152
153 _windowCreated: function(display, meta_win) {
154 this._addWindowSignals(meta_win);
155 },
156
157 _addWindowSignals: function(meta_win) {
158 if (!meta_win || !this._handledWindow(meta_win))
137 }
138
139 _windowCreated(display, metaWindow) {
140 this._addWindowSignals(metaWindow.get_compositor_private());
141 }
142
143 _addWindowSignals(wa) {
144 if (!this._handledWindow(wa))
159145 return;
160
161 meta_win.dtd_onPositionChanged = meta_win.connect('position-changed', Lang.bind(this, this._checkOverlap, meta_win));
162
163 meta_win.dtd_onSizeChanged = meta_win.connect('size-changed', Lang.bind(this, this._checkOverlap, meta_win));
164 },
165
166 _removeWindowSignals: function(meta_win) {
167 if (meta_win && meta_win.dtd_onSizeChanged) {
168 meta_win.disconnect(meta_win.dtd_onSizeChanged);
169 delete meta_win.dtd_onSizeChanged;
170 }
171
172 if (meta_win && meta_win.dtd_onPositionChanged) {
173 meta_win.disconnect(meta_win.dtd_onPositionChanged);
174 delete meta_win.dtd_onPositionChanged;
175 }
176 },
177
178 updateTargetBox: function(box) {
146 let signalId = wa.connect('allocation-changed', this._checkOverlap.bind(this));
147 this._trackedWindows.set(wa, signalId);
148 wa.connect('destroy', this._removeWindowSignals.bind(this));
149 }
150
151 _removeWindowSignals(wa) {
152 if (this._trackedWindows.get(wa)) {
153 wa.disconnect(this._trackedWindows.get(wa));
154 this._trackedWindows.delete(wa);
155 }
156 }
157
158 updateTargetBox(box) {
179159 this._targetBox = box;
180160 this._checkOverlap();
181 },
182
183 forceUpdate: function() {
161 }
162
163 forceUpdate() {
184164 this._status = OverlapStatus.UNDEFINED;
185165 this._doCheckOverlap();
186 },
187
188 getOverlapStatus: function() {
166 }
167
168 getOverlapStatus() {
189169 return (this._status == OverlapStatus.TRUE);
190 },
191
192 _checkOverlap: function() {
170 }
171
172 _checkOverlap() {
193173 if (!this._isEnabled || (this._targetBox == null))
194174 return;
195175
201181
202182 this._doCheckOverlap();
203183
204 this._checkOverlapTimeoutId = Mainloop.timeout_add(INTELLIHIDE_CHECK_INTERVAL, Lang.bind(this, function() {
184 this._checkOverlapTimeoutId = GLib.timeout_add(
185 GLib.PRIORITY_DEFAULT, INTELLIHIDE_CHECK_INTERVAL, () => {
205186 this._doCheckOverlap();
206187 if (this._checkOverlapTimeoutContinue) {
207188 this._checkOverlapTimeoutContinue = false;
210191 this._checkOverlapTimeoutId = 0;
211192 return GLib.SOURCE_REMOVE;
212193 }
213 }));
214 },
215
216 _doCheckOverlap: function() {
194 });
195 }
196
197 _doCheckOverlap() {
217198
218199 if (!this._isEnabled || (this._targetBox == null))
219200 return;
232213 let topWindow = null;
233214 for (let i = windows.length - 1; i >= 0; i--) {
234215 let meta_win = windows[i].get_meta_window();
235 if (this._handledWindow(meta_win) && (meta_win.get_monitor() == this._monitorIndex)) {
216 if (this._handledWindow(windows[i]) && (meta_win.get_monitor() == this._monitorIndex)) {
236217 topWindow = meta_win;
237218 break;
238219 }
266247 }
267248
268249 // Check if notification banner overlaps
269 if (Main.messageTray.actor.visible) {
270 let rect = Main.messageTray.actor.get_allocation_box(),
250 if (Main.messageTray.visible) {
251 let rect = Main.messageTray.get_allocation_box(),
271252 test = (rect.x1 < this._targetBox.x2) &&
272253 (rect.x2 > this._targetBox.x1) &&
273254 (rect.y1 < this._targetBox.y2) &&
281262 this.emit('status-changed', this._status);
282263 }
283264
284 },
265 }
285266
286267 // Filter interesting windows to be considered for intellihide.
287268 // Consider all windows visible on the current workspace.
288269 // Optionally skip windows of other applications
289 _intellihideFilterInteresting: function(wa) {
270 _intellihideFilterInteresting(wa) {
290271 let meta_win = wa.get_meta_window();
291 if (!meta_win || !this._handledWindow(meta_win)) {
272 if (!this._handledWindow(wa))
292273 return false;
293 }
294
295 let workspaceManager;
296 if (global.screen)
297 workspaceManager = global.screen; // mutter < 3.29
298 else
299 workspaceManager = global.workspace_manager; // mutter >= 3.29
300
301 let currentWorkspace = workspaceManager.get_active_workspace_index();
274
275 let currentWorkspace = global.workspace_manager.get_active_workspace_index();
302276 let wksp = meta_win.get_workspace();
303277 let wksp_index = wksp.index();
304278
305279 // Depending on the intellihide mode, exclude non-relevent windows
306280 if (this._settings.get_boolean('enable-active-window')) {
307 // Skip windows of other apps
308 if (this._focusApp) {
309 // The DropDownTerminal extension is not an application per se
310 // so we match its window by wm class instead
311 if (meta_win.get_wm_class() == 'DropDownTerminalWindow') {
312 return true;
281 // Skip windows of other apps
282 if (this._focusApp) {
283 // The DropDownTerminal extension is not an application per se
284 // so we match its window by wm class instead
285 if (meta_win.get_wm_class() == 'DropDownTerminalWindow')
286 return true;
287
288 let currentApp = this._tracker.get_window_app(meta_win);
289 let focusWindow = global.display.get_focus_window()
290
291 // Consider half maximized windows side by side
292 // and windows which are alwayson top
293 if((currentApp != this._focusApp) && (currentApp != this._topApp)
294 && !((focusWindow && focusWindow.maximized_vertically && !focusWindow.maximized_horizontally)
295 && (meta_win.maximized_vertically && !meta_win.maximized_horizontally)
296 && meta_win.get_monitor() == focusWindow.get_monitor())
297 && !meta_win.is_above())
298 return false;
313299 }
314
315 let currentApp = this._tracker.get_window_app(meta_win);
316 let focusWindow = global.display.get_focus_window()
317
318 // Consider half maximized windows side by side
319 // and windows which are alwayson top
320 if((currentApp != this._focusApp) && (currentApp != this._topApp)
321 && !((focusWindow && focusWindow.maximized_vertically && !focusWindow.maximized_horizontally)
322 && (meta_win.maximized_vertically && !meta_win.maximized_horizontally)
323 && meta_win.get_monitor() == focusWindow.get_monitor())
324 && !meta_win.is_above()) {
325 return false;
326 }
327 }
328 }
329
330 if ( wksp_index == currentWorkspace && meta_win.showing_on_its_workspace() ) {
300 }
301
302 if ( wksp_index == currentWorkspace && meta_win.showing_on_its_workspace() )
331303 return true;
332 } else {
304 else
333305 return false;
334 }
335
336 },
306
307 }
337308
338309 // Filter windows by type
339310 // inspired by Opacify@gnome-shell.localdomain.pl
340 _handledWindow: function(metaWindow) {
311 _handledWindow(wa) {
312 let metaWindow = wa.get_meta_window();
313
314 if (!metaWindow)
315 return false;
316
341317 // The DropDownTerminal extension uses the POPUP_MENU window type hint
342318 // so we match its window by wm class instead
343319 if (metaWindow.get_wm_class() == 'DropDownTerminalWindow')
346322 let wtype = metaWindow.get_window_type();
347323 for (let i = 0; i < handledWindowTypes.length; i++) {
348324 var hwtype = handledWindowTypes[i];
349 if (hwtype == wtype) {
325 if (hwtype == wtype)
350326 return true;
351 } else if (hwtype > wtype) {
327 else if (hwtype > wtype)
352328 return false;
353 }
354329 }
355330 return false;
356331 }
357 });
358
359 Signals.addSignalMethods(intellihide.prototype);
360
332 };
333
334 Signals.addSignalMethods(Intellihide.prototype);
00 # HIDETOPBAR.
11 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
22 # This file is distributed under the same license as the PACKAGE package.
3 # David Medina <rbndavid@gmail.com>, 2017.
3 # David Medina <rbndavid@gmail.com>, 2017, 2020.
44 #
55 msgid ""
66 msgstr ""
77 "Project-Id-Version: \n"
88 "Report-Msgid-Bugs-To: \n"
9 "POT-Creation-Date: 2017-07-27 18:54+0200\n"
10 "PO-Revision-Date: 2017-07-27 19:22+0200\n"
9 "POT-Creation-Date: 2020-05-22 10:57+0200\n"
10 "PO-Revision-Date: 2020-05-27 18:51+0200\n"
11 "Last-Translator: \n"
1112 "Language-Team: \n"
13 "Language: ca\n"
1214 "MIME-Version: 1.0\n"
1315 "Content-Type: text/plain; charset=UTF-8\n"
1416 "Content-Transfer-Encoding: 8bit\n"
15 "X-Generator: Poedit 1.8.7.1\n"
16 "Last-Translator: \n"
17 "X-Generator: Poedit 2.3\n"
1718 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18 "Language: ca\n"
1919
20 #: prefs.js:26
20 #: prefs.js:39
2121 msgid "<b>Sensitivity</b>"
2222 msgstr "<b>Sensibilitat</b>"
2323
24 #: prefs.js:33
24 #: prefs.js:46
2525 msgid "Show panel when mouse approaches edge of the screen"
2626 msgstr "Mostra la barra quan el ratolí s'apropi a la vora de la pantalla."
2727
28 #: prefs.js:34
28 #: prefs.js:47
29 msgid "In the above case, also show panel when fullscreen."
30 msgstr "En el cas anterior, mostra també la barra en pantalla completa."
31
32 #: prefs.js:48
2933 msgid "Keep hot corner sensitive, even in hidden state"
30 msgstr "Mantén el cantó actiu sensible, tot i en mode ocult."
34 msgstr "Mantén el cantó actiu sensible, fins i tot en mode ocult."
3135
32 #: prefs.js:35
36 #: prefs.js:49
3337 msgid "In the above case show overview, too"
3438 msgstr "En el cas anterior, mostra també la vista general."
3539
36 #: prefs.js:61
40 #: prefs.js:74
3741 msgid "Pressure barrier's threshold."
38 msgstr "Llindar de pressió al ratolí."
42 msgstr "Llindar de la pressió "
3943
40 #: prefs.js:62
44 #: prefs.js:75
4145 msgid "Pressure barrier's timeout."
42 msgstr "Retard de la pressió."
46 msgstr "Temps d'espera de la pressió"
4347
44 #: prefs.js:92
48 #: prefs.js:104
4549 msgid "<b>Animation</b>"
4650 msgstr "<b>Animació</b>"
4751
48 #: prefs.js:99
52 #: prefs.js:111
4953 msgid "Slide animation time when entering/leaving overview."
50 msgstr "Durada de l'animació en entrar o sortir de la vista general."
54 msgstr "Durada de l'animació lliscant en entrar o sortir de la vista general:"
5155
52 #: prefs.js:100
56 #: prefs.js:112
5357 msgid "Slide animation time when mouse approaches edge of the screen."
54 msgstr "Durada de l'animació quan el ratolí s'apropi a la vora de la pantalla."
58 msgstr "Durada de l'animació quan el ratolí s'apropi a la vora de la pantalla:"
5559
56 #: prefs.js:130
60 #: prefs.js:141
5761 msgid "<b>Keyboard shortcuts</b>"
5862 msgstr "<b>Dreceres del teclat</b>"
5963
60 #: prefs.js:194
64 #: prefs.js:203
6165 msgid "Key that triggers the bar to be shown."
62 msgstr "Tecla que fa que es mostri la barra."
66 msgstr "Tecla que fa que la barra es mostri:"
6367
64 #: prefs.js:215
68 #: prefs.js:223
6569 msgid "Delay before the bar rehides after key press."
66 msgstr "Retard de l'ocultació de la barra després de prémer una tecla."
70 msgstr "Retard de la reocultació de la barra després de prémer una tecla:"
6771
68 #: prefs.js:231
72 #: prefs.js:239
6973 msgid "Pressing the shortcut again rehides the panel."
70 msgstr "Tornar a prémer la drecera fa que la barra s'oculti."
74 msgstr "Tornar a prémer la drecera torna a ocultar la barra."
7175
72 #: prefs.js:261
76 #: prefs.js:268
7377 msgid "<b>Intellihide</b>"
7478 msgstr "<b>Ocultació intel·ligent</b>"
7579
76 #: prefs.js:268
80 #: prefs.js:275
7781 msgid "Only hide panel when a window takes the space"
7882 msgstr "Oculta la barra només quan una finestra n'ocupi l'espai."
7983
80 #: prefs.js:269
84 #: prefs.js:276
8185 msgid "Only when the active window takes the space"
8286 msgstr "Oculta la barra només quan la finestra activa n'ocupi l'espai."
77 msgstr ""
88 "Project-Id-Version: PACKAGE VERSION\n"
99 "Report-Msgid-Bugs-To: \n"
10 "POT-Creation-Date: 2015-10-24 15:24+0800\n"
10 "POT-Creation-Date: 2020-05-22 10:57+0200\n"
1111 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313 "Language-Team: LANGUAGE <LL@li.org>\n"
1616 "Content-Type: text/plain; charset=CHARSET\n"
1717 "Content-Transfer-Encoding: 8bit\n"
1818
19 #: prefs.js:26
19 #: prefs.js:39
2020 msgid "<b>Sensitivity</b>"
2121 msgstr ""
2222
23 #: prefs.js:33
23 #: prefs.js:46
2424 msgid "Show panel when mouse approaches edge of the screen"
2525 msgstr ""
2626
27 #: prefs.js:34
27 #: prefs.js:47
28 msgid "In the above case, also show panel when fullscreen."
29 msgstr ""
30
31 #: prefs.js:48
2832 msgid "Keep hot corner sensitive, even in hidden state"
2933 msgstr ""
3034
31 #: prefs.js:35
35 #: prefs.js:49
3236 msgid "In the above case show overview, too"
3337 msgstr ""
3438
35 #: prefs.js:61
39 #: prefs.js:74
3640 msgid "Pressure barrier's threshold."
3741 msgstr ""
3842
39 #: prefs.js:62
43 #: prefs.js:75
4044 msgid "Pressure barrier's timeout."
4145 msgstr ""
4246
43 #: prefs.js:92
47 #: prefs.js:104
4448 msgid "<b>Animation</b>"
4549 msgstr ""
4650
47 #: prefs.js:99
51 #: prefs.js:111
4852 msgid "Slide animation time when entering/leaving overview."
4953 msgstr ""
5054
51 #: prefs.js:100
55 #: prefs.js:112
5256 msgid "Slide animation time when mouse approaches edge of the screen."
5357 msgstr ""
5458
55 #: prefs.js:130
59 #: prefs.js:141
5660 msgid "<b>Keyboard shortcuts</b>"
5761 msgstr ""
5862
59 #: prefs.js:194
63 #: prefs.js:203
6064 msgid "Key that triggers the bar to be shown."
6165 msgstr ""
6266
63 #: prefs.js:215
67 #: prefs.js:223
6468 msgid "Delay before the bar rehides after key press."
6569 msgstr ""
6670
67 #: prefs.js:231
71 #: prefs.js:239
6872 msgid "Pressing the shortcut again rehides the panel."
6973 msgstr ""
7074
71 #: prefs.js:261
75 #: prefs.js:268
7276 msgid "<b>Intellihide</b>"
7377 msgstr ""
7478
75 #: prefs.js:268
79 #: prefs.js:275
7680 msgid "Only hide panel when a window takes the space"
7781 msgstr ""
7882
79 #: prefs.js:269
83 #: prefs.js:276
8084 msgid "Only when the active window takes the space"
8185 msgstr ""
00 {
1 "shell-version": ["3.20","3.22","3.24","3.26","3.28","3.30","3.32","3.34","3.36"],
1 "shell-version": ["3.32","3.34","3.36"],
22 "uuid": "hidetopbar@mathieu.bidon.ca",
33 "name": "Hide Top Bar",
44 "settings-schema": "org.gnome.shell.extensions.hidetopbar",
+0
-105
org.gnome.shell.extensions.hidetopbar.gschema.xml less more
0 <?xml version="1.0" encoding="UTF-8"?>
1 <schemalist>
2 <schema id="org.gnome.shell.extensions.hidetopbar" path="/org/gnome/shell/extensions/hidetopbar/">
3 <key name="hot-corner" type="b">
4 <default>false</default>
5 <summary>Keep hot corner sensitive or not</summary>
6 <description>
7 Set to "true" to keep hot corner sensitive even when panel is in hidden
8 state. Set to "false" to get rid of the hot corner in hidden state.
9 </description>
10 </key>
11 <key name="mouse-sensitive" type="b">
12 <default>false</default>
13 <summary>Show panel when mouse approaches edge of the screen</summary>
14 <description>
15 Set to "true" to show panel not only in overview but also when the mouse
16 approaches the edge of the screen.
17 </description>
18 </key>
19 <key name="mouse-sensitive-fullscreen-window" type="b">
20 <default>true</default>
21 <summary>Also show panel when mouse approaches edge of the screen when fullscreen.</summary>
22 <description>
23 Set to "true" to also show panel when mouse approaches edge of the screen when windows are in fullscreen mode.
24 </description>
25 </key>
26 <key name="mouse-triggers-overview" type="b">
27 <default>false</default>
28 <summary>Show overview when mouse approaches edge of the screen</summary>
29 <description>
30 When "mouse-sensitive" is set to "true" and this key is activated, not
31 only the panel but also the overview is shown when the mouse approaches
32 the edge of the screen.
33 </description>
34 </key>
35 <key name="animation-time-overview" type="d">
36 <default>0.4</default>
37 <summary>Slide in/out animation time</summary>
38 <description>
39 Amount of time it takes for the tweener to slide the panel in/out when
40 entering/leaving overview.
41 </description>
42 </key>
43 <key name="animation-time-autohide" type="d">
44 <default>0.2</default>
45 <summary>Slide in/out animation time</summary>
46 <description>
47 Amount of time it takes for the tweener to slide the panel in/out when
48 the mouse approaches the edge of the screen.
49 </description>
50 </key>
51 <key name="pressure-threshold" type="i">
52 <default>100</default>
53 <summary>Pressure barrier's threshold</summary>
54 <description>
55 Number of pixels the mouse has to overrun in order to trigger the
56 pressure barrier.
57 </description>
58 </key>
59 <key name="pressure-timeout" type="i">
60 <default>1000</default>
61 <summary>Pressure barrier's timeout</summary>
62 <description>
63 Amount of time before pressure barrier is triggered.
64 </description>
65 </key>
66 <key name="shortcut-keybind" type="as">
67 <default>[]</default>
68 <summary>"show bar" shortcut</summary>
69 <description>
70 Keyboard shortcut that triggers the bar to be shown.
71 </description>
72 </key>
73 <key name="shortcut-delay" type="d">
74 <default>1.0</default>
75 <summary>Delay after key press</summary>
76 <description>
77 Delay before bar rehides automatically after key press. The value 0.0
78 means unlimited delay.
79 </description>
80 </key>
81 <key name="shortcut-toggles" type="b">
82 <default>true</default>
83 <summary>Enable toggling behaviour</summary>
84 <description>
85 Pressing the shortcut again rehides the panel.
86 </description>
87 </key>
88 <key name="enable-intellihide" type="b">
89 <default>true</default>
90 <summary>Enable intellihide feature</summary>
91 <description>
92 When enabled, the panel will only hide if a window takes the space.
93 </description>
94 </key>
95 <key name="enable-active-window" type="b">
96 <default>true</default>
97 <summary>Enable Intellihide only for active window</summary>
98 <description>
99 When enabled, the panel will only hide if the active window
100 takes the space.
101 </description>
102 </key>
103 </schema>
104 </schemalist>
00
1 const Lang = imports.lang;
2 const Mainloop = imports.mainloop;
1 const GLib = imports.gi.GLib;
32 const Meta = imports.gi.Meta;
43 const Shell = imports.gi.Shell;
54 const Clutter = imports.gi.Clutter;
65
76 const Main = imports.ui.main;
87 const Layout = imports.ui.layout;
9 const Tweener = imports.ui.tweener;
108
119 const Me = imports.misc.extensionUtils.getCurrentExtension();
1210 const Convenience = Me.imports.convenience;
2725 );
2826 }
2927
30 var PanelVisibilityManager = new Lang.Class({
31 Name: 'PanelVisibilityManager',
32
33 _init: function(settings, monitorIndex) {
34 this._settings = settings;
28 var PanelVisibilityManager = class HideTopBar_PanelVisibilityManager {
29
30 constructor(settings, monitorIndex) {
3531 this._monitorIndex = monitorIndex;
3632 this._base_y = PanelBox.y;
33 this._settings = settings;
3734 this._preventHide = false;
3835 this._intellihideBlock = false;
3936 this._staticBox = new Clutter.ActorBox();
40 this._tweenActive = false;
37 this._animationActive = false;
4138 this._shortcutTimeout = 0;
4239
4340 Main.layoutManager.removeChrome(PanelBox);
5855 // Load settings
5956 this._bindSettingsChanges();
6057 this._updateSettingsMouseSensitive();
61 this._intellihide = new Intellihide.intellihide(this._settings, this._monitorIndex);
58 this._intellihide = new Intellihide.Intellihide(this._settings, this._monitorIndex);
6259
6360 this._updateHotCorner(false);
6461 this._updateStaticBox();
65 this._bindTimeoutId = Mainloop.timeout_add(100, Lang.bind(this, this._bindUIChanges));
66 },
67
68 hide: function(animationTime, trigger) {
62 this._bindTimeoutId = GLib.timeout_add(
63 GLib.PRIORITY_DEFAULT, 100, this._bindUIChanges.bind(this));
64 }
65
66 hide(animationTime, trigger) {
6967 DEBUG("hide(" + trigger + ")");
7068 if(this._preventHide) return;
7169
7977 mouse[0] < this._staticBox.x2);
8078 if(trigger == "mouse-left" && mouse_is_over) return;
8179
82 if(this._tweenActive) {
83 Tweener.removeTweens(PanelBox, "y");
84 this._tweenActive = false;
85 }
86
87 this._tweenActive = true;
88 Tweener.addTween(PanelBox, {
80 if(this._animationActive) {
81 PanelBox.remove_all_transitions();
82 this._animationActive = false;
83 }
84
85 this._animationActive = true;
86 PanelBox.ease({
8987 y: this._base_y + delta_y,
90 time: animationTime,
91 transition: 'easeOutQuad',
92 onComplete: Lang.bind(this, function() {
93 this._tweenActive = false;
88 duration: animationTime * 1000,
89 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
90 onComplete: () => {
91 this._animationActive = false;
9492 PanelBox.hide();
9593 reallocateTopIcons();
9694 this._updateHotCorner(true);
97 })
95 }
9896 });
99 },
100
101 show: function(animationTime, trigger) {
97 }
98
99 show(animationTime, trigger) {
102100 DEBUG("show(" + trigger + ")");
103101 if(trigger == "mouse-enter"
104102 && this._settings.get_boolean('mouse-triggers-overview')) {
105103 Main.overview.show();
106104 }
107105
108 if(this._tweenActive) {
109 Tweener.removeTweens(PanelBox, "y");
110 this._tweenActive = false;
106 if(this._animationActive) {
107 PanelBox.remove_all_transitions();
108 this._animationActive = false;
111109 }
112110
113111 this._updateHotCorner(false);
115113 if(trigger == "destroy"
116114 || (
117115 trigger == "showing-overview"
118 && global.get_pointer()[1] < this._panelHeight
116 && global.get_pointer()[1] < PanelBox.height
119117 && this._settings.get_boolean('hot-corner')
120118 )
121119 ) {
122120 PanelBox.y = this._base_y;
123121 reallocateTopIcons();
124122 } else {
125 this._tweenActive = true;
126 Tweener.addTween(PanelBox, {
123 this._animationActive = true;
124 PanelBox.ease({
127125 y: this._base_y,
128 time: animationTime,
129 transition: 'easeOutQuad',
130 onComplete: Lang.bind(this, function() {
131 this._tweenActive = false;
126 duration: animationTime * 1000,
127 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
128 onComplete: () => {
129 this._animationActive = false;
132130 this._updateStaticBox();
133131 reallocateTopIcons();
134 })
132 }
135133 });
136134 }
137 },
138
139 _handleMenus: function() {
135 }
136
137 _handleMenus() {
140138 if(!Main.overview.visible) {
141139 let blocker = Main.panel.menuManager.activeMenu;
142140 if(blocker == null) {
148146 this._blockerMenu = blocker;
149147 this._menuEvent = this._blockerMenu.connect(
150148 'open-state-changed',
151 Lang.bind(this, function(menu, open) {
149 (menu, open) => {
152150 if(!open && this._blockerMenu !== null) {
153151 this._blockerMenu.disconnect(this._menuEvent);
154152 this._menuEvent=null;
155153 this._blockerMenu=null;
156154 this._handleMenus();
157155 }
158 })
156 }
159157 );
160158 }
161159 }
162 },
163
164 _handleShortcut: function () {
160 }
161
162 _handleShortcut() {
165163 var delay_time = this._settings.get_double('shortcut-delay');
166164 if(this._shortcutTimeout) {
167 Mainloop.source_remove(this._shortcutTimeout);
165 GLib.source_remove(this._shortcutTimeout);
168166 this._shortcutTimeout = null;
169167 if(delay_time < 0.05
170168 || this._settings.get_boolean('shortcut-toggles')) {
187185 if(delay_time > 0.05) {
188186 this.show(delay_time/5.0, "shortcut");
189187
190 this._shortcutTimeout = Mainloop.timeout_add(
191 delay_time*1200,
192 Lang.bind(this, function () {
188 this._shortcutTimeout = GLib.timeout_add(
189 GLib.PRIORITY_DEFAULT, delay_time*1200,
190 () => {
193191 this._preventHide = false;
194192 this._intellihideBlock = false;
195193 this._handleMenus();
196194 this._shortcutTimeout = null;
197195 return false;
198 })
196 }
199197 );
200198 } else {
201199 this.show(
210208 // Main -> panel -> _leftBox -> (StBin) -> (panel-button)
211209 // Main.panel._leftBox.first_child.first_child.grab_key_focus();
212210 }
213 },
214
215 _disablePressureBarrier: function() {
211 }
212
213 _disablePressureBarrier() {
216214 if(this._panelBarrier && this._panelPressure) {
217215 this._panelPressure.removeBarrier(this._panelBarrier);
218216 this._panelBarrier.destroy();
219217 }
220 },
221
222 _initPressureBarrier: function() {
218 }
219
220 _initPressureBarrier() {
223221 this._panelPressure = new Layout.PressureBarrier(
224222 this._settings.get_int('pressure-threshold'),
225 this._settings.get_int('pressure-timeout'),
223 this._settings.get_int('pressure-timeout'),
226224 ShellActionMode.NORMAL
227225 );
228226 this._panelPressure.connect(
229227 'trigger',
230 Lang.bind(this, function(barrier) {
228 (barrier) => {
231229 if ( (Main.layoutManager.primaryMonitor.inFullscreen) && (!this._settings.get_boolean('mouse-sensitive-fullscreen-window')) ) {
232230 return;
233231 }
235233 this._settings.get_double('animation-time-autohide'),
236234 "mouse-enter"
237235 );
238 })
236 }
239237 );
240238 let anchor_y = PanelBox.get_pivot_point()[1],
241239 direction = Meta.BarrierDirection.POSITIVE_Y;
252250 directions: direction
253251 });
254252 this._panelPressure.addBarrier(this._panelBarrier);
255 },
256
257 _updateStaticBox: function() {
253 }
254
255 _updateStaticBox() {
258256 DEBUG("_updateStaticBox()");
259257 let anchor_y = PanelBox.get_pivot_point()[1];
260258 this._staticBox.init_rect(
261259 PanelBox.x, PanelBox.y-anchor_y, PanelBox.width, PanelBox.height
262260 );
263261 this._intellihide.updateTargetBox(this._staticBox);
264 },
265
266 _updateHotCorner: function(panel_hidden) {
262 }
263
264 _updateHotCorner(panel_hidden) {
267265 let HotCorner = null;
268266 for(var i = 0; i < Main.layoutManager.hotCorners.length; i++){
269267 let hc = Main.layoutManager.hotCorners[i];
276274 if(!panel_hidden || this._settings.get_boolean('hot-corner')) {
277275 HotCorner.setBarrierSize(PanelBox.height);
278276 } else {
279 Mainloop.timeout_add(100, function () {
277 GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, function () {
280278 HotCorner.setBarrierSize(0)
281279 });
282280 }
283281 }
284 },
285
286 _updateSettingsHotCorner: function() {
282 }
283
284 _updateSettingsHotCorner() {
287285 this.hide(0.1, "hot-corner-setting-changed");
288 },
289
290 _updateSettingsMouseSensitive: function() {
286 }
287
288 _updateSettingsMouseSensitive() {
291289 if(this._settings.get_boolean('mouse-sensitive')) {
292290 this._disablePressureBarrier();
293291 this._initPressureBarrier();
294292 } else this._disablePressureBarrier();
295 },
296
297 _updateIntellihideStatus: function() {
293 }
294
295 _updateIntellihideStatus() {
298296 if(this._settings.get_boolean('enable-intellihide')) {
299297 this._intellihideBlock = false;
300298 this._preventHide = false;
305303 this._preventHide = false;
306304 this.hide(0, "init");
307305 }
308 },
309
310 _updatePreventHide: function() {
306 }
307
308 _updatePreventHide() {
311309 if(this._intellihideBlock) return;
312310
313311 this._preventHide = !this._intellihide.getOverlapStatus();
316314 this.show(animTime, "intellihide");
317315 else if(!Main.overview.visible)
318316 this.hide(animTime, "intellihide");
319 },
320
321 _bindUIChanges: function () {
317 }
318
319 _bindUIChanges() {
322320 let monitorManager;
323321 if (global.screen)
324322 monitorManager = global.screen; // mutter < 3.29
330328 [
331329 Main.overview,
332330 'showing',
333 Lang.bind(this, function() {
331 () => {
334332 this.show(
335333 this._settings.get_double('animation-time-overview'),
336334 "showing-overview"
337335 );
338 })
336 }
339337 ],
340338 [
341339 Main.overview,
342340 'hiding',
343 Lang.bind(this, function() {
341 () => {
344342 this.hide(
345343 this._settings.get_double('animation-time-overview'),
346344 "hiding-overview"
347345 );
348 })
349 ],
350 [
351 Main.panel.actor,
346 }
347 ],
348 [
349 Main.panel,
352350 'leave-event',
353 Lang.bind(this, this._handleMenus)
351 this._handleMenus.bind(this)
354352 ],
355353 [
356354 PanelBox,
357355 'notify::anchor-y',
358 Lang.bind(this, function () {
356 () => {
359357 this._updateStaticBox();
360358 this._updateSettingsMouseSensitive();
361 })
359 }
362360 ],
363361 [
364362 monitorManager,
365363 'monitors-changed',
366 Lang.bind(this, function () {
364 () => {
367365 this._base_y = PanelBox.y;
368366 this._updateStaticBox();
369367 this._updateSettingsMouseSensitive();
370 })
368 }
371369 ],
372370 [
373371 this._intellihide,
374372 'status-changed',
375 Lang.bind(this, this._updatePreventHide)
373 this._updatePreventHide.bind(this)
376374 ]
377375 );
378376
379377 Main.wm.addKeybinding("shortcut-keybind",
380378 this._settings, Meta.KeyBindingFlags.NONE,
381379 ShellActionMode.NORMAL,
382 Lang.bind(this, this._handleShortcut)
380 this._handleShortcut.bind(this)
383381 );
384382
385383 this._updateIntellihideStatus();
386 },
387
388 _bindSettingsChanges: function() {
384 }
385
386 _bindSettingsChanges() {
389387 this._signalsHandler = new Convenience.GlobalSignalsHandler();
390388 this._signalsHandler.addWithLabel("settings",
391389 [
392390 this._settings,
393391 'changed::hot-corner',
394 Lang.bind(this, this._updateSettingsHotCorner)
392 this._updateSettingsHotCorner.bind(this)
395393 ],
396394 [
397395 this._settings,
398396 'changed::mouse-sensitive',
399 Lang.bind(this, this._updateSettingsMouseSensitive)
397 this._updateSettingsMouseSensitive.bind(this)
400398 ],
401399 [
402400 this._settings,
403401 'changed::pressure-timeout',
404 Lang.bind(this, this._updateSettingsMouseSensitive)
402 this._updateSettingsMouseSensitive.bind(this)
405403 ],
406404 [
407405 this._settings,
408406 'changed::pressure-threshold',
409 Lang.bind(this, this._updateSettingsMouseSensitive)
407 this._updateSettingsMouseSensitive.bind(this)
410408 ],
411409 [
412410 this._settings,
413411 'changed::enable-intellihide',
414 Lang.bind(this, this._updateIntellihideStatus)
412 this._updateIntellihideStatus.bind(this)
415413 ],
416414 [
417415 this._settings,
418416 'changed::enable-active-window',
419 Lang.bind(this, this._updateIntellihideStatus)
417 this._updateIntellihideStatus.bind(this)
420418 ]
421419 );
422 },
423
424 destroy: function() {
425 Mainloop.source_remove(this._bindTimeoutId);
420 }
421
422 destroy() {
423 GLib.source_remove(this._bindTimeoutId);
426424 this._intellihide.destroy();
427425 this._signalsHandler.destroy();
428426 Main.wm.removeKeybinding("shortcut-keybind");
437435 trackFullscreen: true
438436 });
439437 }
440 });
438 };
0 <?xml version="1.0" encoding="UTF-8"?>
1 <schemalist>
2 <schema id="org.gnome.shell.extensions.hidetopbar" path="/org/gnome/shell/extensions/hidetopbar/">
3 <key name="hot-corner" type="b">
4 <default>false</default>
5 <summary>Keep hot corner sensitive or not</summary>
6 <description>
7 Set to "true" to keep hot corner sensitive even when panel is in hidden
8 state. Set to "false" to get rid of the hot corner in hidden state.
9 </description>
10 </key>
11 <key name="mouse-sensitive" type="b">
12 <default>false</default>
13 <summary>Show panel when mouse approaches edge of the screen</summary>
14 <description>
15 Set to "true" to show panel not only in overview but also when the mouse
16 approaches the edge of the screen.
17 </description>
18 </key>
19 <key name="mouse-sensitive-fullscreen-window" type="b">
20 <default>true</default>
21 <summary>Also show panel when mouse approaches edge of the screen when fullscreen.</summary>
22 <description>
23 Set to "true" to also show panel when mouse approaches edge of the screen when windows are in fullscreen mode.
24 </description>
25 </key>
26 <key name="mouse-triggers-overview" type="b">
27 <default>false</default>
28 <summary>Show overview when mouse approaches edge of the screen</summary>
29 <description>
30 When "mouse-sensitive" is set to "true" and this key is activated, not
31 only the panel but also the overview is shown when the mouse approaches
32 the edge of the screen.
33 </description>
34 </key>
35 <key name="animation-time-overview" type="d">
36 <default>0.4</default>
37 <summary>Slide in/out animation time</summary>
38 <description>
39 Amount of time it takes for the tweener to slide the panel in/out when
40 entering/leaving overview.
41 </description>
42 </key>
43 <key name="animation-time-autohide" type="d">
44 <default>0.2</default>
45 <summary>Slide in/out animation time</summary>
46 <description>
47 Amount of time it takes for the tweener to slide the panel in/out when
48 the mouse approaches the edge of the screen.
49 </description>
50 </key>
51 <key name="pressure-threshold" type="i">
52 <default>100</default>
53 <summary>Pressure barrier's threshold</summary>
54 <description>
55 Number of pixels the mouse has to overrun in order to trigger the
56 pressure barrier.
57 </description>
58 </key>
59 <key name="pressure-timeout" type="i">
60 <default>1000</default>
61 <summary>Pressure barrier's timeout</summary>
62 <description>
63 Amount of time before pressure barrier is triggered.
64 </description>
65 </key>
66 <key name="shortcut-keybind" type="as">
67 <default>[]</default>
68 <summary>"show bar" shortcut</summary>
69 <description>
70 Keyboard shortcut that triggers the bar to be shown.
71 </description>
72 </key>
73 <key name="shortcut-delay" type="d">
74 <default>1.0</default>
75 <summary>Delay after key press</summary>
76 <description>
77 Delay before bar rehides automatically after key press. The value 0.0
78 means unlimited delay.
79 </description>
80 </key>
81 <key name="shortcut-toggles" type="b">
82 <default>true</default>
83 <summary>Enable toggling behaviour</summary>
84 <description>
85 Pressing the shortcut again rehides the panel.
86 </description>
87 </key>
88 <key name="enable-intellihide" type="b">
89 <default>true</default>
90 <summary>Enable intellihide feature</summary>
91 <description>
92 When enabled, the panel will only hide if a window takes the space.
93 </description>
94 </key>
95 <key name="enable-active-window" type="b">
96 <default>true</default>
97 <summary>Enable Intellihide only for active window</summary>
98 <description>
99 When enabled, the panel will only hide if the active window
100 takes the space.
101 </description>
102 </key>
103 </schema>
104 </schemalist>