Updating 44/vertical-workspaces to version 37+20231208 [0d82192].
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
975b88c6bb
commit
07381ac119
37 changed files with 9559 additions and 4338 deletions
|
@ -10,43 +10,113 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const Overview = imports.ui.overview;
|
||||
const OverviewControls = imports.ui.overviewControls;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
let _overrides;
|
||||
let Me;
|
||||
let opt;
|
||||
|
||||
function update(reset = false) {
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
var OverviewModule = class {
|
||||
constructor(me) {
|
||||
Me = me;
|
||||
opt = Me.opt;
|
||||
|
||||
|
||||
if (reset) {
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
return;
|
||||
this._firstActivation = true;
|
||||
this.moduleEnabled = false;
|
||||
this._overrides = null;
|
||||
}
|
||||
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
_overrides = new _Util.Overrides();
|
||||
cleanGlobals() {
|
||||
Me = null;
|
||||
opt = null;
|
||||
}
|
||||
|
||||
_overrides.addOverride('Overview', Overview.Overview.prototype, OverviewCommon);
|
||||
}
|
||||
update(reset) {
|
||||
this.moduleEnabled = true;
|
||||
const conflict = false;
|
||||
|
||||
reset = reset || !this.moduleEnabled || conflict;
|
||||
|
||||
// don't touch the original code if module disabled
|
||||
if (reset && !this._firstActivation) {
|
||||
this._disableModule();
|
||||
} else if (!reset) {
|
||||
this._firstActivation = false;
|
||||
this._activateModule();
|
||||
}
|
||||
if (reset && this._firstActivation)
|
||||
console.debug(' OverviewModule - Keeping untouched');
|
||||
}
|
||||
|
||||
_activateModule() {
|
||||
if (!this._overrides)
|
||||
this._overrides = new Me.Util.Overrides();
|
||||
|
||||
this._overrides.addOverride('Overview', Overview.Overview.prototype, OverviewCommon);
|
||||
console.debug(' OverviewModule - Activated');
|
||||
}
|
||||
|
||||
_disableModule() {
|
||||
if (this._overrides)
|
||||
this._overrides.removeAll();
|
||||
this._overrides = null;
|
||||
|
||||
console.debug(' OverviewModule - Disabled');
|
||||
}
|
||||
};
|
||||
|
||||
const OverviewCommon = {
|
||||
show(state = OverviewControls.ControlsState.WINDOW_PICKER, customOverviewMode) {
|
||||
if (!customOverviewMode)
|
||||
this.resetOverviewMode();
|
||||
|
||||
if (state === OverviewControls.ControlsState.HIDDEN)
|
||||
throw new Error('Invalid state, use hide() to hide');
|
||||
|
||||
if (this.isDummy)
|
||||
return;
|
||||
if (this._shown)
|
||||
return;
|
||||
this._shown = true;
|
||||
|
||||
if (!this._syncGrab())
|
||||
return;
|
||||
|
||||
Main.layoutManager.showOverview();
|
||||
this._animateVisible(state);
|
||||
},
|
||||
|
||||
toggle(customOverviewMode) {
|
||||
if (this.isDummy)
|
||||
return;
|
||||
|
||||
if (this._visible)
|
||||
this.hide();
|
||||
else
|
||||
this.show(OverviewControls.ControlsState.WINDOW_PICKER, customOverviewMode);
|
||||
},
|
||||
|
||||
resetOverviewMode() {
|
||||
// reset Overview Mode do default
|
||||
opt.OVERVIEW_MODE = opt.get('overviewMode');
|
||||
opt.OVERVIEW_MODE2 = opt.OVERVIEW_MODE === 2;
|
||||
opt.WORKSPACE_MODE = opt.OVERVIEW_MODE > 0 ? 0 : 1;
|
||||
},
|
||||
|
||||
_showDone() {
|
||||
this._animationInProgress = false;
|
||||
this._coverPane.hide();
|
||||
|
||||
this.emit('shown');
|
||||
if (Me.shellVersion < 44)
|
||||
this.emit('shown');
|
||||
else if (this._shownState !== 'SHOWN')
|
||||
this._changeShownState('SHOWN');
|
||||
|
||||
// Handle any calls to hide* while we were showing
|
||||
if (!this._shown)
|
||||
this._animateNotVisible();
|
||||
|
||||
this._syncGrab();
|
||||
|
||||
// if user activates overview during startup animation, transition needs to be shifted to the state 2 here
|
||||
const controls = this._overview._controls;
|
||||
if (controls._searchController._searchActive && controls._stateAdjustment.value === 1) {
|
||||
|
@ -55,5 +125,41 @@ const OverviewCommon = {
|
|||
else if (!opt.OVERVIEW_MODE2)
|
||||
controls._stateAdjustment.value = 2;
|
||||
}
|
||||
|
||||
this._syncGrab();
|
||||
},
|
||||
|
||||
// Workaround - should probably be fixed elsewhere in the upstream code
|
||||
// If a new window is opened from the overview
|
||||
// and is realized before the overview animation is complete,
|
||||
// the new window will not get focus
|
||||
after__hideDone() {
|
||||
if (!opt.FIX_NEW_WINDOW_FOCUS)
|
||||
return;
|
||||
|
||||
const workspace = global.workspace_manager.get_active_workspace();
|
||||
const recentDesktopWin = global.display.get_tab_list(1, workspace)[0];
|
||||
let recentNormalWin = null;
|
||||
const tabList = global.display.get_tab_list(0, workspace);
|
||||
|
||||
for (let i = 0; i < tabList.length; i++) {
|
||||
if (tabList[i].minimized === false) {
|
||||
recentNormalWin = tabList[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let recentWin = recentNormalWin;
|
||||
if (recentNormalWin && recentDesktopWin) {
|
||||
recentWin = recentNormalWin.get_user_time() > recentDesktopWin.get_user_time()
|
||||
? recentNormalWin
|
||||
: recentDesktopWin;
|
||||
}
|
||||
|
||||
const focusedWin = global.display.focus_window;
|
||||
|
||||
if (recentWin && focusedWin !== recentWin)
|
||||
recentWin.activate(global.get_current_time());
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue