niri-tag/lib/main.rs

52 lines
1008 B
Rust

use std::collections::{HashMap, HashSet};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub enum TagCmd {
AddTagToWin(u8),
RemoveTagFromWin(u8),
EnableTag(u8),
DisableTag(u8),
ToggleTagOnWin(u8),
ToggleTag(u8),
ExclusiveTag(u8),
}
#[derive(Serialize, Debug)]
pub enum TagEvent {
TagEmpty(u8),
TagOccupied(u8),
TagUrgent(u8),
TagEnabled(u8),
TagDisabled(u8),
TagExclusive(u8),
TagFullState(HashMap<u8, TagState>),
}
#[derive(Serialize, Debug, Clone)]
pub struct TagState {
pub enabled: bool,
pub occupied: bool,
pub urgent: bool,
#[serde(skip_serializing)]
pub windows: HashSet<u64>,
}
impl Default for TagState {
fn default() -> Self {
Self {
enabled: true,
occupied: false,
urgent: false,
windows: HashSet::new(),
}
}
}
#[derive(Default, Deserialize)]
pub struct Config {
pub prepopulate: u8,
pub strict: bool,
}