Skip to content

Commit f72908e

Browse files
committed
Merge branch 'fix-729-paperwm-keybind-clashes-ubuntu-tiling-assistant-gnome44' into gnome-44
2 parents 80f8461 + 4e6bfdc commit f72908e

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

settings.js

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@ function setState($, key) {
2424
prefs[name] = value.deep_unpack();
2525
}
2626

27-
var conflictSettings; // exported
28-
function getConflictSettings() {
29-
if (!conflictSettings) {
30-
// Schemas that may contain conflicting keybindings
31-
// It's possible to inject or remove settings here on `user.init`.
32-
conflictSettings = [
33-
new Gio.Settings({ schema_id: 'org.gnome.mutter.keybindings' }),
34-
new Gio.Settings({ schema_id: 'org.gnome.mutter.wayland.keybindings' }),
35-
new Gio.Settings({ schema_id: "org.gnome.desktop.wm.keybindings" }),
36-
new Gio.Settings({ schema_id: "org.gnome.shell.keybindings" }),
37-
];
38-
}
39-
40-
return conflictSettings;
41-
}
42-
4327
var prefs;
4428
let gsettings, _overriddingConflicts;
4529
function enable() {
@@ -88,6 +72,40 @@ function disable() {
8872
conflictSettings = null;
8973
}
9074

75+
var conflictSettings; // exported
76+
function getConflictSettings() {
77+
if (!conflictSettings) {
78+
// Schemas that may contain conflicting keybindings
79+
conflictSettings = [];
80+
addSchemaToConflictSettings('org.gnome.mutter.keybindings');
81+
addSchemaToConflictSettings('org.gnome.mutter.wayland.keybindings');
82+
addSchemaToConflictSettings('org.gnome.desktop.wm.keybindings');
83+
addSchemaToConflictSettings('org.gnome.shell.keybindings');
84+
85+
// below schemas are checked but may not exist in all distributions
86+
addSchemaToConflictSettings('org.gnome.settings-daemon.plugins.media-keys', false);
87+
// ubuntu tiling-assistant (enabled by default on Ubuntu 23.10)
88+
addSchemaToConflictSettings('org.gnome.shell.extensions.tiling-assistant', false);
89+
}
90+
91+
return conflictSettings;
92+
}
93+
94+
/**
95+
* Adds a Gio.Settings object to conflictSettings. Fails gracefully.
96+
* @param {Gio.Settings} schemaId
97+
*/
98+
function addSchemaToConflictSettings(schemaId, warn = true) {
99+
try {
100+
conflictSettings.push(new Gio.Settings({ schema_id: schemaId }));
101+
}
102+
catch (e) {
103+
if (warn) {
104+
console.warn(`Invalid schema_id '${schemaId}': could not add to keybind conflict checks`);
105+
}
106+
}
107+
}
108+
91109
// / Keybindings
92110

93111
function accelerator_parse(keystr) {

0 commit comments

Comments
 (0)