From 4a9886e6f6623d8c60d9b005df6e9bfec4b3c0c1 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 12 Oct 2025 19:32:50 -0400 Subject: [PATCH] Add setting to force monitor isolation when using a single panel gh-2355 --- ...shell.extensions.dash-to-panel.gschema.xml | 4 +++ src/appIcons.js | 4 ++- src/panelManager.js | 4 ++- src/prefs.js | 32 +++++++++++++++++ ui/BoxIsolateMonitorsOptions.ui | 34 +++++++++++++++++++ ui/SettingsBehavior.ui | 14 ++++++++ 6 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 ui/BoxIsolateMonitorsOptions.ui diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml index 81c51e1..2949347 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -695,6 +695,10 @@ Provide monitor isolation Dash shows only windows from the current monitor + + false + Isolate monitors even with a single panel + true Display the favorites on all monitors diff --git a/src/appIcons.js b/src/appIcons.js index da81d5c..f58fea5 100644 --- a/src/appIcons.js +++ b/src/appIcons.js @@ -1870,7 +1870,9 @@ export function getInterestingWindows(app, monitor, isolateMonitors) { if ( monitor && - (isolateMonitors || SETTINGS.get_boolean('isolate-monitors')) + (isolateMonitors || SETTINGS.get_boolean('isolate-monitors')) && + (SETTINGS.get_boolean('multi-monitors') || + SETTINGS.get_boolean('isolate-monitors-with-single-panel')) ) { windows = windows.filter(function (w) { return w.get_monitor() == monitor.index diff --git a/src/panelManager.js b/src/panelManager.js index 5fce29c..a9ea41f 100755 --- a/src/panelManager.js +++ b/src/panelManager.js @@ -495,7 +495,9 @@ export const PanelManager = class { } let isolateWorkspaces = SETTINGS.get_boolean('isolate-workspaces') - let isolateMonitors = SETTINGS.get_boolean('isolate-monitors') + let isolateMonitors = + !SETTINGS.get_boolean('multi-monitors') || + SETTINGS.get_boolean('isolate-monitors') this.focusedApp = app diff --git a/src/prefs.js b/src/prefs.js index 27c86a1..cf70345 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -184,6 +184,7 @@ const Preferences = class { this._builder.add_from_file( this._path + '/ui/BoxIsolateWorkspacesOptions.ui', ) + this._builder.add_from_file(this._path + '/ui/BoxIsolateMonitorsOptions.ui') // pages this._builder.add_from_file(this._path + '/ui/SettingsPosition.ui') @@ -2608,6 +2609,37 @@ const Preferences = class { Gio.SettingsBindFlags.DEFAULT, ) + this._settings.bind( + 'isolate-monitors-with-single-panel', + this._builder.get_object('isolate_monitors_with_single_panel_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT, + ) + + this._builder + .get_object('isolate_monitors_button') + .connect('clicked', () => { + let scrolledWindow = this._builder.get_object( + 'box_isolate_monitors_options', + ) + + let dialog = this._createPreferencesDialog( + _('Isolate monitors options'), + scrolledWindow, + () => { + // restore default settings + this._settings.set_value( + 'isolate-monitors-with-single-panel', + this._settings.get_default_value( + 'isolate-monitors-with-single-panel', + ), + ) + }, + ) + + dialog.show() + }) + this._settings.bind( 'overview-click-to-exit', this._builder.get_object('clicktoexit_switch'), diff --git a/ui/BoxIsolateMonitorsOptions.ui b/ui/BoxIsolateMonitorsOptions.ui new file mode 100644 index 0000000..8c37cc9 --- /dev/null +++ b/ui/BoxIsolateMonitorsOptions.ui @@ -0,0 +1,34 @@ + + + + + + 300 + True + 600 + + + 32 + 32 + 32 + 32 + vertical + 24 + + + + + Isolate monitors even when using a single panel + + + center + + + + + + + + + + diff --git a/ui/SettingsBehavior.ui b/ui/SettingsBehavior.ui index bba198e..569da49 100644 --- a/ui/SettingsBehavior.ui +++ b/ui/SettingsBehavior.ui @@ -145,6 +145,20 @@ Isolate monitors + + + True + center + + + emblem-system-symbolic + + + + + center