1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 14:51:04 +02:00

docs: add rustdoc comments to all module options

This part of an upcoming effort to generate documentation from code.

Pushing this out before that stage so that the JSON schema is fully documented.
This commit is contained in:
Jake Stanger 2024-05-19 15:16:01 +01:00
parent 3b6480f3f2
commit c7743b28c6
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
24 changed files with 833 additions and 48 deletions

View file

@ -29,19 +29,28 @@ use tracing::{debug, error};
#[derive(Debug, Deserialize, Clone)]
pub struct CustomModule {
/// Widgets to add to the bar container
/// Modules and widgets to add to the bar container.
///
/// **Default**: `[]`
bar: Vec<WidgetConfig>,
/// Widgets to add to the popup container
/// Modules and widgets to add to the popup container.
///
/// **Default**: `null`
popup: Option<Vec<WidgetConfig>>,
/// See [common options](module-level-options#common-options).
#[serde(flatten)]
pub common: Option<CommonConfig>,
}
#[derive(Debug, Deserialize, Clone)]
pub struct WidgetConfig {
/// One of a custom module native Ironbar module.
#[serde(flatten)]
widget: WidgetOrModule,
/// See [common options](module-level-options#common-options).
#[serde(flatten)]
common: CommonConfig,
}
@ -49,18 +58,27 @@ pub struct WidgetConfig {
#[derive(Debug, Deserialize, Clone)]
#[serde(untagged)]
pub enum WidgetOrModule {
/// A custom-module specific basic widget
Widget(Widget),
/// A native Ironbar module, such as `clock` or `focused`.
/// All widgets are supported, including their popups.
Module(ModuleConfig),
}
#[derive(Debug, Deserialize, Clone)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum Widget {
/// A container to place nested widgets inside.
Box(BoxWidget),
/// A text label. Pango markup is supported.
Label(LabelWidget),
/// A clickable button, which can run a command when clicked.
Button(ButtonWidget),
/// An image or icon from disk or http.
Image(ImageWidget),
/// A draggable slider.
Slider(SliderWidget),
/// A progress bar.
Progress(ProgressWidget),
}