Using the same shortcut for 'focus right window' and 'focus next workspace' if there is no right window to focus to #450

Closed
opened 2026-01-05 14:50:48 +01:00 by adam · 2 comments
Owner

Originally created by @vitusli on GitHub (Aug 18, 2024).

Hello there! Throughout Windows, MacOS and Linux I want to have similiar shortcuts, less of them (context sensitive) and a coherent user experience. The following scenario is inspired by paperWM on Gnome:

Scenario 1

  • I have two windows open (vertically split) on workspace 1 and my active window is the left one. To focus the right one I hit alt - l and it is focussed. Now the active window is the right one.
  • Now I want to focus a third window opened in workspace 2. Logically this is just the next window in right direction. So I want to hit alt-l again to focus it. So the workspace should change from 1 to 2 and the opened (third) window on workspace 2 should be focussed.

On Mac OS in Yabai I achived that with this shortcut:
alt - l : yabai -m window --focus east || yabai -m space --focus next
When the first command fails (because there is no right/east window) it will execute the second command.

My solution I tried for this in Komorebi is:
alt + l : if (!(komorebic focus right)) { komorebic cycle-workspace next }

It works - with the next workspace (to the right) flashing up very short each time I focus left or right within the current workspace. I don't know how to get this fluent.

Scenario 2:

Also I want to achieve to move the active window to the workspace to the right if there is no window to the right in the current workspace.

In Yabai I simply achive this with:
alt + shift - l: yabai -m window --swap east || yabai -m window --space next

But in Komorebi this does not work using the same principle like in scenario 1:
alt + shift + l : if (!(komorebic move right)) { komorebic.exe cycle-move-to-workspace previous }
This simply moves the active window to the next workspace although there is a window to its right which should be swapped with at first. I only want the active window to be moved to the next space if there is no window to its right.


I am very new to coding but very enthusiastic and curious. I would be very happy about practical tips and input. Thank you very much for all your gorgeous work.

Originally created by @vitusli on GitHub (Aug 18, 2024). Hello there! Throughout Windows, MacOS and Linux I want to have similiar shortcuts, less of them (context sensitive) and a coherent user experience. The following scenario is inspired by [paperWM](https://github.com/paperwm/PaperWM) on Gnome: ### Scenario 1 - I have two windows open (vertically split) on workspace 1 and my active window is the left one. To focus the right one I hit `alt - l` and it is focussed. Now the active window is the right one. - Now I want to focus a third window opened in workspace 2. Logically this is just the next window in right direction. So I want to hit `alt-l` again to focus it. So the workspace should change from 1 to 2 and the opened (third) window on workspace 2 should be focussed. On Mac OS in [Yabai](https://github.com/koekeishiya/yabai) I achived that with this shortcut: `alt - l : yabai -m window --focus east || yabai -m space --focus next` When the first command fails (because there is no right/east window) it will execute the second command. My solution I tried for this in Komorebi is: `alt + l : if (!(komorebic focus right)) { komorebic cycle-workspace next }` It works - with the next workspace (to the right) flashing up very short each time I focus left or right within the current workspace. I don't know how to get this fluent. ### Scenario 2: Also I want to achieve to move the active window to the workspace to the right if there is no window to the right in the current workspace. In Yabai I simply achive this with: `alt + shift - l: yabai -m window --swap east || yabai -m window --space next` But in Komorebi this does *not* work using the same principle like in scenario 1: `alt + shift + l : if (!(komorebic move right)) { komorebic.exe cycle-move-to-workspace previous }` This simply moves the active window to the next workspace although there is a window to its right which should be swapped with at first. I only want the active window to be moved to the next space if there is no window to its right. --- I am very new to coding but very enthusiastic and curious. I would be very happy about practical tips and input. Thank you very much for all your gorgeous work.
adam added the enhancement label 2026-01-05 14:50:48 +01:00
adam closed this issue 2026-01-05 14:50:48 +01:00
Author
Owner

@LGUG2Z commented on GitHub (Aug 18, 2024):

Interesting ideas. Handling directions from a screen edge has typically always defaulted to trying to direct the user to another monitor in that direction in most twms. I like this idea of a user being able to opt-in to a behaviour where if you're on the left or right screen edge, triggering an action in a direction crosses the workspace boundaries instead of the monitor boundaries.

I'm not a big fan of how yabai and others require scripting to achieve this. I think this should be a first class configuration option that users can just turn on and off. I'll look into implementing something like this for v0.1.30.

@LGUG2Z commented on GitHub (Aug 18, 2024): Interesting ideas. Handling directions from a screen edge has typically always defaulted to trying to direct the user to another monitor in that direction in most twms. I like this idea of a user being able to opt-in to a behaviour where if you're on the left or right screen edge, triggering an action in a direction crosses the workspace boundaries instead of the monitor boundaries. I'm not a big fan of how yabai and others require scripting to achieve this. I think this should be a first class configuration option that users can just turn on and off. I'll look into implementing something like this for v0.1.30.
Author
Owner

@vitusli commented on GitHub (Aug 18, 2024):

Thanks a lot for the quick answer! Also in Yabai when I reach the top or bottom screen edge I switch Monitor because my laptop is always in front of me "under" my monitor. I am very excited to use your solution.

@vitusli commented on GitHub (Aug 18, 2024): Thanks a lot for the quick answer! Also in Yabai when I reach the top or bottom screen edge I switch Monitor because my laptop is always in front of me "under" my monitor. I am very excited to use your solution.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#450