mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-17 06:41:03 +02:00
feat: add .urgent
workspace css class
This commit is contained in:
parent
32e6fc5dc2
commit
afe534ccd9
6 changed files with 80 additions and 9 deletions
|
@ -166,6 +166,9 @@ impl Client {
|
|||
}
|
||||
|
||||
{
|
||||
let tx = tx.clone();
|
||||
let lock = lock.clone();
|
||||
|
||||
event_listener.add_workspace_destroy_handler(move |data| {
|
||||
let _lock = lock!(lock);
|
||||
debug!("Received workspace destroy: {data:?}");
|
||||
|
@ -173,6 +176,35 @@ impl Client {
|
|||
});
|
||||
}
|
||||
|
||||
{
|
||||
event_listener.add_urgent_state_handler(move |address| {
|
||||
let _lock = lock!(lock);
|
||||
debug!("Received urgent state: {address:?}");
|
||||
|
||||
let clients = match hyprland::data::Clients::get() {
|
||||
Ok(clients) => clients,
|
||||
Err(err) => {
|
||||
error!("Failed to get clients: {err}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
clients.iter().find(|c| c.address == address).map_or_else(
|
||||
|| {
|
||||
error!("Unable to locate client");
|
||||
},
|
||||
|c| {
|
||||
send!(
|
||||
tx,
|
||||
WorkspaceUpdate::Urgent {
|
||||
id: c.workspace.id as i64,
|
||||
urgent: true,
|
||||
}
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
event_listener
|
||||
.start_listener()
|
||||
.expect("Failed to start listener");
|
||||
|
@ -194,6 +226,14 @@ impl Client {
|
|||
}
|
||||
);
|
||||
|
||||
send!(
|
||||
tx,
|
||||
WorkspaceUpdate::Urgent {
|
||||
id: workspace.id,
|
||||
urgent: false,
|
||||
}
|
||||
);
|
||||
|
||||
prev_workspace.replace(workspace);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue