feat: add config file

This commit is contained in:
atagen 2025-06-22 21:27:11 +10:00
parent 75538cc3d3
commit e6d2d0946a
5 changed files with 123 additions and 5 deletions

View file

@ -4,7 +4,7 @@ use niri_ipc::{
Action, Event, Reply, Request, Response, Window, Workspace, WorkspaceReferenceArg,
state::{EventStreamState, EventStreamStatePart},
};
use niri_tag::{TagCmd, TagEvent, TagState};
use niri_tag::{Config, TagCmd, TagEvent, TagState};
use smol::{
channel::{self, Sender},
future,
@ -14,6 +14,7 @@ use smol::{
use std::collections::HashMap;
pub struct NiriTag {
config: Config,
tags: HashMap<u8, bool>,
windows: HashMap<u64, u8>,
active_ws: Vec<u64>,
@ -28,13 +29,14 @@ enum TagAction {
}
impl NiriTag {
pub async fn new(ev_tx: channel::Sender<TagEvent>) -> Result<Self> {
pub async fn new(config: Config, ev_tx: channel::Sender<TagEvent>) -> Result<Self> {
Ok(Self {
config,
tags: HashMap::new(),
windows: HashMap::new(),
active_ws: Vec::new(),
state: EventStreamState::default(),
socket: create_niri_socket().await?,
active_ws: Vec::new(),
ev_tx,
})
}