From fdfb2ce28d080ded8578728eefe2b4b6992d2f80 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Fri, 8 Dec 2023 12:28:22 +0900 Subject: [PATCH] updated wlogout without BC --- config/hypr/scripts/Wlogout.sh | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/config/hypr/scripts/Wlogout.sh b/config/hypr/scripts/Wlogout.sh index 5a90322..a7b2c63 100755 --- a/config/hypr/scripts/Wlogout.sh +++ b/config/hypr/scripts/Wlogout.sh @@ -17,33 +17,25 @@ if pgrep -x "wlogout" > /dev/null; then fi # Detect monitor resolution and scaling factor -resolution=$(hyprctl -j monitors | jq -r '.[] | select(.focused==true) | .height / .scale' | bc -l | cut -d '.' -f 1) +resolution=$(hyprctl -j monitors | jq -r '.[] | select(.focused==true) | .height / .scale' | awk -F'.' '{print $1}') hypr_scale=$(hyprctl -j monitors | jq -r '.[] | select(.focused==true) | .scale') echo "Detected Resolution: $resolution" # Set parameters based on screen resolution and scaling factor if ((resolution >= 2160)); then - wlogout --protocol layer-shell -b 3 -T $(echo "$A_2160 * 2160 / $resolution * $hypr_scale" | bc -l) -B $(echo "$B_2160 * 2160 / $resolution * $hypr_scale" | bc -l) & + wlogout --protocol layer-shell -b 3 -T $(awk "BEGIN {printf \"%.0f\", $A_2160 * 2160 * $hypr_scale / $resolution}") -B $(awk "BEGIN {printf \"%.0f\", $B_2160 * 2160 * $hypr_scale / $resolution}") & echo "Setting parameters for resolution >= 2160p" elif ((resolution >= 1440)); then - wlogout --protocol layer-shell -b 6 -T $(echo "$A_1440 * 1440 / $resolution * $hypr_scale" | bc -l) -B $(echo "$B_1440 * 1440 / $resolution * $hypr_scale" | bc -l) & + wlogout --protocol layer-shell -b 6 -T $(awk "BEGIN {printf \"%.0f\", $A_1440 * 1440 * $hypr_scale / $resolution}") -B $(awk "BEGIN {printf \"%.0f\", $B_1440 * 1440 * $hypr_scale / $resolution}") & echo "Setting parameters for resolution >= 1440p" elif ((resolution >= 1080)); then - wlogout --protocol layer-shell -b 6 -T $(echo "$A_1080 * 1080 / $resolution * $hypr_scale" | bc -l) -B $(echo "$B_1080 * 1080 / $resolution * $hypr_scale" | bc -l) & + wlogout --protocol layer-shell -b 6 -T $(awk "BEGIN {printf \"%.0f\", $A_1080 * 1080 * $hypr_scale / $resolution}") -B $(awk "BEGIN {printf \"%.0f\", $B_1080 * 1080 * $hypr_scale / $resolution}") & echo "Setting parameters for resolution >= 1080p" elif ((resolution > 720)); then - wlogout --protocol layer-shell -b 3 -T $(echo "$A_720 * 720 / $resolution * $hypr_scale" | bc -l) -B $(echo "$B_720 * 720 / $resolution * $hypr_scale" | bc -l) & + wlogout --protocol layer-shell -b 3 -T $(awk "BEGIN {printf \"%.0f\", $A_720 * 720 * $hypr_scale / $resolution}") -B $(awk "BEGIN {printf \"%.0f\", $B_720 * 720 * $hypr_scale / $resolution}") & echo "Setting parameters for resolution >= 720p" else wlogout & echo "Setting default parameters for resolution <= 720p" fi - -# Give some time for wlogout to start and exit -#sleep 30 - -# Check if wlogout is still running after starting -#if pgrep -x "wlogout" > /dev/null; then -# pkill -x "wlogout" -#fi \ No newline at end of file