diff --git a/.scripts/init b/.scripts/init index 8f62422..67c4e58 100755 --- a/.scripts/init +++ b/.scripts/init @@ -5,6 +5,17 @@ command-exists() { command -v "$@" >/dev/null 2>&1 } +kill-all() { + # ─< 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=(swaync gBar rofi fuzzel wofi swaync waybar $hyprpanel) + for _prs in "${_ps[@]}"; do + if pidof "${_prs}" >/dev/null; then + pkill "${_prs}" + fi + done +} + SCRIPTS="$HOME/.config/hypr/.scripts" # Logging helper @@ -121,15 +132,8 @@ init-xdg-portal() { } main() { - if command_exists swaync; then - pkill swaync - fi - - if setup-desktop; then - log_notify "normal" "INFO" "System modules initialized." - else - log_notify "critical" "INFO" "System module initialization exited with errors.." - fi + kill-all + setup-desktop if [ -x "/usr/lib/hyprpolkitagent" ]; then systemctl --user start hyprpolkitagent diff --git a/.scripts/refresh.sh b/.scripts/refresh.sh index 8e38191..7cc5538 100755 --- a/.scripts/refresh.sh +++ b/.scripts/refresh.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # ─< scriptdir declaration >────────────────────────────────────────────────────────────── -_scripts="$HOME/.config/hypr/.scripts" +SCRIPTS="$HOME/.config/hypr/.scripts" # ─< Check if the given command exists silently >───────────────────────────────────────── command_exists() { @@ -20,7 +20,7 @@ _kill_() { } _redshift() { - . $_scripts/redshift.sh && notify-send -u low "󰴅" "Redshift active" + . $SCRIPTS/redshift.sh && notify-send -u low "󰴅" "Redshift active" } # ─< Relaunch waybar >──────────────────────────────────────────────────────────────────── @@ -94,10 +94,10 @@ main() { sleep 0.2 # swaync >/dev/null 2>&1 & # notify-send "low" "bar" "launching.." - bash "$_scripts/bar" + bash "$SCRIPTS/bar" notify-send "low" "wallpaper" "loading.." - bash "$_scripts/wallpaper" + bash "$SCRIPTS/wallpaper" if command_exists redshift; then notify-send "low" "redshift" "protecting your eyes from the blue light.."