diff options
| author | JaKooLit <jimmielovejay@gmail.com> | 2023-12-04 23:18:53 +0900 |
|---|---|---|
| committer | JaKooLit <jimmielovejay@gmail.com> | 2023-12-04 23:18:53 +0900 |
| commit | 512f8f902c98fa4f74cab74c1fe4e83e18aad661 (patch) | |
| tree | b91540e722aecfdd5989f074067b617cec832f9c /config/hypr/scripts | |
| parent | 8bae586d777f440537b8209b527484fbe4666c36 (diff) | |
wlogout-styling
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/Wlogout.sh | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/config/hypr/scripts/Wlogout.sh b/config/hypr/scripts/Wlogout.sh index c8ce86c1..0cfb0907 100755 --- a/config/hypr/scripts/Wlogout.sh +++ b/config/hypr/scripts/Wlogout.sh @@ -1,19 +1,41 @@ #!/bin/bash -# If you have 1440p, better to use this -#wlogout --protocol layer-shell -b 5 -T 600 -B 600 & +# Check if wlogout is already running +if pgrep -x "wlogout" > /dev/null; then + pkill -x "wlogout" + exit 0 +fi -# for 1080p -wlogout --protocol layer-shell -b 5 -T 450 -B 450 & +# 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/\.//') +# 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)) + + echo "Detected Resolution: $resolution" -# Capture the PID of the wlogout process -wlogout_pid=$! + if ((resolution >= 2160)); then + wlogout --protocol layer-shell -b 6 -T 600 -B 700 & + echo "Setting parameters for resolution >= 2160p" + elif ((resolution >= 1440)); then + wlogout --protocol layer-shell -b 6 -T 500 -B 550 & + echo "Setting parameters for resolution >= 1440p" + elif ((resolution >= 1080)); then + wlogout --protocol layer-shell -b 6 -T 400 -B 400 & + echo "Setting parameters for resolution >= 1080p" + elif ((resolution >= 720)); then + wlogout --protocol layer-shell -b 3 -T 50 -B 50 & + echo "Setting parameters for resolution >= 720p" + fi +fi -# Wait for up to 30 seconds for wlogout to exit gracefully -timeout 30s tail --pid $wlogout_pid -f /dev/null +# Give some time for wlogout to start and exit +#sleep 30 -# If wlogout is still running after the timeout, forcefully kill it -if ps -p $wlogout_pid > /dev/null; then - kill -KILL $wlogout_pid -fi +# Check if wlogout is still running after starting +#if pgrep -x "wlogout" > /dev/null; then +# pkill -x "wlogout" +#fi |
