From 7b99bb08e57cdc03d65a72d413f3b7779f5c9401 Mon Sep 17 00:00:00 2001 From: rocknix Date: Thu, 30 Oct 2025 20:54:45 +0000 Subject: [PATCH] Prevent screen switching on emulationstation --- .../apps/screen-switch/scripts/screen_switch | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/projects/ROCKNIX/packages/apps/screen-switch/scripts/screen_switch b/projects/ROCKNIX/packages/apps/screen-switch/scripts/screen_switch index 82d4e8d81c..c94dd8b20d 100644 --- a/projects/ROCKNIX/packages/apps/screen-switch/scripts/screen_switch +++ b/projects/ROCKNIX/packages/apps/screen-switch/scripts/screen_switch @@ -2,12 +2,20 @@ source /etc/profile -# Get the active app_id ACTIVE_APPID=$(swaymsg -t get_tree | awk ' /"focused": true/ {focused=1} - focused && /app_id/ {gsub(/.*"app_id": *"/,""); gsub(/".*/,""); print; exit} + focused && /"app_id":/ { + gsub(/.*"app_id": *"/,""); gsub(/".*/,""); print; exit + } ') -UDSI=$(swaymsg -t get_tree | jq -r '.. | objects | select(.type == "output" and .name != "__i3") | select(.nodes[].nodes | length == 0) | .name') +UDSI=$(swaymsg -t get_tree | jq -r ' + .. | objects + | select(.type == "output" and .name != "__i3") + | select(.nodes[].nodes | length == 0) + | .name +') -swaymsg [app_id=\"${ACTIVE_APPID}\"] move window to output ${UDSI} +if [[ -n "$ACTIVE_APPID" && "$ACTIVE_APPID" != "emulationstation" && -n "$UDSI" ]]; then + swaymsg "[app_id=\"${ACTIVE_APPID}\"]" move window to output "${UDSI}" +fi