1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34#!/bin/bash
# /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ##
# wlogout (Power, Screen Lock, Suspend, etc)
# Set variables for parameters
A_2160=450
B_2160=450
A_1600=400
B_1600=400
A_1440=350
B_1440=350
A_1080=350
B_1080=350
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 resolution and scaling factor
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')
# Set parameters based on screen resolution and scaling factor
T_val=$(awk "BEGIN {printf \"%.0f\", $A_720 * 720 * $hypr_scale / $resolution}")
B_val=$(awk "BEGIN {printf \"%.0f\", $B_720 * 720 * $hypr_scale / $resolution}")
echo "Setting parameters for resolution >= 720p and < 1080p"
wlogout --protocol layer-shell -b 2 -T $T_val -B $B_val &