diff options
| author | JaKooLit <jimmielovejay@gmail.com> | 2023-12-08 12:28:22 +0900 |
|---|---|---|
| committer | JaKooLit <jimmielovejay@gmail.com> | 2023-12-08 12:28:22 +0900 |
| commit | fdfb2ce28d080ded8578728eefe2b4b6992d2f80 (patch) | |
| tree | a2a9398a2e3b5a733833576810d286fa5e3fb38d /config/hypr | |
| parent | d78ea071b2e74e81a78f72e2b7b40ae490e3c899 (diff) | |
updated wlogout without BC
Diffstat (limited to 'config/hypr')
| -rwxr-xr-x | config/hypr/scripts/Wlogout.sh | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/config/hypr/scripts/Wlogout.sh b/config/hypr/scripts/Wlogout.sh index 5a903220..a7b2c639 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 |
