From ceb4dfb53655f0a9c352a0d83f656b67317634e7 Mon Sep 17 00:00:00 2001 From: Boris Yumankulov Date: Fri, 15 Aug 2025 21:13:54 +0500 Subject: [PATCH] fix: use focused monitor as primary on hyprland Signed-off-by: Boris Yumankulov --- data_from_portwine/scripts/functions_helper | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index 8d2e1784..f602c05a 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -2870,7 +2870,17 @@ pw_skip_get_info () { PW_SCREEN_RESOLUTION="$(<"${PW_TMPFS_PATH}/xrandr.tmp" sed -rn 's/^.*primary.* ([0-9]+x[0-9]+).*$/\1/p')" PW_SCREEN_PRIMARY="$(grep -e 'primary' "${PW_TMPFS_PATH}/xrandr.tmp" | awk '{print $1}')" fi + + if [[ $PW_SCREEN_RESOLUTION != *x* ]] ; then + if command -v hyprctl >/dev/null 2>&1 ; then + monitor_info=$(hyprctl monitors -j 2>/dev/null | jq -r '.[] | select(.focused==true)') + PW_SCREEN_PRIMARY=$(echo "$monitor_info" | jq -r '.name') + PW_SCREEN_RESOLUTION=$(echo "$monitor_info" | jq -r '"\(.width)x\(.height)"') + fi + fi + [[ $PW_SCREEN_RESOLUTION != *x* ]] && PW_SCREEN_RESOLUTION="1920x1080" + export PW_SCREEN_PRIMARY PW_SCREEN_RESOLUTION if [[ -f "${PW_TMPFS_PATH}/locale.tmp" ]] ; then