mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-10-05 03:46:53 +00:00
Record overrides in the actionIdMap
This means we can get rid of more cases in the ugly switch in navigator.
This commit is contained in:
+9
-1
@@ -272,12 +272,18 @@ function setKeybinding(name, func) {
|
||||
Main.wm.setCustomKeybindingHandler(name, Shell.ActionMode.NORMAL, func);
|
||||
}
|
||||
|
||||
function overrideAction(mutterName, action) {
|
||||
setKeybinding(mutterName, action.keyHandler);
|
||||
let id = Meta.prefs_get_keybinding_action(mutterName);
|
||||
actionIdMap[id] = action;
|
||||
}
|
||||
|
||||
function resolveConflicts() {
|
||||
resetConflicts();
|
||||
for (let conflict of Settings.findConflicts()) {
|
||||
let {name, conflicts} = conflict;
|
||||
let action = byMutterName(name);
|
||||
conflicts.forEach(c => setKeybinding(c, action.handler));
|
||||
conflicts.forEach(c => overrideAction(c, action));
|
||||
overrides.push(conflict);
|
||||
}
|
||||
}
|
||||
@@ -285,6 +291,8 @@ function resolveConflicts() {
|
||||
function resetConflicts() {
|
||||
let names = overrides.reduce((sum, add) => sum.concat(add.conflicts), []);
|
||||
for (let name of names) {
|
||||
let id = Meta.prefs_get_keybinding_action(name);
|
||||
delete actionIdMap[id];
|
||||
// Bultin mutter actions can be reset by setting their custom handler to
|
||||
// null. However gnome-shell often sets a custom handler of its own,
|
||||
// which means we most often can't rely on that
|
||||
|
||||
@@ -232,21 +232,6 @@ var PreviewedWindowNavigator = new Lang.Class({
|
||||
case Meta.KeyBindingAction.WORKSPACE_DOWN: // PageDown
|
||||
mutterActionId = Keybindings.idOf('previous-workspace');
|
||||
break;
|
||||
case Meta.KeyBindingAction.TOGGLE_TILED_RIGHT: // Right
|
||||
mutterActionId = Keybindings.idOf('switch-right');
|
||||
break;
|
||||
case Meta.KeyBindingAction.TOGGLE_TILED_LEFT: // Left
|
||||
mutterActionId = Keybindings.idOf('switch-left');
|
||||
break;
|
||||
case Meta.KeyBindingAction.MAXIMIZE: // Up
|
||||
mutterActionId = Keybindings.idOf('switch-up');
|
||||
break;
|
||||
case Meta.KeyBindingAction.UNMAXIMIZE: // Down
|
||||
mutterActionId = Keybindings.idOf('switch-down');
|
||||
break;
|
||||
case Meta.KeyBindingAction.CLOSE:
|
||||
mutterActionId = Keybindings.idOf('close-window');
|
||||
break;
|
||||
}
|
||||
|
||||
if (mutterActionId
|
||||
|
||||
Reference in New Issue
Block a user