Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ export class MonitorNavigator {
return;
}

const activeWorkspace = this.settings.isCurrentWorkspaceOnlyEnabled()
? global.workspace_manager.get_active_workspace()
: null;
const inWorkspace = win => !activeWorkspace || win.get_workspace() === activeWorkspace;
const windows = global.get_window_actors().map(actor => actor.meta_window);
const windowsOnCurrent = windows.filter(win => win.get_monitor() === currentMonitor);
const windowsOnTarget = windows.filter(win => win.get_monitor() === targetMonitor);
const windowsOnCurrent = windows.filter(win => win.get_monitor() === currentMonitor && inWorkspace(win));
const windowsOnTarget = windows.filter(win => win.get_monitor() === targetMonitor && inWorkspace(win));

for (const win of windowsOnCurrent) {
win.move_to_monitor(targetMonitor);
Expand All @@ -92,7 +96,10 @@ export class MonitorNavigator {
}

_focusMostRecentWindowOnMonitor(monitorIndex) {
const recentWindows = global.display.get_tab_list(0, null);
const workspace = this.settings.isCurrentWorkspaceOnlyEnabled()
? global.workspace_manager.get_active_workspace()
: null;
const recentWindows = global.display.get_tab_list(0, workspace);
for (const win of recentWindows) {
if (!win.minimized && !win.skip_taskbar && win.get_monitor() === monitorIndex) {
win.activate(global.get_current_time());
Expand Down
17 changes: 17 additions & 0 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,23 @@ class PreferencesSettings {

focusGroup.add(changeFocus);

const currentWorkspaceOnlySwitch = new Gtk.Switch({
active: this.schema.get_boolean('current-workspace-only'),
valign: Gtk.Align.CENTER
});
const currentWorkspaceOnlyRow = new Adw.ActionRow({
title: _('Restrict actions to the current workspace'),
subtitle: _('When enabled, swap and focus updates only consider windows on the active workspace')
});
currentWorkspaceOnlyRow.add_suffix(currentWorkspaceOnlySwitch);
currentWorkspaceOnlyRow.activatable_widget = currentWorkspaceOnlySwitch;

currentWorkspaceOnlySwitch.connect('notify::active', () => {
this.schema.set_boolean('current-workspace-only', currentWorkspaceOnlySwitch.active);
});

focusGroup.add(currentWorkspaceOnlyRow);

this.page.add(cursorGroup);
this.page.add(focusGroup);
}
Expand Down
Binary file modified schemas/gschemas.compiled
Binary file not shown.
6 changes: 6 additions & 0 deletions schemas/org.gnome.shell.extensions.binu.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
<description>Update the focus to the window on the navigated monitor</description>
</key>

<key name="current-workspace-only" type="b">
<default>true</default>
<summary>Restrict actions to the current workspace</summary>
<description>When enabled, swap and focus actions only consider windows on the currently active workspace.</description>
</key>


</schema>
</schemalist>
5 changes: 5 additions & 0 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ export class Preferences{
return this._settings.get_boolean('update-focus');
}

isCurrentWorkspaceOnlyEnabled() {
// Restrict swap/focus actions to the active workspace
return this._settings.get_boolean('current-workspace-only');
}

getAnimationDuration() {
return this._settings.get_int('animate-cursor-duration');
}
Expand Down