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

fix(workspaces): regression due to #572

Fixes #574
This commit is contained in:
Jake Stanger 2024-05-09 17:25:08 +01:00
parent 4695279d69
commit c45ea02a7d
5 changed files with 38 additions and 31 deletions

View file

@ -158,7 +158,7 @@ impl Client {
send!(
tx,
WorkspaceUpdate::Rename {
id: data.workspace_id.to_string(),
id: data.workspace_id as i64,
name: data.workspace_name
}
);
@ -169,7 +169,7 @@ impl Client {
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()));
send!(tx, WorkspaceUpdate::Remove(data.workspace_id as i64));
});
}
@ -279,7 +279,7 @@ fn create_is_visible() -> impl Fn(&HWorkspace) -> bool {
impl From<(Visibility, HWorkspace)> for Workspace {
fn from((visibility, workspace): (Visibility, HWorkspace)) -> Self {
Self {
id: workspace.id.to_string(),
id: workspace.id as i64,
name: workspace.name,
monitor: workspace.monitor,
visibility,

View file

@ -74,7 +74,7 @@ impl Compositor {
#[derive(Debug, Clone)]
pub struct Workspace {
/// Unique identifier
pub id: String,
pub id: i64,
/// Workspace friendly name
pub name: String,
/// Name of the monitor (output) the workspace is located on
@ -119,7 +119,7 @@ pub enum WorkspaceUpdate {
/// This is re-sent to all subscribers when a new subscription is created.
Init(Vec<Workspace>),
Add(Workspace),
Remove(String),
Remove(i64),
Move(Workspace),
/// Declares focus moved from the old workspace to the new.
Focus {
@ -128,7 +128,7 @@ pub enum WorkspaceUpdate {
},
Rename {
id: String,
id: i64,
name: String,
},

View file

@ -90,7 +90,7 @@ impl From<Node> for Workspace {
let visibility = Visibility::from(&node);
Self {
id: node.id.to_string(),
id: node.id,
name: node.name.unwrap_or_default(),
monitor: node.output.unwrap_or_default(),
visibility,
@ -103,7 +103,7 @@ impl From<swayipc_async::Workspace> for Workspace {
let visibility = Visibility::from(&workspace);
Self {
id: workspace.id.to_string(),
id: workspace.id,
name: workspace.name,
monitor: workspace.output,
visibility,
@ -141,13 +141,9 @@ impl From<WorkspaceEvent> for WorkspaceUpdate {
WorkspaceChange::Init => {
Self::Add(event.current.expect("Missing current workspace").into())
}
WorkspaceChange::Empty => Self::Remove(
event
.current
.expect("Missing current workspace")
.name
.unwrap_or_default(),
),
WorkspaceChange::Empty => {
Self::Remove(event.current.expect("Missing current workspace").id)
}
WorkspaceChange::Focus => Self::Focus {
old: event.old.map(Workspace::from),
new: Workspace::from(event.current.expect("Missing current workspace")),