hypr/.scripts/bar
2025-06-09 12:46:03 +02:00

69 lines
1.3 KiB
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
}
# fallback() {
# if command_exists hyprpanel; then
# pkill hyprpanel
# handle_error $? "pkill hyprpanel"
# hyprpanel &
# handle_error $? "hyprpanel"
# elif command_exists gBar; then
# pkill gBar
# handle_error $? "pkill gBar"
# gBar bar 0 &
# handle_error $? "gBar bar 0"
# elif command_exists waybar; then
# pkill waybar
# handle_error $? "pkill waybar"
# waybar &
# handle_error $? "waybar"
# else
# log_notify "critical" "Error" "No compatible bar found"
# exit 1
# fi
# }
barsetup() {
local bar="${1:-quickshell}"
case "$bar" in
hyprpanel)
pkill hyprpanel
hyprpanel &
;;
gBar)
pkill gBar
gBar bar 0 &
;;
waybar)
pkill waybar
waybar &
;;
quickshell)
pkill qs
qs &
;;
*)
pkill $bar
$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