Skip to content

Commit

Permalink
Merge pull request #299 from dseomn/switcher-closing-bug
Browse files Browse the repository at this point in the history
Fix closing the switcher popup on wayland when releasing keys
  • Loading branch information
mzur authored Feb 7, 2025
2 parents a8aed7e + 38def24 commit 403c84a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion [email protected]/workspacePopup/workspaceManagerOverride.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,15 @@ export default class WorkspaceManagerOverride {
});

let event = Clutter.get_current_event();
let modifiers = event ? event.get_state() & Clutter.ModifierType.MODIFIER_MASK : 0;
// gnome-shell's SwitcherPopup.show() seems to expect a modifier
// mask from a configured keybinding, not from an event's state.
// On Wayland, the event's state includes ambient modifiers like
// caps lock and numlock (Mod2) that generally wouldn't be part
// of a keybinding, so we clear those bits so that SwitcherPopup
// can close the popup when the relevant modifiers are released,
// instead of waiting for caps/num lock to be released.
const modifier_mask = Clutter.ModifierType.MODIFIER_MASK & ~Clutter.ModifierType.LOCK_MASK & ~Clutter.ModifierType.MOD2_MASK;
let modifiers = event ? event.get_state() & modifier_mask : 0;
this.wm._wsPopupList[monitorIndex].showToggle(false, null, modifiers, toggle);
if (monitorIndex === Main.layoutManager.primaryIndex) {
this.wm._workspaceSwitcherPopup = this.wm._wsPopupList[monitorIndex];
Expand Down

0 comments on commit 403c84a

Please sign in to comment.