32 lines
691 B
Rust
32 lines
691 B
Rust
use std::fmt::{Display, Formatter};
|
|
use std::str::FromStr;
|
|
|
|
pub mod config;
|
|
pub mod theme;
|
|
|
|
pub const SOCKET_PATH: &str = "/run/user/1000/jmb-bar.sock";
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub enum ControlCommand {
|
|
OpenRunMenu,
|
|
}
|
|
|
|
impl Display for ControlCommand {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
ControlCommand::OpenRunMenu => f.write_str("menu"),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl FromStr for ControlCommand {
|
|
type Err = String;
|
|
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
match s {
|
|
"menu" => Ok(ControlCommand::OpenRunMenu),
|
|
other => Err(format!("Unknown command: {other}")),
|
|
}
|
|
}
|
|
}
|