aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts
diff options
context:
space:
mode:
authorJaKooLit <jimmielovejay@gmail.com>2023-12-08 11:05:31 +0900
committerJaKooLit <jimmielovejay@gmail.com>2023-12-08 11:05:45 +0900
commitd78ea071b2e74e81a78f72e2b7b40ae490e3c899 (patch)
treeb9d59157a378599f3994ea480e810d6a21f8a2e5 /config/hypr/scripts
parent0ba1c107a157b169364a6c7b39c598a0089065cd (diff)
updated wlogout
Diffstat (limited to 'config/hypr/scripts')
-rwxr-xr-xconfig/hypr/scripts/Wlogout.sh55
1 files changed, 30 insertions, 25 deletions
diff --git a/config/hypr/scripts/Wlogout.sh b/config/hypr/scripts/Wlogout.sh
index e8ff54f7..5a903220 100755
--- a/config/hypr/scripts/Wlogout.sh
+++ b/config/hypr/scripts/Wlogout.sh
@@ -1,38 +1,43 @@
#!/bin/bash
+# Set variables for parameters
+A_2160=1000
+B_2160=1000
+A_1440=500
+B_1440=550
+A_1080=300
+B_1080=380
+A_720=50
+B_720=50
+
# Check if wlogout is already running
if pgrep -x "wlogout" > /dev/null; then
pkill -x "wlogout"
exit 0
fi
-# detect monitor res
-x_mon=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .width')
-y_mon=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .height')
+# Detect monitor resolution and scaling factor
+resolution=$(hyprctl -j monitors | jq -r '.[] | select(.focused==true) | .height / .scale' | bc -l | cut -d '.' -f 1)
hypr_scale=$(hyprctl -j monitors | jq -r '.[] | select(.focused==true) | .scale')
-# 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"
+echo "Detected Resolution: $resolution"
- if ((resolution >= 2160)); then
- wlogout --protocol layer-shell -b 6 -T $(echo "600 * 2160 / $resolution * $hypr_scale" | bc -l) -B $(echo "700 * 2160 / $resolution * $hypr_scale" | bc -l) &
- echo "Setting parameters for resolution >= 2160p"
- elif ((resolution >= 1440)); then
- 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 $(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 $(echo "50 * 720 / $resolution * $hypr_scale" | bc -l) -B $(echo "50 * 720 / $resolution * $hypr_scale" | bc -l) &
- echo "Setting parameters for resolution >= 720p"
- else
- wlogout &
- echo "Setting default parameters for resolution <= 720p"
- fi
+# 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) &
+ 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) &
+ 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) &
+ 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) &
+ 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
@@ -41,4 +46,4 @@ fi
# Check if wlogout is still running after starting
#if pgrep -x "wlogout" > /dev/null; then
# pkill -x "wlogout"
-#fi
+#fi \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage