1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-03 03:31:03 +02:00

fix(workspaces): add support for hyprland rename event

Renaming workspaces on Hyprland will now work as expected.

This also refactors the workspace code to depend on IDs rather than
names which should make it more robust against the same sort of issue
in future.

Fixes #469
This commit is contained in:
Jake Stanger 2024-05-06 16:46:26 +01:00
parent 3a1c604423
commit 5e7f576841
5 changed files with 52 additions and 21 deletions

View file

@ -149,12 +149,27 @@ impl Client {
}
{
event_listener.add_workspace_destroy_handler(move |workspace_type| {
let _lock = lock!(lock);
debug!("Received workspace destroy: {workspace_type:?}");
let tx = tx.clone();
let lock = lock.clone();
let name = get_workspace_name(workspace_type);
send!(tx, WorkspaceUpdate::Remove(name));
event_listener.add_workspace_rename_handler(move |data| {
let _lock = lock!(lock);
send!(
tx,
WorkspaceUpdate::Rename {
id: data.workspace_id.to_string(),
name: data.workspace_name
}
);
});
}
{
event_listener.add_workspace_destroy_handler(move |data| {
let _lock = lock!(lock);
debug!("Received workspace destroy: {data:?}");
send!(tx, WorkspaceUpdate::Remove(data.workspace_id.to_string()));
});
}

View file

@ -126,6 +126,12 @@ pub enum WorkspaceUpdate {
old: Option<Workspace>,
new: Workspace,
},
Rename {
id: String,
name: String,
},
/// An update was triggered by the compositor but this was not mapped by Ironbar.
///
/// This is purely used for ergonomics within the compositor clients