diff --git a/komorebi-bar/src/widgets/applications.rs b/komorebi-bar/src/widgets/applications.rs index 0bf79d02..a4ae3f0c 100644 --- a/komorebi-bar/src/widgets/applications.rs +++ b/komorebi-bar/src/widgets/applications.rs @@ -44,7 +44,7 @@ pub struct ApplicationsConfig { pub spacing: Option, /// Default display format for all applications (optional). /// Could be overridden per application. Defaults to `Icon`. - pub display: Option, + pub display: Option, /// List of configured applications to display. pub items: Vec, } @@ -67,12 +67,12 @@ pub struct AppConfig { /// Command to execute (e.g. path to the application or shell command). pub command: String, /// Display format for this application button (optional). Overrides global format if set. - pub display: Option, + pub display: Option, } #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Default)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub enum DisplayFormat { +pub enum ApplicationsDisplayFormat { /// Show only the application icon. #[default] Icon, @@ -168,7 +168,7 @@ pub struct App { /// Command to execute when the application is launched. pub command: UserCommand, /// Display format (icon, text, or both). - pub display: DisplayFormat, + pub display: ApplicationsDisplayFormat, /// Whether to show the launch command on hover. pub show_command_on_hover: bool, } @@ -183,9 +183,9 @@ impl App { ui.spacing_mut().item_spacing = Vec2::splat(4.0); match self.display { - DisplayFormat::Icon => self.draw_icon(ctx, ui, icon_config), - DisplayFormat::Text => self.draw_name(ui), - DisplayFormat::IconAndText => { + ApplicationsDisplayFormat::Icon => self.draw_icon(ctx, ui, icon_config), + ApplicationsDisplayFormat::Text => self.draw_name(ui), + ApplicationsDisplayFormat::IconAndText => { self.draw_icon(ctx, ui, icon_config); self.draw_name(ui); } diff --git a/schema.bar.json b/schema.bar.json index 6f68f06c..bbff3eb0 100644 --- a/schema.bar.json +++ b/schema.bar.json @@ -262,7 +262,7 @@ "description": "Display format for this application button (optional). Overrides global format if set.", "anyOf": [ { - "$ref": "#/$defs/DisplayFormat" + "$ref": "#/$defs/ApplicationsDisplayFormat" }, { "type": "null" @@ -316,7 +316,7 @@ "description": "Default display format for all applications (optional).\nCould be overridden per application. Defaults to `Icon`.", "anyOf": [ { - "$ref": "#/$defs/DisplayFormat" + "$ref": "#/$defs/ApplicationsDisplayFormat" }, { "type": "null" @@ -355,6 +355,25 @@ "items" ] }, + "ApplicationsDisplayFormat": { + "oneOf": [ + { + "description": "Show only the application icon.", + "type": "string", + "const": "Icon" + }, + { + "description": "Show only the application name as text.", + "type": "string", + "const": "Text" + }, + { + "description": "Show both the application icon and name.", + "type": "string", + "const": "IconAndText" + } + ] + }, "Axis": { "type": "string", "enum": [ @@ -1034,25 +1053,6 @@ ] }, "DisplayFormat": { - "oneOf": [ - { - "description": "Show only the application icon.", - "type": "string", - "const": "Icon" - }, - { - "description": "Show only the application name as text.", - "type": "string", - "const": "Text" - }, - { - "description": "Show both the application icon and name.", - "type": "string", - "const": "IconAndText" - } - ] - }, - "DisplayFormat2": { "oneOf": [ { "description": "Show only icon", @@ -1298,13 +1298,13 @@ "HidingBehaviour": { "oneOf": [ { - "description": "END OF LIFE FEATURE: Use the SW_HIDE flag to hide windows when switching workspaces (has issues with Electron apps)", + "description": "END OF LIFE FEATURE: Use the `SW_HIDE` flag to hide windows when switching workspaces (has issues with Electron apps)", "type": "string", "const": "Hide", "deprecated": true }, { - "description": "Use the SW_MINIMIZE flag to hide windows when switching workspaces (has issues with frequent workspace switching)", + "description": "Use the `SW_MINIMIZE` flag to hide windows when switching workspaces (has issues with frequent workspace switching)", "type": "string", "const": "Minimize" }, @@ -1620,7 +1620,7 @@ "description": "Display format of the currently focused container", "anyOf": [ { - "$ref": "#/$defs/DisplayFormat2" + "$ref": "#/$defs/DisplayFormat" }, { "type": "null" @@ -1670,7 +1670,7 @@ "description": "Display format of the current layout", "anyOf": [ { - "$ref": "#/$defs/DisplayFormat2" + "$ref": "#/$defs/DisplayFormat" }, { "type": "null" @@ -1703,7 +1703,7 @@ "description": "Display format of the current locked state", "anyOf": [ { - "$ref": "#/$defs/DisplayFormat2" + "$ref": "#/$defs/DisplayFormat" }, { "type": "null" @@ -2147,7 +2147,7 @@ "description": "Display format of the current layer", "anyOf": [ { - "$ref": "#/$defs/DisplayFormat2" + "$ref": "#/$defs/DisplayFormat" }, { "type": "null" @@ -6661,7 +6661,7 @@ "const": "AllIconsAndTextOnSelected" }, { - "$ref": "#/$defs/DisplayFormat2" + "$ref": "#/$defs/DisplayFormat" } ] } diff --git a/schema.json b/schema.json index 4d56bead..e94dd684 100644 --- a/schema.json +++ b/schema.json @@ -184,7 +184,7 @@ ] }, "float_rule_placement": { - "description": "Determines the `Placement` to be used when spawning a window that matches a\n'floating_applications' rule (default: None)", + "description": "Determines the `Placement` to be used when spawning a window that matches a\n`floating_applications` rule (default: None)", "anyOf": [ { "$ref": "#/$defs/Placement" @@ -283,7 +283,7 @@ "deprecated": true }, "layered_applications": { - "description": "Identify applications that have the WS_EX_LAYERED extended window style", + "description": "Identify applications that have the `WS_EX_LAYERED` extended window style", "type": [ "array", "null" @@ -349,7 +349,7 @@ ] }, "object_name_change_applications": { - "description": "Identify applications that send EVENT_OBJECT_NAMECHANGE on launch (very rare)", + "description": "Identify applications that send `EVENT_OBJECT_NAMECHANGE` on launch (very rare)", "type": [ "array", "null" @@ -359,7 +359,7 @@ } }, "object_name_change_title_ignore_list": { - "description": "Do not process EVENT_OBJECT_NAMECHANGE events as Show events for identified applications matching these title regexes", + "description": "Do not process `EVENT_OBJECT_NAMECHANGE` events as Show events for identified applications matching these title regexes", "type": [ "array", "null" @@ -638,11 +638,11 @@ "AppSpecificConfigurationPath": { "anyOf": [ { - "description": "A single applications.json file", + "description": "A single `applications.json` file", "$ref": "#/$defs/PathBuf" }, { - "description": "Multiple applications.json files", + "description": "Multiple `applications.json` files", "type": "array", "items": { "$ref": "#/$defs/PathBuf" @@ -1290,13 +1290,13 @@ "HidingBehaviour": { "oneOf": [ { - "description": "END OF LIFE FEATURE: Use the SW_HIDE flag to hide windows when switching workspaces (has issues with Electron apps)", + "description": "END OF LIFE FEATURE: Use the `SW_HIDE` flag to hide windows when switching workspaces (has issues with Electron apps)", "type": "string", "const": "Hide", "deprecated": true }, { - "description": "Use the SW_MINIMIZE flag to hide windows when switching workspaces (has issues with frequent workspace switching)", + "description": "Use the `SW_MINIMIZE` flag to hide windows when switching workspaces (has issues with frequent workspace switching)", "type": "string", "const": "Minimize" },