diff options
| author | JaKooLit <jimmielovejay@gmail.com> | 2023-12-08 09:03:24 +0900 |
|---|---|---|
| committer | JaKooLit <jimmielovejay@gmail.com> | 2023-12-08 09:03:24 +0900 |
| commit | 1c84e9cb86f4583ec581d4d57e47ce79d6af84ee (patch) | |
| tree | e44b7172ad68a4ddc74aa2132b94376d7efcaf76 /config/hypr/scripts | |
| parent | cd3e5ab0dcc64d1e72fbc534a6aa8a27a4cf64d4 (diff) | |
wlogout- added for scaling
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/Wlogout.sh | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/config/hypr/scripts/Wlogout.sh b/config/hypr/scripts/Wlogout.sh index 0cfb0907..b5008162 100755 --- a/config/hypr/scripts/Wlogout.sh +++ b/config/hypr/scripts/Wlogout.sh @@ -9,29 +9,31 @@ fi # detect monitor res x_mon=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .width') y_mon=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .height') -hypr_scale=$(hyprctl -j monitors | jq '.[] | select (.focused == true) | .scale' | sed 's/\.//') +hypr_scale=$(hyprctl -j monitors | jq -r '.[] | select(.focused==true) | .scale') -# Set parameters based on screen resolution -if [[ $x_mon =~ ^[0-9]+$ && $y_mon =~ ^[0-9]+$ && $hypr_scale =~ ^[0-9]+$ ]]; then - resolution=$((y_mon * hypr_scale / 100)) +# Set parameters based on screen resolution and scaling factor +if [[ $x_mon =~ ^[0-9]+$ && $y_mon =~ ^[0-9]+$ && $(echo "$hypr_scale > 0" | bc -l) -eq 1 ]]; then + resolution=$(echo "$y_mon / $hypr_scale" | bc -l | cut -d '.' -f 1) echo "Detected Resolution: $resolution" if ((resolution >= 2160)); then - wlogout --protocol layer-shell -b 6 -T 600 -B 700 & + wlogout --protocol layer-shell -b 6 -T $(echo "600 * 2160 / $resolution * $hypr_scale" | bc -l) -B $(echo "600 * 2160 / $resolution * $hypr_scale" | bc -l) & echo "Setting parameters for resolution >= 2160p" elif ((resolution >= 1440)); then - wlogout --protocol layer-shell -b 6 -T 500 -B 550 & + wlogout --protocol layer-shell -b 6 -T $(echo "500 * 1440 / $resolution * $hypr_scale" | bc -l) -B $(echo "550 * 1440 / $resolution * $hypr_scale" | bc -l) & echo "Setting parameters for resolution >= 1440p" elif ((resolution >= 1080)); then - wlogout --protocol layer-shell -b 6 -T 400 -B 400 & + wlogout --protocol layer-shell -b 6 -T $(echo "400 * 1080 / $resolution * $hypr_scale" | bc -l) -B $(echo "400 * 1080 / $resolution * $hypr_scale" | bc -l) & echo "Setting parameters for resolution >= 1080p" elif ((resolution >= 720)); then - wlogout --protocol layer-shell -b 3 -T 50 -B 50 & + wlogout --protocol layer-shell -b 3 -T $(echo "50 * 720 / $resolution * $hypr_scale" | bc -l) -B $(echo "50 * 720 / $resolution * $hypr_scale" | bc -l) & echo "Setting parameters for resolution >= 720p" - fi + fi fi +exit + # Give some time for wlogout to start and exit #sleep 30 |
