Add option to restrict swap and focus to the current workspace#2
Open
trftky wants to merge 1 commit intoctadel:masterfrom
Open
Add option to restrict swap and focus to the current workspace#2trftky wants to merge 1 commit intoctadel:masterfrom
trftky wants to merge 1 commit intoctadel:masterfrom
Conversation
`swap-*` shortcuts currently move every window on the two monitors, including windows on inactive workspaces, because `swapWindowsWith` only filters by monitor. After a swap or `monitor-*` navigation, focus can also jump to a different workspace because `_focusMostRecentWindowOnMonitor` calls `get_tab_list(0, null)`, which scans all workspaces. Add a new boolean `current-workspace-only` preference (default `true`) exposed in Preferences -> Window Focus Settings. When enabled, `swapWindowsWith` and `_focusMostRecentWindowOnMonitor` only consider windows on the currently active workspace; disabling it preserves the original behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
swap-*shortcuts currently move every window on the two monitors,including windows on inactive workspaces, because
swapWindowsWithonly filters by monitor (
monitor.jsL72-74). After a swap or anymonitor-*navigation, focus also sometimes jumps to a differentworkspace, because
_focusMostRecentWindowOnMonitorcallsget_tab_list(0, null), which scans all workspaces.Reproduce
swap-0.→ Workspace 2's A/B windows are also swapped; the active workspace
itself sometimes changes after the action.
Solution
Add a new boolean
current-workspace-onlypreference (defaulttrue,which matches the most common user expectation; can be flipped to
falseto preserve the original behavior).When enabled:
swapWindowsWithonly swaps windows that live on the active workspace._focusMostRecentWindowOnMonitor(used by both swap and navigate)only looks at windows on the active workspace, so the desktop no
longer pulls the user out of their current workspace.
Files changed
schemas/org.gnome.shell.extensions.binu.gschema.xml— new boolean keyschemas/gschemas.compiled— regeneratedutils.js—Preferences.isCurrentWorkspaceOnlyEnabled()gettermonitor.js— guard the two affected blocks behind the new settingprefs.js— new toggle in Preferences → Window Focus SettingsTest plan
confined to the current workspace and focus stays put; with the
toggle off, the original cross-workspace behavior is preserved.
(
workspace_manager.get_active_workspace,meta_window.get_workspace,display.get_tab_list) are session-agnostic.