diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-05-14 16:39:34 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-05-14 16:40:22 -0700 |
commit | 17c92766ceac0099c100ed13c265fb9c208e2c1f (patch) | |
tree | 29d3ffa981ae58d91943d8a2e4ed4c2127712a9f /perl5 | |
parent | fd61aa3f4d2d802085b0b37f7340b4c63b14d820 (diff) | |
download | dotfiles-17c92766ceac0099c100ed13c265fb9c208e2c1f.tar.gz |
add bindings to move container to workspace and also go there
Diffstat (limited to 'perl5')
-rw-r--r-- | perl5/Local/Desktop.pm | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/perl5/Local/Desktop.pm b/perl5/Local/Desktop.pm index 189f3689..9e5910b5 100644 --- a/perl5/Local/Desktop.pm +++ b/perl5/Local/Desktop.pm @@ -59,20 +59,21 @@ sub fresh_workspace { "16:F6", "17:F7", "18:F8", "19:F9", "20:F10", "21:F11", "22:F12"; if ($next_free_workspace) { - if ($_[0]) { - # Send it there but don't change focus. User can use 'move - # container to workspace back_and_forth' binding to move any other - # wanted containers over there, before finally switching the view - # with 'workspace back_and_forth' - system - "$wmipc -q move container to workspace $next_free_workspace" - # Only the first of the three commands within this call to - # i3-msg should be necessary, but we need the others to work - # around https://github.com/swaywm/sway/issues/6081 - . ", workspace $next_free_workspace, workspace back_and_forth"; - } else { - system "$wmipc -q workspace $next_free_workspace"; - } + my @cmds; + my %opts = @_; + + push @cmds, "move container to workspace $next_free_workspace" + if $opts{send}; + + # When !$opts{go} we should execute neither of these commands, but we + # must work around <https://github.com/swaywm/sway/issues/6081>. + # + # In the case that !$opts{go}, can use 'C-i S-;' to move any other + # wanted containers over, before finally going there with 'C-i ;'. + push @cmds, "workspace $next_free_workspace"; + push @cmds, "workspace back_and_forth" unless $opts{go}; + + system "$wmipc -q " . join ", ", @cmds; } $next_free_workspace } |