Add dedicated switch for g-s app switcher isolation

gh-2378
This commit is contained in:
Charles Gagnon
2025-09-18 10:05:09 -04:00
parent 252f7367ca
commit 114d871498
4 changed files with 94 additions and 52 deletions

View File

@@ -35,7 +35,6 @@ import * as Utils from './utils.js'
import * as DesktopIconsIntegration from './desktopIconsIntegration.js'
import { DTP_EXTENSION, SETTINGS, tracker } from './extension.js'
import Gio from 'gi://Gio'
import GLib from 'gi://GLib'
import GObject from 'gi://GObject'
import Clutter from 'gi://Clutter'
@@ -107,8 +106,6 @@ export const PanelManager = class {
if (reset) return
this._syncAppSwitcherWorkspaceIsolation()
this.notificationsMonitor = new NotificationsMonitor()
this._desktopIconsUsableArea =
@@ -274,11 +271,6 @@ export const PanelManager = class {
})
},
],
[
SETTINGS,
'changed::isolate-workspaces',
this._syncAppSwitcherWorkspaceIsolation,
],
[
Utils.DisplayWrapper.getMonitorManager(),
'monitors-changed',
@@ -426,18 +418,6 @@ export const PanelManager = class {
this._desktopIconsUsableArea = null
}
_syncAppSwitcherWorkspaceIsolation() {
// alt-tab menu
let appSwitcherSettings = new Gio.Settings({
schema_id: 'org.gnome.shell.app-switcher',
})
appSwitcherSettings.set_boolean(
'current-workspace-only',
SETTINGS.get_boolean('isolate-workspaces'),
)
}
_emptyFunc() {}
_setDesktopIconsMargins() {

View File

@@ -181,6 +181,9 @@ const Preferences = class {
this._builder.add_from_file(this._path + '/ui/BoxSecondaryMenuOptions.ui')
this._builder.add_from_file(this._path + '/ui/BoxScrollPanelOptions.ui')
this._builder.add_from_file(this._path + '/ui/BoxScrollIconOptions.ui')
this._builder.add_from_file(
this._path + '/ui/BoxIsolateWorkspacesOptions.ui',
)
// pages
this._builder.add_from_file(this._path + '/ui/SettingsPosition.ui')
@@ -2565,6 +2568,39 @@ const Preferences = class {
Gio.SettingsBindFlags.DEFAULT,
)
let appSwitcherSettings = new Gio.Settings({
schema_id: 'org.gnome.shell.app-switcher',
})
appSwitcherSettings.bind(
'current-workspace-only',
this._builder.get_object('isolate_workspaces_app_switcher_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT,
)
this._builder
.get_object('isolate_workspaces_button')
.connect('clicked', () => {
let scrolledWindow = this._builder.get_object(
'box_isolate_workspaces_options',
)
let dialog = this._createPreferencesDialog(
_('Isolate Workspaces options'),
scrolledWindow,
() => {
// restore default settings
appSwitcherSettings.set_value(
'current-workspace-only',
appSwitcherSettings.get_default_value('current-workspace-only'),
)
},
)
dialog.show()
})
this._settings.bind(
'isolate-monitors',
this._builder.get_object('multimon_multi_isolate_monitor_switch'),

View File

@@ -0,0 +1,35 @@
<?xml version='1.0' encoding='UTF-8'?>
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.2"/>
<object class="GtkScrolledWindow" id="box_isolate_workspaces_options">
<property name="height-request">300</property>
<property name="vexpand">True</property>
<property name="width-request">600</property>
<child>
<object class="GtkBox">
<property name="margin-bottom">32</property>
<property name="margin-end">32</property>
<property name="margin-start">32</property>
<property name="margin-top">32</property>
<property name="orientation">vertical</property>
<property name="spacing">24</property>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow">
<property name="subtitle">Alt-Tab menu</property>
<property name="title" translatable="yes">Isolate workspaces in gnome-shell Application Switcher</property>
<child>
<object class="GtkSwitch" id="isolate_workspaces_app_switcher_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version='1.0' encoding='UTF-8'?>
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.7"/>
<object class="AdwPreferencesPage" id="behavior">
<property name="icon-name">preferences-system-symbolic</property>
<property name="title" translatable="yes">Behavior</property>
<property name="icon_name">preferences-system-symbolic</property>
<!-- group applications -->
<child>
<object class="AdwPreferencesGroup" id="behavior_group_applications">
<property name="title" translatable="yes">Applications</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Show favorite applications</property>
@@ -20,7 +18,6 @@
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Show favorite applications on secondary panels</property>
@@ -31,7 +28,6 @@
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Show running applications</property>
@@ -42,17 +38,16 @@
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Ungroup applications</property>
<child>
<object class="GtkButton" id="show_group_apps_options_button">
<property name="receives_default">True</property>
<property name="receives-default">True</property>
<property name="valign">center</property>
<child>
<object class="GtkImage" id="image_show_group_apps_options">
<property name="icon_name">emblem-system-symbolic</property>
<property name="icon-name">emblem-system-symbolic</property>
</object>
</child>
<style>
@@ -67,38 +62,33 @@
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Show notification counter badge</property>
<child>
<object class="GtkSwitch" id="show_notification_badge_switch">
<property name="visible">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<!-- group hover -->
<child>
<object class="AdwPreferencesGroup" id="behavior_group_hover">
<property name="title" translatable="yes">Hover</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Show window previews on hover</property>
<child>
<object class="GtkButton" id="show_window_previews_button">
<property name="receives_default">True</property>
<property name="receives-default">True</property>
<property name="valign">center</property>
<child>
<object class="GtkImage" id="image_window_previews_options">
<property name="icon_name">emblem-system-symbolic</property>
<property name="icon-name">emblem-system-symbolic</property>
</object>
</child>
<style>
@@ -113,7 +103,6 @@
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Show tooltip on hover</property>
@@ -124,18 +113,28 @@
</child>
</object>
</child>
</object>
</child>
<!-- group isolate -->
<child>
<object class="AdwPreferencesGroup" id="behavior_group_isolate">
<property name="title" translatable="yes">Isolate</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Isolate Workspaces</property>
<child>
<object class="GtkButton" id="isolate_workspaces_button">
<property name="receives-default">True</property>
<property name="valign">center</property>
<child>
<object class="GtkImage" id="image_isolate_workspaces_options">
<property name="icon-name">emblem-system-symbolic</property>
</object>
</child>
<style>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="GtkSwitch" id="isolate_workspaces_switch">
<property name="valign">center</property>
@@ -143,7 +142,6 @@
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Isolate monitors</property>
@@ -154,15 +152,11 @@
</child>
</object>
</child>
</object>
</child>
<!-- group overview -->
<child>
<object class="AdwPreferencesGroup" id="behavior_group_overview">
<property name="title" translatable="yes">Overview</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Click empty space to close overview</property>
@@ -173,7 +167,6 @@
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Disable show overview on startup</property>
@@ -184,9 +177,7 @@
</child>
</object>
</child>
</object>
</child>
</object>
</interface>