hypr/.scripts/wlogout.sh
2025-05-04 20:29:34 +02:00

42 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
# ─< Check if the given command exists silently >─────────────────────────────────────────
command_exists() {
command -v "$@" >/dev/null 2>&1
}
if ! command_exists wlogout; then
exit 1
fi
# Take a screenshot and blur it using ffmpeg
take_and_blur_screenshot() {
local blurred_path="$HOME/.config/wlogout/tmp.png"
# Take a screenshot and blur it
grim -t ppm - | ffmpeg -f image2pipe -vcodec ppm -i - -vf "gblur=sigma=8" -vframes 1 "$blurred_path"
# handle_error $? "grim and ffmpeg"
}
# Main logic
if ! command_exists wlogout; then
# log_notify "critical" "Error" "wlogout not found"
exit 1
fi
if command_exists grim && command_exists ffmpeg; then
take_and_blur_screenshot
wlogout --css "$HOME/.config/wlogout/style_blur.css"
else
# log_notify "critical" "Error" "Required tools (grim, ffmpeg) not found"
exit 1
fi
# wlogout
# if command_exists grim && command_exists magick; then
# grim /tmp/shot.png
# magick /tmp/shot.png -blur 0x8 $HOME/.config/wlogout/tmp.png
# wlogout --css $HOME/.config/wlogout/style_blur.css
# else
# wlogout
# fi