Update hyprlock.sh
This commit is contained in:
parent
ca30127ac8
commit
9386b9e644
36
hyprlock.sh
36
hyprlock.sh
@ -8,28 +8,36 @@ monitors=$(hyprctl -j monitors)
|
||||
monitorIndices=$(seq 0 $(($(echo "$monitors" | jq length)-1)))
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
monitorUnlocked=0
|
||||
for monitorIndex in $monitorIndices; do
|
||||
monitor=$(echo "$monitors" | jq -c ".[$monitorIndex]")
|
||||
|
||||
unlockedMonitorYPosition=${unlockedMonitorYPositions[$monitorIndex]}
|
||||
|
||||
if [ $(echo "$monitor" | jq -j ".y") -eq $unlockedMonitorYPosition ]; then continue; fi
|
||||
|
||||
hyprctl keyword monitor $(echo "$monitor" | jq -j ".name"),$(echo "$monitor" | jq -j ".width")x$(echo "$monitor" | jq -j ".height")@$(echo "$monitor" | jq -j ".refreshRate"),$(echo "$monitor" | jq -j ".x")x$unlockedMonitorYPosition,$(echo "$monitor" | jq -j ".scale")
|
||||
|
||||
monitorUnlocked=1
|
||||
|
||||
echo Unlocked monitor $monitorIndex
|
||||
done
|
||||
|
||||
if [ $monitorUnlocked -eq 1 ]; then exit; fi
|
||||
|
||||
for monitorIndex in $monitorIndices; do
|
||||
monitor=$(echo "$monitors" | jq -c ".[$monitorIndex]")
|
||||
|
||||
if [ $(echo "$monitor" | jq -j ".focused") == "false" ]; then continue; fi
|
||||
|
||||
unlockedMonitorYPosition=${unlockedMonitorYPositions[$monitorIndex]}
|
||||
|
||||
if [ $(echo "$monitor" | jq -j ".y") == $unlockedMonitorYPosition ]; then
|
||||
hyprctl keyword monitor $(echo "$monitor" | jq -j ".name"),$(echo "$monitor" | jq -j ".width")x$(echo "$monitor" | jq -j ".height")@$(echo "$monitor" | jq -j ".refreshRate"),$(echo "$monitor" | jq -j ".x")x${lockedMonitorYPositions[$monitorIndex]},$(echo "$monitor" | jq -j ".scale")
|
||||
hyprctl keyword monitor $(echo "$monitor" | jq -j ".name"),$(echo "$monitor" | jq -j ".width")x$(echo "$monitor" | jq -j ".height")@$(echo "$monitor" | jq -j ".refreshRate"),$(echo "$monitor" | jq -j ".x")x${lockedMonitorYPositions[$monitorIndex]},$(echo "$monitor" | jq -j ".scale")
|
||||
|
||||
echo Locked monitor $monitorIndex
|
||||
exit
|
||||
fi
|
||||
|
||||
hyprctl keyword monitor $(echo "$monitor" | jq -j ".name"),$(echo "$monitor" | jq -j ".width")x$(echo "$monitor" | jq -j ".height")@$(echo "$monitor" | jq -j ".refreshRate"),$(echo "$monitor" | jq -j ".x")x$unlockedMonitorYPosition,$(echo "$monitor" | jq -j ".scale")
|
||||
|
||||
echo Unlocked monitor $monitorIndex
|
||||
echo Locked monitor $monitorIndex
|
||||
exit
|
||||
done
|
||||
elif [ "$1" == "status" ]; then
|
||||
for monitorIndex in $monitorIndices; do
|
||||
if [ $(echo "$monitors" | jq -j ".[$monitorIndex].y") == ${unlockedMonitorYPositions[$monitorIndex]} ];
|
||||
if [ $(echo "$monitors" | jq -j ".[$monitorIndex].y") -eq ${unlockedMonitorYPositions[$monitorIndex]} ];
|
||||
then echo Monitor $monitorIndex: Unlocked
|
||||
else echo Monitor $monitorIndex: Locked;
|
||||
fi
|
||||
@ -41,7 +49,7 @@ monitor=$(echo "$monitors" | jq -c ".[$1]")
|
||||
|
||||
unlockedMonitorYPosition=${unlockedMonitorYPositions[$1]}
|
||||
|
||||
if [ $(echo "$monitor" | jq -j ".y") == $unlockedMonitorYPosition ]; then
|
||||
if [ $(echo "$monitor" | jq -j ".y") -eq $unlockedMonitorYPosition ]; then
|
||||
hyprctl keyword monitor $(echo "$monitor" | jq -j ".name"),$(echo "$monitor" | jq -j ".width")x$(echo "$monitor" | jq -j ".height")@$(echo "$monitor" | jq -j ".refreshRate"),$(echo "$monitor" | jq -j ".x")x${lockedMonitorYPositions[$monitorIndex]},$(echo "$monitor" | jq -j ".scale")
|
||||
|
||||
echo Locked monitor $monitorIndex
|
||||
@ -50,4 +58,4 @@ fi
|
||||
|
||||
hyprctl keyword monitor $(echo "$monitor" | jq -j ".name"),$(echo "$monitor" | jq -j ".width")x$(echo "$monitor" | jq -j ".height")@$(echo "$monitor" | jq -j ".refreshRate"),$(echo "$monitor" | jq -j ".x")x$unlockedMonitorYPosition,$(echo "$monitor" | jq -j ".scale")
|
||||
|
||||
echo Unlocked monitor $monitorIndex
|
||||
echo Unlocked monitor $monitorIndex
|
Loading…
Reference in New Issue
Block a user