Make hyprlock default and add battery level
This commit is contained in:
@ -1,11 +1,7 @@
|
||||
#!/usr/bin/fish
|
||||
|
||||
# configured for wayland
|
||||
set LOCKPROG swaylock
|
||||
set OPTIONAL_CMDS rg sed grim lockscreen-blur jq
|
||||
set CONFIG "$HOME/.config/sway/swaylock.config"
|
||||
set DEFAULT_ARGS --daemonize --ignore-empty-password --show-failed-attempts --color 302f3b --config $CONFIG
|
||||
set BLUR_FACTOR 40
|
||||
set LOCKPROG hyprlock
|
||||
|
||||
# check if lock program is running
|
||||
if ps -e | grep " $LOCKPROG\$"
|
||||
@ -13,38 +9,4 @@ if ps -e | grep " $LOCKPROG\$"
|
||||
exit 1
|
||||
end
|
||||
|
||||
# check if we have programs required to take a screenshot and do cool stuff with it
|
||||
for cmd in $OPTIONAL_CMDS
|
||||
if not command -v $cmd &>/dev/null
|
||||
echo "$cmd could not be found, falling back to basic mode."
|
||||
$LOCKPROG $DEFAULT_ARGS
|
||||
exit 0
|
||||
end
|
||||
end
|
||||
|
||||
# get a list of outputs/monitors
|
||||
switch $XDG_CURRENT_DESKTOP
|
||||
case Hyprland
|
||||
set outputs (hyprctl monitors | rg Monitor | sed 's/Monitor //' | sed 's/ (ID.*$//')
|
||||
case sway
|
||||
set outputs (swaymsg -t get_outputs -r | rg "name" | sed 's/^.*"name": "//' | sed 's/",$//')
|
||||
case niri
|
||||
set outputs (niri msg --json outputs | jq -r 'keys | join("\n")')
|
||||
case '*'
|
||||
echo "unsupported compositor, falling back to basic mode."
|
||||
$LOCKPROG $DEFAULT_ARGS
|
||||
exit 0
|
||||
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 for all screenshot jobs to complete
|
||||
wait
|
||||
|
||||
$LOCKPROG $DEFAULT_ARGS $images
|
||||
$LOCKPROG $argv
|
||||
|
||||
Reference in New Issue
Block a user