Update hyprlock.sh
This commit is contained in:
parent
52124b7e69
commit
fdf8b0bcec
15
hyprlock.sh
15
hyprlock.sh
@ -5,7 +5,8 @@ unlockedMonitorYPositions=(0 0 0)
|
|||||||
lockedMonitorYPositions=(1080 1080 1080)
|
lockedMonitorYPositions=(1080 1080 1080)
|
||||||
|
|
||||||
monitors=$(hyprctl -j monitors)
|
monitors=$(hyprctl -j monitors)
|
||||||
monitorIndices=$(seq 0 $(($(echo "$monitors" | jq length)-1)))
|
tailMonitorIndex=$(($(echo "$monitors" | jq length)-1))
|
||||||
|
monitorIndices=$(seq 0 $tailMonitorIndex)
|
||||||
|
|
||||||
if [ "$1" == "" ]; then
|
if [ "$1" == "" ]; then
|
||||||
monitorUnlocked=0
|
monitorUnlocked=0
|
||||||
@ -50,6 +51,18 @@ elif [ "$1" == "help" ] || [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" ==
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! [[ $1 =~ ^[0-9]+$ ]]; then
|
||||||
|
echo "Error: Invalid parameter value was provided."
|
||||||
|
echo "[monitor_id] must be an integer."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $1 -lt 0 ] || [ $tailMonitorIndex -lt $1 ]; then
|
||||||
|
echo "Error: The provided [monitor_id] is out of range."
|
||||||
|
echo "[monitor_id] must be an integer from 0 to $tailMonitorIndex."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
monitor=$(echo "$monitors" | jq -c ".[$1]")
|
monitor=$(echo "$monitors" | jq -c ".[$1]")
|
||||||
|
|
||||||
unlockedMonitorYPosition=${unlockedMonitorYPositions[$1]}
|
unlockedMonitorYPosition=${unlockedMonitorYPositions[$1]}
|
||||||
|
Loading…
Reference in New Issue
Block a user