diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2024-02-21 20:28:48 +0800 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2024-02-21 21:21:42 +0800 |
commit | e713faaccc850b3df6b534c7e85ebc4976b7872d (patch) | |
tree | 8b9dbc3b8f43d581c748cb5a4822cee26a828e05 /scripts/desktop/i3status-wrapper | |
parent | 8f17340143c6e259d6344c704426f3249d53b6a0 (diff) | |
download | dotfiles-e713faaccc850b3df6b534c7e85ebc4976b7872d.tar.gz |
i3status-wrapper: add wrapper for (move to) next/prev workspace cmds
Diffstat (limited to 'scripts/desktop/i3status-wrapper')
-rwxr-xr-x | scripts/desktop/i3status-wrapper | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/desktop/i3status-wrapper b/scripts/desktop/i3status-wrapper index 22f01015..fb8d4e34 100755 --- a/scripts/desktop/i3status-wrapper +++ b/scripts/desktop/i3status-wrapper @@ -392,6 +392,27 @@ unless (fork // warn "couldn't fork command pipe reader") { } } + # Basic purpose of this wrapper command is to prevent accidentally + # moving to one of the holding workspaces using Sway's own commands. + elsif ($cmd =~ /^(move_)?workspace (prev|next)$/) { + my ($move, $dir) = (!!$1, $2); + $move && ensure_disable_monocle($ws); + my @keys = sorted_paper_ws(); + my $k = first { $keys[$_] == $info{focused_ws} } 0..$#keys; + if ($dir eq "next" && $k < $#keys || $dir eq "prev" && $k > 0) { + my @cmds = "workspace $dir"; + $info{focused_ws} = $keys[$dir eq "next" ? $k+1 : $k-1]; + if ($move) { + push @cmds, show_con($ws->{focused_col}); + push @cmds, "move right" + if $info{col_rows} + { $info{paper_ws}{$info{focused_ws}}{focused_col} }; + push @cmds, "focus child" if $col_rows; + } + $wmipc->cmd(@cmds); + } + } + tied(%info)->unlock; } } |