1
0
Fork 0

Updating 47/vertical-workspaces to version 47.5+20250210 [b14ba3cf].

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-03-24 19:45:01 +01:00
parent 297ae772ab
commit 6b0458069f
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
26 changed files with 5479 additions and 3202 deletions

View file

@ -362,13 +362,13 @@ const DashItemContainerCommon = {
y = stageY - this.label.height - yOffset;
} else if (opt.DASH_RIGHT) {
const yOffset = Math.floor((itemHeight - labelHeight) / 2);
xOffset = shellVersion46 ? 8 : 4;
xOffset = shellVersion46 && opt.DASH_BG_GS3_STYLE ? 12 : 0;
x = stageX - xOffset - this.label.width;
y = Math.clamp(stageY + yOffset, 0, global.stage.height - labelHeight);
} else if (opt.DASH_LEFT) {
const yOffset = Math.floor((itemHeight - labelHeight) / 2);
xOffset = shellVersion46 ? 8 : 4;
xOffset = shellVersion46 && opt.DASH_BG_GS3_STYLE ? 12 : 0;
x = stageX + this.width + xOffset;
y = Math.clamp(stageY + yOffset, 0, global.stage.height - labelHeight);
@ -864,60 +864,53 @@ const AppIconCommon = {
activate(button) {
const event = Clutter.get_current_event();
const state = event ? event.get_state() : 0;
const isMiddleButton = button && button === Clutter.BUTTON_MIDDLE;
const isCtrlPressed = Me.Util.isCtrlPressed(state);
const isShiftPressed = Me.Util.isShiftPressed(state);
const currentWS = global.workspace_manager.get_active_workspace();
const isCtrlPressed = Me.Util.isCtrlPressed(state);
const appIsRunning = this.app.state === Shell.AppState.RUNNING;
const appRecentWorkspace = this._getAppRecentWorkspace(this.app);
// this feature shouldn't affect search results, dash icons don't have labels, so we use them as a condition
const showWidowsBeforeActivation = opt.DASH_CLICK_ACTION === 1 && !this.icon.label;
const targetWindowOnCurrentWs = this._isTargetWindowOnCurrentWs(appRecentWorkspace);
let targetWindowOnCurrentWs = false;
if (opt.DASH_FOLLOW_RECENT_WIN) {
targetWindowOnCurrentWs = appRecentWorkspace === currentWS;
} else {
this.app.get_windows().forEach(
w => {
targetWindowOnCurrentWs = targetWindowOnCurrentWs || (w.get_workspace() === currentWS);
}
);
}
const openNewWindow = this._shouldOpenNewWindow(appIsRunning, button, isShiftPressed, isCtrlPressed, targetWindowOnCurrentWs);
const staticWorkspace = !opt.WORKSPACE_MODE;
const nWindows = appIsRunning ? this.app.get_n_windows() : 0;
// This feature shouldn't affect search results. Dash icons lack labels, so their absence is used as a condition
const showWidowsBeforeActivation =
opt.DASH_CLICK_ACTION === 1 && !this.icon.label &&
!isShiftPressed && nWindows > 1;/* &&
!(opt.DASH_ISOLATE_WS || opt.DASH_CLICK_OPEN_NEW_WIN || opt.DASH_CLICK_PREFER_WORKSPACE);*/
const openNewWindow = this.app.can_open_new_window() &&
this.app.state === Shell.AppState.RUNNING &&
(((isCtrlPressed || isMiddleButton) && !opt.DASH_CLICK_OPEN_NEW_WIN) ||
(opt.DASH_CLICK_OPEN_NEW_WIN && !this._selectedMetaWin && !isMiddleButton) ||
((opt.DASH_CLICK_PREFER_WORKSPACE || opt.DASH_ISOLATE_WS) && !targetWindowOnCurrentWs));
if ((this.app.state === Shell.AppState.STOPPED || openNewWindow) && !isShiftPressed)
if ((!appIsRunning || openNewWindow) && !isShiftPressed)
this.animateLaunch();
if (openNewWindow) {
this.app.open_new_window(-1);
// if DASH_CLICK_ACTION == "SHOW_WINS_BEFORE", the app has more than one window and has no window on the current workspace,
// don't activate the app immediately, only move the overview to the workspace with the app's recent window
} else if (showWidowsBeforeActivation && !isShiftPressed && this.app.get_n_windows() > 1 && !targetWindowOnCurrentWs/* && !(opt.OVERVIEW_MODE && !opt.WORKSPACE_MODE)*/) {
Main.wm.actionMoveWorkspace(appRecentWorkspace);
Main.overview.dash.showAppsButton.checked = false;
return;
} else if (this._selectedMetaWin) {
this._selectedMetaWin.activate(global.get_current_time());
} else if (showWidowsBeforeActivation && opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE && !isShiftPressed && this.app.get_n_windows() > 1) {
// expose windows
Main.overview._overview._controls._thumbnailsBox._activateThumbnailAtPoint(0, 0, global.get_current_time(), true);
return;
} else if (((opt.DASH_SHIFT_CLICK_MV && isShiftPressed) || ((opt.DASH_CLICK_PREFER_WORKSPACE || opt.DASH_ISOLATE_WS) && !openNewWindow)) && this.app.get_windows().length) {
// if DASH_CLICK_ACTION == "SHOW_WINS_BEFORE", the app has more than one window and has no window on the current workspace,
// don't activate the app immediately, only move the overview to the workspace with the app's recent window
} else if (showWidowsBeforeActivation) {
if (!targetWindowOnCurrentWs) {
Main.wm.actionMoveWorkspace(appRecentWorkspace);
Main.overview.dash.showAppsButton.checked = false;
// Activate the app to ensure it appears above all other apps in static workspace mode
this.app.activate();
return;
} else if (staticWorkspace) {
// spread windows
Me.Util.exposeWindows();
return;
} else {
this.app.activate();
}
} else if (this._shouldMoveToCurrentWorkspace(isShiftPressed, openNewWindow, targetWindowOnCurrentWs, nWindows)) {
this._moveAppToCurrentWorkspace();
if (opt.DASH_ISOLATE_WS) {
if ((opt.DASH_ISOLATE_WS || opt.DASH_CLICK_PREFER_WORKSPACE) && !isShiftPressed) {
this.app.activate();
// hide the overview after the window is re-created
GLib.idle_add(GLib.PRIORITY_LOW, () => Main.overview.hide());
return;
}
return;
} else if (isShiftPressed) {
return;
} else {
this.app.activate();
}
@ -925,6 +918,35 @@ const AppIconCommon = {
Main.overview.hide();
},
_shouldOpenNewWindow(appIsRunning, button, isShiftPressed, isCtrlPressed, targetWindowOnCurrentWs) {
const isMiddleButton = button && button === Clutter.BUTTON_MIDDLE;
return this.app.can_open_new_window() &&
appIsRunning && !isShiftPressed &&
(((isCtrlPressed || isMiddleButton) && !opt.DASH_CLICK_OPEN_NEW_WIN) ||
(opt.DASH_CLICK_OPEN_NEW_WIN && !isMiddleButton) ||
((opt.DASH_CLICK_PREFER_WORKSPACE || opt.DASH_ISOLATE_WS) && !targetWindowOnCurrentWs));
},
_isTargetWindowOnCurrentWs(appRecentWorkspace) {
const currentWS = global.workspace_manager.get_active_workspace();
if (opt.DASH_FOLLOW_RECENT_WIN)
return appRecentWorkspace === currentWS;
let targetWindowOnCurrentWs = false;
this.app.get_windows().forEach(
w => {
targetWindowOnCurrentWs = targetWindowOnCurrentWs || (w.get_workspace() === currentWS);
}
);
return targetWindowOnCurrentWs;
},
_shouldMoveToCurrentWorkspace(isShiftPressed, openNewWindow, targetWindowOnCurrentWs, nWindows) {
return ((opt.DASH_SHIFT_CLICK_MV && isShiftPressed) ||
((opt.DASH_CLICK_PREFER_WORKSPACE || opt.DASH_ISOLATE_WS) && !openNewWindow && !targetWindowOnCurrentWs)) &&
nWindows > 0;
},
_moveAppToCurrentWorkspace() {
this.app.get_windows().forEach(w => w.change_workspace(global.workspace_manager.get_active_workspace()));
},
@ -972,51 +994,55 @@ const AppIconCommon = {
if (this._addedMenuItems && this._addedMenuItems.length)
this._addedMenuItems.forEach(i => i.destroy());
const popupItems = [];
const separator = new PopupMenu.PopupSeparatorMenuItem();
this._menu.addMenuItem(separator);
this._addedMenuItems = [];
if (this.app.get_n_windows()) {
// if (/* opt.APP_MENU_FORCE_QUIT*/true) {}
popupItems.push([_('Force Quit'), () => {
this.app.get_windows()[0].kill();
}]);
// if (opt.APP_MENU_CLOSE_WS) {}
const nWin = this._getWindowsOnCurrentWs().length;
if (nWin) {
popupItems.push([_(`Close ${nWin} Windows on Current Workspace`), () => {
const windows = this._getWindowsOnCurrentWs();
let time = global.get_current_time();
for (let win of windows) {
// increase time by 1 ms for each window to avoid errors from GS
win.delete(time++);
}
}]);
if (opt.APP_MENU_FORCE_QUIT) {
const item = new PopupMenu.PopupMenuItem(_('Force Quit'));
item.connect('activate', () => this.app.get_windows()[0].kill());
this._menu.addMenuItem(item);
this._addedMenuItems.push(item);
}
if (opt.APP_MENU_CLOSE_WINS_WS) {
const nWin = this._getWindowsOnCurrentWs().length;
if (nWin) {
const item = new PopupMenu.PopupMenuItem(_(`Close ${nWin} Windows on Current Workspace`));
item.connect('activate', () => {
const windows = this._getWindowsOnCurrentWs();
let time = global.get_current_time();
for (let win of windows) {
// increase time by 1 ms for each window to avoid errors from GS
win.delete(time++);
}
});
this._menu.addMenuItem(item);
this._addedMenuItems.push(item);
}
}
const separator = new PopupMenu.PopupSeparatorMenuItem();
this._menu.addMenuItem(separator);
this._addedMenuItems.push(separator);
if (opt.APP_MENU_MOVE_APP) {
const item = new PopupMenu.PopupMenuItem(_('Move App to Current Workspace [Shift + Click]'));
item.connect('activate', this._moveAppToCurrentWorkspace.bind(this));
this._menu.addMenuItem(item);
this._addedMenuItems.push(item);
if (!this._windowsOnOtherWs())
item.setSensitive(false);
}
popupItems.push([_('Move App to Current Workspace ( Shift + Click )'), this._moveAppToCurrentWorkspace]);
// WTMB (Windows Thumbnails) extension required
if (global.windowThumbnails) {
popupItems.push([_('Create Window Thumbnail/PiP'), () => {
global.windowThumbnails?.createThumbnail(this.app.get_windows()[0]);
}]);
if (opt.APP_MENU_WINDOW_TMB && global.windowThumbnails) {
const item = new PopupMenu.PopupMenuItem(_('Create Window Thumbnail (PiP)'));
item.connect('activate', () => global.windowThumbnails?.createThumbnail(this.app.get_windows()[0]));
this._menu.addMenuItem(item);
this._addedMenuItems.push(item);
}
}
this._addedMenuItems = [];
this._addedMenuItems.push(separator);
popupItems.forEach(i => {
let item = new PopupMenu.PopupMenuItem(i[0]);
this._menu.addMenuItem(item);
item.connect('activate', i[1].bind(this));
if (i[1] === this._moveAppToCurrentWorkspace && !this._windowsOnOtherWs())
item.setSensitive(false);
this._addedMenuItems.push(item);
});
this.emit('menu-state-changed', true);
this._menu.open(BoxPointer.PopupAnimation.FULL);