hypr/scripts/bar

51 lines
788 B
Bash
Executable file

#!/usr/bin/env bash
# Logging helper
log_notify() {
level="$1" # e.g., low, normal, critical
title="$2"
message="$3"
notify-send -u "$level" "$title" "$message"
}
# Check if the given command exists silently
command_exists() {
command -v "$@" >/dev/null 2>&1
}
proc-kill-if() {
if pgrep "$1"; then
pkill "$1"
fi
}
barsetup() {
local bar="${1:-quickshell}"
proc-kill-if "$bar"
case "$bar" in
hyprpanel)
hyprpanel &
;;
gBar)
gBar bar 0 &
;;
waybar)
waybar &
;;
quickshell)
proc-kill-if "qs"
qs &
;;
*)
$bar &
;;
esac
}
if barsetup "$@"; then
log_notify "normal" "Status-Bar" "initialized $bar"
else
log_notify "critical" "Status-Bar" "Something went wrong, your bar is probably not up.. sorry.."
fi