docs(schema): avoid duplicating display format enums in bar

This commit is contained in:
LGUG2Z
2025-12-22 19:30:29 -08:00
parent 4b1e3bd448
commit c91224295f
3 changed files with 43 additions and 43 deletions
+7 -7
View File
@@ -44,7 +44,7 @@ pub struct ApplicationsConfig {
pub spacing: Option<f32>, pub spacing: Option<f32>,
/// Default display format for all applications (optional). /// Default display format for all applications (optional).
/// Could be overridden per application. Defaults to `Icon`. /// Could be overridden per application. Defaults to `Icon`.
pub display: Option<DisplayFormat>, pub display: Option<ApplicationsDisplayFormat>,
/// List of configured applications to display. /// List of configured applications to display.
pub items: Vec<AppConfig>, pub items: Vec<AppConfig>,
} }
@@ -67,12 +67,12 @@ pub struct AppConfig {
/// Command to execute (e.g. path to the application or shell command). /// Command to execute (e.g. path to the application or shell command).
pub command: String, pub command: String,
/// Display format for this application button (optional). Overrides global format if set. /// Display format for this application button (optional). Overrides global format if set.
pub display: Option<DisplayFormat>, pub display: Option<ApplicationsDisplayFormat>,
} }
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Default)] #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Default)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub enum DisplayFormat { pub enum ApplicationsDisplayFormat {
/// Show only the application icon. /// Show only the application icon.
#[default] #[default]
Icon, Icon,
@@ -168,7 +168,7 @@ pub struct App {
/// Command to execute when the application is launched. /// Command to execute when the application is launched.
pub command: UserCommand, pub command: UserCommand,
/// Display format (icon, text, or both). /// Display format (icon, text, or both).
pub display: DisplayFormat, pub display: ApplicationsDisplayFormat,
/// Whether to show the launch command on hover. /// Whether to show the launch command on hover.
pub show_command_on_hover: bool, pub show_command_on_hover: bool,
} }
@@ -183,9 +183,9 @@ impl App {
ui.spacing_mut().item_spacing = Vec2::splat(4.0); ui.spacing_mut().item_spacing = Vec2::splat(4.0);
match self.display { match self.display {
DisplayFormat::Icon => self.draw_icon(ctx, ui, icon_config), ApplicationsDisplayFormat::Icon => self.draw_icon(ctx, ui, icon_config),
DisplayFormat::Text => self.draw_name(ui), ApplicationsDisplayFormat::Text => self.draw_name(ui),
DisplayFormat::IconAndText => { ApplicationsDisplayFormat::IconAndText => {
self.draw_icon(ctx, ui, icon_config); self.draw_icon(ctx, ui, icon_config);
self.draw_name(ui); self.draw_name(ui);
} }
+28 -28
View File
@@ -262,7 +262,7 @@
"description": "Display format for this application button (optional). Overrides global format if set.", "description": "Display format for this application button (optional). Overrides global format if set.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/$defs/DisplayFormat" "$ref": "#/$defs/ApplicationsDisplayFormat"
}, },
{ {
"type": "null" "type": "null"
@@ -316,7 +316,7 @@
"description": "Default display format for all applications (optional).\nCould be overridden per application. Defaults to `Icon`.", "description": "Default display format for all applications (optional).\nCould be overridden per application. Defaults to `Icon`.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/$defs/DisplayFormat" "$ref": "#/$defs/ApplicationsDisplayFormat"
}, },
{ {
"type": "null" "type": "null"
@@ -355,6 +355,25 @@
"items" "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": { "Axis": {
"type": "string", "type": "string",
"enum": [ "enum": [
@@ -1034,25 +1053,6 @@
] ]
}, },
"DisplayFormat": { "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": [ "oneOf": [
{ {
"description": "Show only icon", "description": "Show only icon",
@@ -1298,13 +1298,13 @@
"HidingBehaviour": { "HidingBehaviour": {
"oneOf": [ "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", "type": "string",
"const": "Hide", "const": "Hide",
"deprecated": true "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", "type": "string",
"const": "Minimize" "const": "Minimize"
}, },
@@ -1620,7 +1620,7 @@
"description": "Display format of the currently focused container", "description": "Display format of the currently focused container",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/$defs/DisplayFormat2" "$ref": "#/$defs/DisplayFormat"
}, },
{ {
"type": "null" "type": "null"
@@ -1670,7 +1670,7 @@
"description": "Display format of the current layout", "description": "Display format of the current layout",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/$defs/DisplayFormat2" "$ref": "#/$defs/DisplayFormat"
}, },
{ {
"type": "null" "type": "null"
@@ -1703,7 +1703,7 @@
"description": "Display format of the current locked state", "description": "Display format of the current locked state",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/$defs/DisplayFormat2" "$ref": "#/$defs/DisplayFormat"
}, },
{ {
"type": "null" "type": "null"
@@ -2147,7 +2147,7 @@
"description": "Display format of the current layer", "description": "Display format of the current layer",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/$defs/DisplayFormat2" "$ref": "#/$defs/DisplayFormat"
}, },
{ {
"type": "null" "type": "null"
@@ -6661,7 +6661,7 @@
"const": "AllIconsAndTextOnSelected" "const": "AllIconsAndTextOnSelected"
}, },
{ {
"$ref": "#/$defs/DisplayFormat2" "$ref": "#/$defs/DisplayFormat"
} }
] ]
} }
+8 -8
View File
@@ -184,7 +184,7 @@
] ]
}, },
"float_rule_placement": { "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": [ "anyOf": [
{ {
"$ref": "#/$defs/Placement" "$ref": "#/$defs/Placement"
@@ -283,7 +283,7 @@
"deprecated": true "deprecated": true
}, },
"layered_applications": { "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": [ "type": [
"array", "array",
"null" "null"
@@ -349,7 +349,7 @@
] ]
}, },
"object_name_change_applications": { "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": [ "type": [
"array", "array",
"null" "null"
@@ -359,7 +359,7 @@
} }
}, },
"object_name_change_title_ignore_list": { "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": [ "type": [
"array", "array",
"null" "null"
@@ -638,11 +638,11 @@
"AppSpecificConfigurationPath": { "AppSpecificConfigurationPath": {
"anyOf": [ "anyOf": [
{ {
"description": "A single applications.json file", "description": "A single `applications.json` file",
"$ref": "#/$defs/PathBuf" "$ref": "#/$defs/PathBuf"
}, },
{ {
"description": "Multiple applications.json files", "description": "Multiple `applications.json` files",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/$defs/PathBuf" "$ref": "#/$defs/PathBuf"
@@ -1290,13 +1290,13 @@
"HidingBehaviour": { "HidingBehaviour": {
"oneOf": [ "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", "type": "string",
"const": "Hide", "const": "Hide",
"deprecated": true "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", "type": "string",
"const": "Minimize" "const": "Minimize"
}, },