diff options
| author | JaKooLit <ejhay.games@gmail.com> | 2025-02-20 22:52:34 +0900 |
|---|---|---|
| committer | JaKooLit <ejhay.games@gmail.com> | 2025-02-20 22:52:42 +0900 |
| commit | 9f5b41c3e230cda406592167fcd0446a5f56821c (patch) | |
| tree | 4d9e77d40ae58f03f57fb603a15ea18d49cd79b2 | |
| parent | fbd62fb8614cc0fdf1bf5f0c47c52b1b06659720 (diff) | |
updated wlogout.sh
| -rwxr-xr-x | config/hypr/scripts/Wlogout.sh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/config/hypr/scripts/Wlogout.sh b/config/hypr/scripts/Wlogout.sh index 7659008e..1f720b18 100755 --- a/config/hypr/scripts/Wlogout.sh +++ b/config/hypr/scripts/Wlogout.sh @@ -19,13 +19,16 @@ fi # Detect the current monitor's native resolution and scale monitor_info=$(hyprctl -j monitors | jq -r '.[] | select(.focused==true)') -# extract some info + resolution=$(echo "$monitor_info" | jq -r '.height') width=$(echo "$monitor_info" | jq -r '.width') hypr_scale=$(echo "$monitor_info" | jq -r '.scale') -# If hypr_scale >= 1.25 or resolution can't be detected, run wlogout with -b 3 -if [[ -z "$resolution" || ! "$resolution" =~ ^[0-9]+$ || -z "$hypr_scale" || $(awk "BEGIN {exit !($hypr_scale >= 1.25)}") -eq 1 ]]; then +# Round hypr_scale to 2 decimal places for accurate comparison +rounded_scale=$(echo "scale=2; $hypr_scale/1" | bc) + +# If resolution or scale is invalid or hypr_scale >= 1.25, run wlogout with -b 3 +if [[ -z "$resolution" || ! "$resolution" =~ ^[0-9]+$ || -z "$hypr_scale" || $(echo "$rounded_scale >= 1.25" | bc) -eq 1 ]]; then echo "Hypr_scale is greater than or equal to 1.25 or resolution could not be detected, running wlogout with -b 3" wlogout --protocol layer-shell -b 3 -T 100 -B 100 & exit 0 |
