35 lines
1 KiB
Bash
Executable file
35 lines
1 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
|
|
notify-send "logout" "Cannot logout, wlogout not present!"
|
|
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 -o DP-1 - | ffmpeg -i - -vf "scale=iw/10:ih/10:flags=neighbor,scale=iw*10:ih*10:flags=neighbor" -y "$blurred_path"
|
|
grim -o DP-1 - | ffmpeg -i - -vf "boxblur=24" -y "$blurred_path"
|
|
}
|
|
|
|
# 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
|