#!/bin/bash # ─< scriptdir declaration >────────────────────────────────────────────────────────────── _scripts="$HOME/.config/hypr/.scripts" # ─< Check if the given command exists silently >───────────────────────────────────────── command_exists() { command -v "$@" >/dev/null 2>&1 } _wallpaper() { if command -v swww >/dev/null 2>&1; then if [ -e "$_scripts/random_swww.sh" ]; then $_scripts/random_swww.sh else notify-send -u normal "" "script for initializing wallpaper with swww is missing.." fi else notify-send -u low "" "There may be no wallpaper bc swww is missing!" fi } _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 && notify-send -u low "󰴅" "Redshift active" } # ─< Relaunch waybar >──────────────────────────────────────────────────────────────────── pywall_waybar() { notify-send -u low "Bar" "waybar is launching with wal.." waybar --style $HOME/.config/waybar/pywal_style.css } _hyprpanel() { notify-send -u low "Bar" "hyprpanel is loading.." hyprpanel & } _waybar() { if command_exists wal; then pywall_waybar else notify-send -u normal "Bar" "waybar is loading.." waybar --config $HOME/.config/waybar/ai_config.jsonc --style $HOME/.config/waybar/ai_style.css & fi } # ─< Relaunch gBar >────────────────────────────────────────────────────────────────────── _gBar() { notify-send -u low "Bar" "gBar is loading.." gBar bar 0 & gBar bar 1 & } _bar() { if command_exists hyprpanel; then _hyprpanel elif command_exists gBar; then _gBar elif command_exists waybar; then _waybar else notify-send -u critical "ERROR" "No 'bar'-provider found! Install either hyprpanel, gBar or waybar!" fi } # # for cava-pywal (note, need to manually restart cava once wallpaper changes) # # ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/.config/cava/config" || true # if [ -d "$HOME/.cache/wal/" ]; then # ln -sf "$HOME/.cache/wal/colors-rofi-dark.rasi" "$HOME/.config/rofi/pywal-color/pywal-theme.rasi" || true # if [ -e "$HOME/.config/waybar/pywal.css" ]; then # rm $HOME/.config/waybar/pywal.css # command cat $HOME/.cache/wal/colors.css >$HOME/.config/waybar/pywal.css # # pywall_waybar || _waybar # _gBar # else # # _waybar # _gBar # fi # else # # _waybar # _gBar # notify-send -u critical "ERROR" "critical failure! wal is not present!!" # fi main() { notify-send "low" "terminating main wm elements" _kill_ # relaunch swaync sleep 0.3 # swaync >/dev/null 2>&1 & notify-send "low" "bar" "launching.." _bar notify-send "low" "wallpaper" "loading.." _wallpaper if command_exists redshift; then notify-send "low" "redshift" "protecting your eyes from the blue light.." _redshift fi exit 0 } main