summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2024-01-15 17:47:22 +0000
committerSean Whitton <spwhitton@spwhitton.name>2024-01-16 17:17:31 +0000
commit5a7cf7e3595c3a25c8885d40a0793228b80be7c1 (patch)
tree4a31c3948037e4d5272d44fe0bc0db4dcdca74ab /scripts
parent15733a679b7884e8253dc5dfbff1ef89f8879b4f (diff)
downloaddotfiles-5a7cf7e3595c3a25c8885d40a0793228b80be7c1.tar.gz
i3status-wrapper: implement simple monocle mode
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/desktop/i3status-wrapper8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/desktop/i3status-wrapper b/scripts/desktop/i3status-wrapper
index 68b10e01..81e1e7cc 100755
--- a/scripts/desktop/i3status-wrapper
+++ b/scripts/desktop/i3status-wrapper
@@ -273,6 +273,10 @@ unless (fork // warn "couldn't fork command pipe reader") {
} elsif ($i == $#$cols || $last_dir == 1) {
$mv->($i-1);
}
+ } elsif ($cmd eq "monocle toggle\n") {
+ $ws->{monocle} = !$ws->{monocle};
+ normalise_ws_cols();
+ kill USR1 => $i3status;
}
tied(%info)->unlock;
@@ -411,7 +415,7 @@ sub normalise_ws_cols {
my $i = first { $cols->[$_] eq $ws->{focused_col} } 0..$#$cols;
my $mid_i = floor @$cols/2;
# Pull column in if there are too few columns but some available.
- if ($ws->{ncols} > @$cols
+ if (!$ws->{monocle} && $ws->{ncols} > @$cols
&& ($ws->{off_left}->@* || $ws->{off_right}->@*)) {
if ($ws->{off_left}->@* # pull from left
@@ -436,7 +440,7 @@ sub normalise_ws_cols {
}
}
# Push a column off if there are too many columns.
- elsif (@$cols > $ws->{ncols}) {
+ elsif (@$cols > $ws->{ncols} || $ws->{monocle} && @$cols > 1) {
my $pushed = $i < $mid_i ? pop @$cols : shift @$cols;
$wmipc->cmd(hide_con($pushed));
push $ws->{$i < $mid_i ? "off_right" : "off_left"}->@*,