hypr/scripts/refresh
2025-06-19 15:20:20 +02:00

52 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# ─< scriptdir declaration >──────────────────────────────────────────────────────────────
SCRIPTS="$HOME/.config/hypr/scripts"
# ─< Check if the given command exists silently >─────────────────────────────────────────
command_exists() {
command -v "$@" >/dev/null 2>&1
}
_kill_() {
# ─< Kill already running processes >─────────────────────────────────────────────────────
hyprpanel="gjs" # since hyprpanel has so many different wordings, making it clear that this is currently the hyprpanel service name
_ps=(gBar wofi swaync waybar $hyprpanel)
for _prs in "${_ps[@]}"; do
if pidof "${_prs}" >/dev/null; then
pkill "${_prs}"
fi
done
}
_redshift() {
. "$SCRIPTS/redshift.sh"
}
main() {
# notify-send "low" "terminating main wm elements"
_kill_
# relaunch swaync
sleep 0.3
hyprctl reload
sleep 0.2
# swaync >/dev/null 2>&1 &
# notify-send "low" "bar" "launching.."
bash "$SCRIPTS/bar"
notify-send "low" "wallpaper" "loading.."
bash "$SCRIPTS/wallpaper"
if command_exists redshift; then
notify-send "low" "redshift" "protecting your eyes from the blue light.."
_redshift
fi
exit 0
}
main