Upload files to "/"
This commit is contained in:
commit
be83449995
53
hyprlock.sh
Normal file
53
hyprlock.sh
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Use "hyprctl -j monitors" to determine the parameters for the lock and unlock positions.
|
||||||
|
unlockedMonitorYPositions=(0 0 0)
|
||||||
|
lockedMonitorYPositions=(1080 1080 1080)
|
||||||
|
|
||||||
|
monitors=$(hyprctl -j monitors)
|
||||||
|
monitorIndices=$(seq 0 $(($(echo "$monitors" | jq length)-1)))
|
||||||
|
|
||||||
|
if [ "$1" == "" ]; then
|
||||||
|
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")
|
||||||
|
|
||||||
|
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
|
||||||
|
exit
|
||||||
|
done
|
||||||
|
elif [ "$1" == "status" ]; then
|
||||||
|
for monitorIndex in $monitorIndices; do
|
||||||
|
if [ $(echo "$monitors" | jq -j ".[$monitorIndex].y") == ${unlockedMonitorYPositions[$monitorIndex]} ];
|
||||||
|
then echo Monitor $monitorIndex: Unlocked
|
||||||
|
else echo Monitor $monitorIndex: Locked;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
monitor=$(echo "$monitors" | jq -c ".[$1]")
|
||||||
|
|
||||||
|
unlockedMonitorYPosition=${unlockedMonitorYPositions[$1]}
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
|
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
|
Loading…
Reference in New Issue
Block a user