2023-07-16 18:57:00 +01:00
|
|
|
use std::path::PathBuf;
|
|
|
|
|
2023-06-22 23:06:45 +01:00
|
|
|
use clap::Subcommand;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
#[derive(Subcommand, Debug, Serialize, Deserialize)]
|
2023-07-09 19:59:17 +01:00
|
|
|
#[serde(tag = "type", rename_all = "snake_case")]
|
2023-06-22 23:06:45 +01:00
|
|
|
pub enum Command {
|
|
|
|
/// Return "ok"
|
|
|
|
Ping,
|
|
|
|
|
|
|
|
/// Open the GTK inspector
|
|
|
|
Inspect,
|
|
|
|
|
2023-07-01 00:05:12 +01:00
|
|
|
/// Reload the config
|
|
|
|
Reload,
|
|
|
|
|
2023-06-22 23:07:40 +01:00
|
|
|
/// Set an `ironvar` value.
|
|
|
|
/// This creates it if it does not already exist, and updates it if it does.
|
|
|
|
/// Any references to this variable are automatically and immediately updated.
|
|
|
|
/// Keys and values can be any valid UTF-8 string.
|
|
|
|
Set {
|
2023-07-01 00:05:12 +01:00
|
|
|
/// Variable key. Can be any alphanumeric ASCII string.
|
2023-06-22 23:07:40 +01:00
|
|
|
key: Box<str>,
|
|
|
|
/// Variable value. Can be any valid UTF-8 string.
|
|
|
|
value: String,
|
|
|
|
},
|
|
|
|
|
|
|
|
/// Get the current value of an `ironvar`.
|
|
|
|
Get {
|
|
|
|
/// Variable key.
|
|
|
|
key: Box<str>,
|
|
|
|
},
|
2023-06-24 11:19:57 +01:00
|
|
|
|
|
|
|
/// Load an additional CSS stylesheet.
|
|
|
|
/// The sheet is automatically hot-reloaded.
|
|
|
|
LoadCss {
|
|
|
|
/// The path to the sheet.
|
|
|
|
path: PathBuf,
|
|
|
|
},
|
2023-07-12 18:17:04 -04:00
|
|
|
|
|
|
|
/// Set the visibility of the bar with the given name.
|
|
|
|
SetVisible {
|
|
|
|
///Bar name to target.
|
|
|
|
bar_name: String,
|
|
|
|
/// The visibility status.
|
2023-07-16 18:47:44 +01:00
|
|
|
#[arg(short, long)]
|
2023-07-12 18:17:04 -04:00
|
|
|
visible: bool,
|
|
|
|
},
|
|
|
|
|
|
|
|
/// Get the visibility of the bar with the given name.
|
|
|
|
GetVisible {
|
|
|
|
/// Bar name to target.
|
|
|
|
bar_name: String,
|
|
|
|
},
|
2023-07-16 18:57:00 +01:00
|
|
|
|
|
|
|
/// Toggle a popup open/closed.
|
|
|
|
/// If opening this popup, and a different popup on the same bar is already open, the other is closed.
|
|
|
|
TogglePopup {
|
|
|
|
/// The name of the monitor the bar is located on.
|
|
|
|
bar_name: String,
|
|
|
|
/// The name of the widget.
|
|
|
|
name: String,
|
|
|
|
},
|
|
|
|
|
|
|
|
/// Open a popup, regardless of current state.
|
|
|
|
OpenPopup {
|
|
|
|
/// The name of the monitor the bar is located on.
|
|
|
|
bar_name: String,
|
|
|
|
/// The name of the widget.
|
|
|
|
name: String,
|
|
|
|
},
|
|
|
|
|
|
|
|
/// Close a popup, regardless of current state.
|
|
|
|
ClosePopup {
|
|
|
|
/// The name of the monitor the bar is located on.
|
|
|
|
bar_name: String,
|
|
|
|
},
|
2023-06-22 23:07:40 +01:00
|
|
|
}
|