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

This commit also addresses some clippy warnings.
This commit is contained in:
LGUG2Z committed 2025-12-23 17:07:56 -08:00
1 parent 1e71cb7d92
commit f6bfae3103
3 files changed
+40 -40

No files matched your search

+7 -7
View File
@@ -41,7 +41,7 @@ pub struct ApplicationsConfig {
pub spacing: Option<f32>,
/// Default display format for all applications (optional).
/// Could be overridden per application. Defaults to `Icon`.
pub display: Option<DisplayFormat>,
pub display: Option<ApplicationsDisplayFormat>,
/// List of configured applications to display.
pub items: Vec<AppConfig>,
}
@@ -64,12 +64,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<DisplayFormat>,
pub display: Option<ApplicationsDisplayFormat>,
}
#[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,
@@ -165,7 +165,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,
}
@@ -180,9 +180,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);
}
+7 -7
View File
@@ -1497,7 +1497,7 @@ impl Workspace {
0 | 1 => self.enforce_no_resize(),
_ => {
// Zero is actually on the left
if let Some(mut left) = resize_dimensions[0] {
if let Some(left) = resize_dimensions[0].as_mut() {
left.top = 0;
left.bottom = 0;
left.left = 0;
@@ -1530,7 +1530,7 @@ impl Workspace {
0 | 1 => self.enforce_no_resize(),
_ => {
// Zero is actually on the right
if let Some(mut left) = resize_dimensions[1] {
if let Some(left) = resize_dimensions[1].as_mut() {
left.top = 0;
left.bottom = 0;
left.right = 0;
@@ -1561,7 +1561,7 @@ impl Workspace {
match resize_dimensions.len() {
0 | 1 => self.enforce_no_resize(),
_ => {
if let Some(mut left) = resize_dimensions[0] {
if let Some(left) = resize_dimensions[0].as_mut() {
left.top = 0;
left.left = 0;
left.right = 0;
@@ -1592,14 +1592,14 @@ impl Workspace {
// Two windows can only be resized in the middle
2 => {
// Zero is actually on the right
if let Some(mut right) = resize_dimensions[0] {
if let Some(right) = resize_dimensions[0].as_mut() {
right.top = 0;
right.bottom = 0;
right.right = 0;
}
// One is on the left
if let Some(mut left) = resize_dimensions[1] {
if let Some(left) = resize_dimensions[1].as_mut() {
left.top = 0;
left.bottom = 0;
left.left = 0;
@@ -1609,13 +1609,13 @@ impl Workspace {
// stack on the right
_ => {
// Central can be resized left or right
if let Some(mut right) = resize_dimensions[0] {
if let Some(right) = resize_dimensions[0].as_mut() {
right.top = 0;
right.bottom = 0;
}
// Left one can only be resized to the right
if let Some(mut left) = resize_dimensions[1] {
if let Some(left) = resize_dimensions[1].as_mut() {
left.top = 0;
left.bottom = 0;
left.left = 0;
+26 -26
View File
@@ -173,7 +173,7 @@
"description": "Display format for this application button (optional). Overrides global format if set.",
"anyOf": [
{
"$ref": "#/$defs/DisplayFormat"
"$ref": "#/$defs/ApplicationsDisplayFormat"
},
{
"type": "null"
@@ -218,7 +218,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"
@@ -257,6 +257,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"
}
]
},
"Base16": {
"type": "string",
"enum": [
@@ -888,25 +907,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",
@@ -1408,7 +1408,7 @@
"description": "Display format of the currently focused container",
"anyOf": [
{
"$ref": "#/$defs/DisplayFormat2"
"$ref": "#/$defs/DisplayFormat"
},
{
"type": "null"
@@ -1457,7 +1457,7 @@
"description": "Display format of the current layout",
"anyOf": [
{
"$ref": "#/$defs/DisplayFormat2"
"$ref": "#/$defs/DisplayFormat"
},
{
"type": "null"
@@ -1490,7 +1490,7 @@
"description": "Display format of the current locked state",
"anyOf": [
{
"$ref": "#/$defs/DisplayFormat2"
"$ref": "#/$defs/DisplayFormat"
},
{
"type": "null"
@@ -1520,7 +1520,7 @@
"description": "Display format of the current layer",
"anyOf": [
{
"$ref": "#/$defs/DisplayFormat2"
"$ref": "#/$defs/DisplayFormat"
},
{
"type": "null"
@@ -2249,7 +2249,7 @@
"const": "AllIconsAndTextOnSelected"
},
{
"$ref": "#/$defs/DisplayFormat2"
"$ref": "#/$defs/DisplayFormat"
}
]
}