45 lines
1.1 KiB
Smarty
Executable File
45 lines
1.1 KiB
Smarty
Executable File
#!/usr/bin/fish
|
|
|
|
# configured for wayland
|
|
set LOCKPROG swaylock
|
|
set OPTIONAL_CMDS grep sed grim lockscreen-blur
|
|
set CONFIG "$HOME/.config/sway/swaylock.config"
|
|
set FALLBACK_ARGS --config $CONFIG --color "302f3b"
|
|
set BLUR_FACTOR 40
|
|
|
|
# check if lock program is running
|
|
if ps -e | grep " $LOCKPROG\$"
|
|
echo "$LOCKPROG is already running"
|
|
exit 1
|
|
end
|
|
|
|
for cmd in $OPTIONAL_CMDS
|
|
if not command -v $cmd &>/dev/null
|
|
echo "$cmd could not be found, falling back to basic mode."
|
|
$LOCKPROG $FALLBACK_ARGS
|
|
exit 0
|
|
end
|
|
end
|
|
|
|
|
|
{% if hostname == "buran" %}
|
|
# list display outputs using hyprctl
|
|
set outputs (hyprctl monitors | rg Monitor | sed 's/Monitor //' | sed 's/ (ID.*$//')
|
|
{% else %}
|
|
# list display outputs using swaymsg
|
|
set outputs (swaymsg -t get_outputs -r | grep "name" | sed 's/^.*"name": "//' | sed 's/",$//')
|
|
{% end %}
|
|
|
|
# take one screenshot of each output
|
|
for output in $outputs
|
|
set img "/tmp/lock-$output.png"
|
|
grim -o $output -t ppm - | lockscreen-blur -o $img -b $BLUR_FACTOR --stamp ~/.config/wallpapers/ferris-stamp.png &
|
|
set -a images "--image"
|
|
set -a images "$output:$img"
|
|
end
|
|
|
|
wait
|
|
|
|
$LOCKPROG --config $HOME/.config/sway/swaylock.config $images
|
|
|