[FEAT]: ability to swap focused WS on one monitor with visible WS on other monitor
In issue #88, the question was brought up as to whether Komorebi is able to replicate xmonad-like behavior. The move-workspace-to-monitor command was introduced to address this, but it does not handle the use-case of wanting to swap focused workspaces. For example, let's assume we have the following:
Monitor 0:
WS_A [focused]
WS_B
Monitor 1:
WS_C
WS_D [visible]
The behavior I would like to see is a command that results in the following:
Monitor 0:
WS_D [visible]
WS_B
Monitor 1:
WS_C
WS_A [focused]
(or maybe an additional command parameter to affect which monitor is focused in the end)
Is this currently possible in any easy way? If not, would it be possible to add something like a swap-workspace-with-monitor command?
Hi, I managed to achieve something similar to what you're describing with this workaround:
alt + 1 : $monitor_id=komorebic query focused-monitor-index; $workspace_id=komorebic query focused-workspace-index; komorebic focus-named-workspace I; $other_monitor_id=komorebic query focused-monitor-index; if ($monitor_id -ne $other_monitor_id){ komorebic move-workspace-to-monitor $monitor_id; komorebic focus-monitor-workspace $monitor_id $workspace_id; komorebic move-workspace-to-monitor $other_monitor_id; komorebic focus-named-workspace I; }
alt + 2 : $monitor_id=komorebic query focused-monitor-index; $workspace_id=komorebic query focused-workspace-index; komorebic focus-named-workspace II; $other_monitor_id=komorebic query focused-monitor-index; if ($monitor_id -ne $other_monitor_id){ komorebic move-workspace-to-monitor $monitor_id; komorebic focus-monitor-workspace $monitor_id $workspace_id; komorebic move-workspace-to-monitor $other_monitor_id; komorebic focus-named-workspace II; }
... # For all the other alt +
This allows the swap only if necessary and focused the target workspace in the source monitor. Hopefully it's somewhat useful, let me know if you manage to find a better way.