Skip to content

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

feat(domain): create default window rules for class/process names to always ignore

Lars Berger6cd04d494ef4
diff --git a/LarsWM.Domain/UserConfigs/UserConfig.cs b/LarsWM.Domain/UserConfigs/UserConfig.cs
index 4d518e0d..d52fdab4 100644
--- a/LarsWM.Domain/UserConfigs/UserConfig.cs
+++ b/LarsWM.Domain/UserConfigs/UserConfig.cs
@@ -7,46 +7,6 @@ namespace LarsWM.Domain.UserConfigs
{
public Guid Id = Guid.NewGuid();
- // TODO: Allow regular expressions.
- // eg. for WMP's "now playing" toolbar: StartsWith("WMP9MediaBarFlyout"))
- public List<string> WindowClassesToIgnore = new List<string> {
- // Tray on primary screen.
- "Shell_TrayWnd",
- // Trays on secondary screens.
- "Shell_SecondaryTrayWnd",
- // Task manager.
- "TaskManagerWindow",
- // Microsoft Text Framework service IME.
- "MSCTFIME UI",
- // Desktop window (holds wallpaper & desktop icons).
- "SHELLDLL_DefView",
- // Background for lock screen.
- "LockScreenBackstopFrame",
- // Windows 10 shell.
- "Progman",
- // Windows 7 open Start Menu.
- "DV2ControlHost",
- // Windows 8 charm bar.
- "Shell_CharmWindow",
-
- /*
- * Consider adding:
- * "MsgrIMEWindowClass", // Window live messenger notification.
- * "SysShadow", // Windows live messenger shadow-hack.
- * "Button", // UI component, e.g. Start Menu button.
- * "Frame Alternate Owner", // Edge.
- * "MultitaskingViewFrame", // The original Win + Tab view.
- */
- };
-
- public List<string> ProcessNamesToIgnore = new List<string> {
- "SearchUI",
- "ShellExperienceHost",
- "LockApp",
- "PeopleExperienceHost",
- "StartMenuExperienceHost",
- };
-
public string ModKey { get; set; } = "Alt";
public double ResizePercentage { get; set; } = 5;
diff --git a/LarsWM.Domain/UserConfigs/UserConfigService.cs b/LarsWM.Domain/UserConfigs/UserConfigService.cs
index 8c3d3154..cf067afa 100644
--- a/LarsWM.Domain/UserConfigs/UserConfigService.cs
+++ b/LarsWM.Domain/UserConfigs/UserConfigService.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
namespace LarsWM.Domain.UserConfigs
@@ -22,5 +23,65 @@ namespace LarsWM.Domain.UserConfigs
Directory.GetCurrentDirectory(),
"../LarsWM.Domain/UserConfigs/SampleUserConfig.yaml"
);
+
+ public readonly List<WindowRuleConfig> DefaultWindowRules = GetDefaultWindowRules();
+
+ private static List<WindowRuleConfig> GetDefaultWindowRules()
+ {
+ var windowRules = new List<WindowRuleConfig>();
+
+ var classNamesToIgnore = new List<string> {
+ // Tray on primary screen.
+ "Shell_TrayWnd",
+ // Trays on secondary screens.
+ "Shell_SecondaryTrayWnd",
+ // Task manager.
+ "TaskManagerWindow",
+ // Microsoft Text Framework service IME.
+ "MSCTFIME UI",
+ // Desktop window (holds wallpaper & desktop icons).
+ "SHELLDLL_DefView",
+ // Background for lock screen.
+ "LockScreenBackstopFrame",
+ // Windows 10 shell.
+ "Progman",
+ // Windows 7 open Start Menu.
+ "DV2ControlHost",
+ // Windows 8 charm bar.
+ "Shell_CharmWindow",
+ };
+
+ foreach (var className in classNamesToIgnore)
+ {
+ var windowRule = new WindowRuleConfig()
+ {
+ MatchClassName = className,
+ Action = "ignore",
+ };
+
+ windowRules.Add(windowRule);
+ }
+
+ var processNamesToIgnore = new List<string> {
+ "SearchUI",
+ "ShellExperienceHost",
+ "LockApp",
+ "PeopleExperienceHost",
+ "StartMenuExperienceHost",
+ };
+
+ foreach (var processName in processNamesToIgnore)
+ {
+ var windowRule = new WindowRuleConfig()
+ {
+ MatchProcessName = processName,
+ Action = "ignore",
+ };
+
+ windowRules.Add(windowRule);
+ }
+
+ return windowRules;
+ }
}
}