GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat: changes to window rule config format
Lars Berger75d8f7a6e400
diff --git a/packages/wm/src/user_config.rs b/packages/wm/src/user_config.rsindex 76abef26..720a2953 100644--- a/packages/wm/src/user_config.rs+++ b/packages/wm/src/user_config.rs@@ -227,6 +227,7 @@ pub struct KeybindingConfig {#[serde(rename_all(serialize = "camelCase"))]pub struct WindowBehaviorConfig {/// New windows are created in this state whenever possible.+ #[serde(default)]pub initial_state: InitialWindowState,/// Sets the default options for when a new window is created. This also@@ -309,10 +310,51 @@ pub struct BorderEffectConfig {#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all(serialize = "camelCase"))]pub struct WindowRuleConfig {- pub match_process_name: Option<String>,- pub match_class_name: Option<String>,- pub match_title: Option<String>,pub commands: Vec<InvokeCommand>,++ #[serde(default)]+ pub match_type: MatchType,++ #[serde(rename = "match")]+ pub match_window: WindowMatchType,++ #[serde(default = "default_window_rule_on")]+ pub on: Vec<WindowMatchEvent>,++ #[serde(default = "default_bool::<true>")]+ pub run_once: bool,+}++#[derive(Clone, Debug, Default, Deserialize, Serialize)]+#[serde(rename_all = "snake_case")]+pub enum MatchType {+ All,+ #[default]+ Any,+}++#[derive(Clone, Debug, Deserialize, Serialize)]+#[serde(tag = "prop", content = "matchBy")]+pub enum WindowMatchType {+ WindowProcess(MatchBy),+ WindowClass(MatchBy),+ WindowTitle(MatchBy),+}++#[derive(Clone, Debug, Deserialize, Serialize)]+#[serde(tag = "type", content = "value")]+pub enum MatchBy {+ Equals(String),+ Includes(String),+ Regex(String),+}++#[derive(Clone, Debug, Deserialize, Serialize)]+#[serde(rename_all = "snake_case")]+pub enum WindowMatchEvent {+ Focus,+ Manage,+ TitleChange,}#[derive(Clone, Debug, Deserialize, Serialize)]@@ -339,3 +381,8 @@ const fn default_blue() -> Color {a: 255,}}++/// Helper function for setting a default value for window rule events.+fn default_window_rule_on() -> Vec<WindowMatchEvent> {+ vec![WindowMatchEvent::Manage, WindowMatchEvent::TitleChange]+}diff --git a/resources/sample-config.yaml b/resources/sample-config.yamlindex e8e85746..fc0f7d7e 100644--- a/resources/sample-config.yaml+++ b/resources/sample-config.yaml@@ -80,24 +80,33 @@ window_rules:# Task Manager requires admin privileges to manage and should be ignored# unless running the WM as admin.- commands: ['ignore']- match_process_name: '/Taskmgr|ScreenClippingHost/'+ match_type: 'any'+ match:+ - window_process: { equals: 'Taskmgr' }+ - window_process: { equals: 'ScreenClippingHost' }# Launches system dialogs as floating by default (e.g. File Explorer save# and open dialog).- commands: ['set-floating']- match_class_name: '#32770'+ match_type: 'any'+ match:+ - window_class: { equals: '#32770' }# Do not manage picture-in-picture windows for browsers. Note that the# default is for English; change `match_title` to the window's title if# you use another language.- commands: ['ignore']- match_title: '[Pp]icture.in.[Pp]icture'- match_class_name: 'Chrome_WidgetWin_1|MozillaDialogClass'+ match_type: 'all'+ match:+ - window_title: { regex: '[Pp]icture.in.[Pp]icture' }+ - window_class: { regex: 'Chrome_WidgetWin_1|MozillaDialogClass' }# Some applications (e.g. Steam) have borders that extend past the normal# border size.- commands: ['adjust-borders --right -7px --bottom -7px --left -7px']- match_process_name: 'steam'+ match_type: 'any'+ match:+ - window_process: { equals: 'steam' }binding_modes:# When enabled, the focused window can be resized via arrow keys or HJKL.