Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat(infra,domain): remove special handling of mod key from `KeybindingService`

Lars Berger45e43a1f3f17
diff --git a/GlazeWM.Domain/UserConfigs/CommandHandlers/EvaluateUserConfigHandler.cs b/GlazeWM.Domain/UserConfigs/CommandHandlers/EvaluateUserConfigHandler.cs
index 55dd946e..10589f18 100644
--- a/GlazeWM.Domain/UserConfigs/CommandHandlers/EvaluateUserConfigHandler.cs
+++ b/GlazeWM.Domain/UserConfigs/CommandHandlers/EvaluateUserConfigHandler.cs
@@ -51,8 +51,7 @@ namespace GlazeWM.Domain.UserConfigs.CommandHandlers
foreach (var workspaceConfig in deserializedConfig.Workspaces)
_bus.Invoke(new CreateWorkspaceCommand(workspaceConfig.Name));
- // Register keybindings and mod key.
- _keybindingService.SetModKey(deserializedConfig.ModKey);
+ // Register keybindings.
_bus.Invoke(new RegisterKeybindingsCommand(deserializedConfig.Keybindings));
// Merge default window rules with user-defined rules.
diff --git a/GlazeWM.Infrastructure/WindowsApi/KeybindingService.cs b/GlazeWM.Infrastructure/WindowsApi/KeybindingService.cs
index ff6de2cb..4f242e1b 100644
--- a/GlazeWM.Infrastructure/WindowsApi/KeybindingService.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/KeybindingService.cs
@@ -24,20 +24,14 @@ namespace GlazeWM.Infrastructure.WindowsApi
public class KeybindingService
{
- private Bus _bus;
private static readonly uint WM_KEYDOWN = 0x100;
private static readonly uint WM_SYSKEYDOWN = 0x104;
- private Keys _modKey = Keys.Alt;
/// <summary>
/// Registered keybindings grouped by trigger key (ie. the final key in a key combination).
/// </summary>
- private Dictionary<Keys, List<Keybinding>> _keybindingsByTriggerKey = new Dictionary<Keys, List<Keybinding>>();
-
- public KeybindingService(Bus bus)
- {
- _bus = bus;
- }
+ private Dictionary<Keys, List<Keybinding>> _keybindingsByTriggerKey
+ = new Dictionary<Keys, List<Keybinding>>();
public void Start()
{
@@ -46,11 +40,6 @@ namespace GlazeWM.Infrastructure.WindowsApi
thread.Start();
}
- public void SetModKey(string modKey)
- {
- _modKey = (Keys)Enum.Parse(typeof(Keys), modKey);
- }
-
public void AddGlobalKeybinding(string keybindingString, Action callback)
{
var keybindingParts = keybindingString
@@ -74,9 +63,6 @@ namespace GlazeWM.Infrastructure.WindowsApi
private string FormatKeybinding(string key)
{
- if (key == "$mod")
- return Enum.GetName(typeof(Keys), _modKey);
-
var isNumeric = int.TryParse(key, out int _);
if (isNumeric)