diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-08-16 16:26:23 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-08-17 16:18:14 -0700 |
commit | 0843a0015279c2d63567dac33236b57e75d0fa3d (patch) | |
tree | 59464c8a3d53cddc621237f531039f1cf140059c /scripts | |
parent | 06622e16d4ed25b5322461a7496d22489dee4d04 (diff) | |
download | dotfiles-0843a0015279c2d63567dac33236b57e75d0fa3d.tar.gz |
don't try to show/hide workspace buttons on i3
i3bar does not support toggling this at runtime.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/desktop/i3status-wrapper | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/desktop/i3status-wrapper b/scripts/desktop/i3status-wrapper index 7a9c489b..3ac4a5c6 100755 --- a/scripts/desktop/i3status-wrapper +++ b/scripts/desktop/i3status-wrapper @@ -81,7 +81,7 @@ open my $events, "-|", $wmipc, "-t", "subscribe", "-m", '[ "window", "workspace" ]'; my $workspaces = @{ decode_json `$wmipc -t get_workspaces` }; -$workspaces > 1 or wmipc "bar bar-0 workspace_buttons no"; +$workspaces > 1 or wsbuttons("no"); while (my $event = decode_json <$events>) { if ($event->{change} eq "mark") { @@ -95,9 +95,9 @@ while (my $event = decode_json <$events>) { kill USR1 => $i3status; } } elsif ($event->{change} eq "init") { - ++$workspaces == 2 and wmipc "bar bar-0 workspace_buttons yes"; + ++$workspaces == 2 and wsbuttons("yes"); } elsif ($event->{change} eq "empty") { - --$workspaces == 1 and wmipc "bar bar-0 workspace_buttons no"; + --$workspaces == 1 and wsbuttons("no"); # For simplicity, only fresh-workspace script calls compact_workspaces # atm. For greater consistency we could call it here, too, without @@ -106,3 +106,8 @@ while (my $event = decode_json <$events>) { # compact_workspaces; } } + +sub wsbuttons { + return unless $ENV{XDG_CURRENT_DESKTOP} eq "sway"; + wmipc "bar bar-0 workspace_buttons $_[0]"; +} |