Skip to content

Commit

Permalink
updated wlogout.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
JaKooLit committed Feb 20, 2025
1 parent fbd62fb commit 9f5b41c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions config/hypr/scripts/Wlogout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit 9f5b41c

@experience4678
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thankyou sir

Please sign in to comment.