From d6a081855540225da5dcee750a2f1ec01f49dea8 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Wed, 13 Mar 2024 10:07:56 +0100 Subject: [PATCH] yabai: do not run workaround if QL windows exist on display --- system/darwin/yabai.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/system/darwin/yabai.nix b/system/darwin/yabai.nix index b64648a..714e756 100644 --- a/system/darwin/yabai.nix +++ b/system/darwin/yabai.nix @@ -46,10 +46,14 @@ let app_display=$(${yabai-bin} -m query --windows --window $YABAI_WINDOW_ID | ${jq-bin} '.display') [ -z "$app_display" ] && app_display=$(${yabai-bin} -m query --displays --display mouse | ${jq-bin} '.index') - if [ $app_display -eq 1 ]; then - ${yabai-bin} -m display --focus next && yabai -m display --focus prev - else - ${yabai-bin} -m display --focus prev && yabai -m display --focus next + ql_windows=$(${yabai-bin} -m query --windows --display $app_display | ${jq-bin} 'map(select(.subrole == "Quick Look")) | length') + + if [ $ql_windows -eq 0 ]; then + if [ $app_display -eq 1 ]; then + ${yabai-bin} -m display --focus next && yabai -m display --focus prev + else + ${yabai-bin} -m display --focus prev && yabai -m display --focus next + fi fi ''; in