diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2024-01-14 14:13:33 +0000 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2024-01-14 14:14:56 +0000 |
commit | 034cf4be2960cb09dd1efa4215638b9536916f3d (patch) | |
tree | c54a55543e804eeab4fea8959429787c398d11d5 | |
parent | 37dc2639a9453c0f24ed48cedb11223a6fb937a7 (diff) | |
download | dotfiles-034cf4be2960cb09dd1efa4215638b9536916f3d.tar.gz |
i3status-wrapper: index managed workspaces by ID, not name
-rwxr-xr-x | scripts/desktop/i3status-wrapper | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/desktop/i3status-wrapper b/scripts/desktop/i3status-wrapper index 702e4240..6f3cb007 100755 --- a/scripts/desktop/i3status-wrapper +++ b/scripts/desktop/i3status-wrapper @@ -63,7 +63,7 @@ unless (fork // warn "couldn't fork monitoring loop") { my @old_ids; for ($wmipc->get_workspaces->@*) { - $info{focused_ws} = $_->{name} if $_->{focused}; + $info{focused_ws} = $_->{id} if $_->{focused}; push @old_ids, $1 if $_->{name} =~ /\A\*(\d+)\*\z/; } if (@old_ids) { @@ -184,15 +184,15 @@ unless (fork // warn "couldn't fork monitoring loop") { # Workspace changes elsif ($e->{change} && $e->{change} eq "focus" && $e->{current}) { - $info{focused_ws} = $e->{current}{name}; + $info{focused_ws} = $e->{current}{id}; } elsif ($e->{change} && $e->{change} eq "init" && $e->{current}) { - $info{paper_ws}{$e->{current}{name}} + $info{paper_ws}{$e->{current}{id}} = { off_left => [], off_right => [], ncols => 2, cols => [] }; } elsif ($e->{change} && $e->{change} eq "empty" && $e->{current}) { - delete $info{paper_ws}{$e->{current}{name}}; + delete $info{paper_ws}{$e->{current}{id}}; } # Mark changes @@ -339,7 +339,7 @@ sub update_paper_ws_cols { foreach my $node ((shift @trees)->{nodes}->@*) { if ($node->{type} eq "workspace" && grep $_ eq $node->{name}, @all_workspaces) { - my $entry = $info{paper_ws}{$node->{name}} + my $entry = $info{paper_ws}{$node->{id}} //= { off_left => [], off_right => [] }; # Here we assume that the containers for the columns are |