diff --git a/configs/hyprland/hypr/configs/autostart.conf b/configs/hyprland/hypr/configs/autostart.conf index e1ffea4..a999073 100644 --- a/configs/hyprland/hypr/configs/autostart.conf +++ b/configs/hyprland/hypr/configs/autostart.conf @@ -7,7 +7,9 @@ exec-once = dbus-update-activation-environment --all & exec-once = ~/.config/scripts/pipewire.sh & exec-once = ~/.config/hypr/scripts/keyring-launch.sh & exec-once = wl-paste --watch cliphist store & -exec-once = avizo-service & +exec-once = swayosd-server & + +# exec-once = avizo-service & # wallpaper : exec-once = ~/.config/hypr/scripts/wallpaper-daemon.sh & diff --git a/configs/hyprland/hypr/configs/keybinds.conf b/configs/hyprland/hypr/configs/keybinds.conf index 1cc47d5..273955c 100644 --- a/configs/hyprland/hypr/configs/keybinds.conf +++ b/configs/hyprland/hypr/configs/keybinds.conf @@ -44,9 +44,9 @@ bind = $mainMod, Y, exec, $random_wallpaper bind = $mainMod, I, exec, $kill_wallpaper_daemon # Audio control -binde=, XF86AudioRaiseVolume, exec, volumectl -u up -binde=, XF86AudioLowerVolume, exec, volumectl -u down -bind=, XF86AudioMute, exec, volumectl toggle-mute +binde=, XF86AudioRaiseVolume, exec, swayosd-client --output-volume raise +binde=, XF86AudioLowerVolume, exec, swayosd-client --output-volume lower +bind=, XF86AudioMute, exec, swayosd-client --output-volume mute-toggle bind=, XF86AudioPlay, exec, playerctl play-pause bind=, XF86AudioPrev, exec, playerctl previous bind=, XF86AudioNext, exec, playerctl next diff --git a/configs/hyprland/hypr/scripts/swayosd-launch.sh b/configs/hyprland/hypr/scripts/swayosd-launch.sh new file mode 100755 index 0000000..20b559a --- /dev/null +++ b/configs/hyprland/hypr/scripts/swayosd-launch.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +source ~/.config/scripts/env.sh + +if [[ ! -d "$WAYBAR_DIR" ]]; then + echo "Error: Configuration directory or files missing!" + exit 1 +fi + +pkill waybar + +sleep 1 + +while true; do + logger -i "$0: Starting waybar in the background..." + exec $WAYBAR_LAUNCHER & + waybar_pid=$! + + logger -i "$0: Started waybar PID=$waybar_pid. Waiting for modifications..." + inotifywait $WAYBAR_INOTIFY_EVENTS "$WAYBAR_DIR" 2>&1 | logger -i + + if [[ $? -ne 0 ]]; then + echo "Error: inotifywait failed!" + exit 1 + fi + + logger -i "$0: inotifywait returned $?. Killing all waybar processes..." + pkill waybar 2>&1 | logger -i + + if [[ $? -ne 0 ]]; then + echo "Error: Killing waybar failed!" + exit 1 + fi + + wait $waybar_pid + if [[ $? -ne 0 ]]; then + echo "Warning: Waybar process exited unexpectedly!" + fi + + logger -i "$0: killall waybar returned $?. Wait a sec..." +done diff --git a/configs/hyprland/hypr/scripts/waybar-launch.sh b/configs/hyprland/hypr/scripts/waybar-launch.sh index 45ac7b5..7e0a6a5 100755 --- a/configs/hyprland/hypr/scripts/waybar-launch.sh +++ b/configs/hyprland/hypr/scripts/waybar-launch.sh @@ -2,39 +2,4 @@ source ~/.config/scripts/env.sh -if [[ ! -d "$WAYBAR_DIR" ]]; then - echo "Error: Configuration directory or files missing!" - exit 1 -fi - -pkill waybar -sleep 1 - -while true; do - logger -i "$0: Starting waybar in the background..." - exec $WAYBAR_LAUNCHER & - waybar_pid=$! - - logger -i "$0: Started waybar PID=$waybar_pid. Waiting for modifications..." - inotifywait $WAYBAR_INOTIFY_EVENTS "$WAYBAR_DIR" 2>&1 | logger -i - - if [[ $? -ne 0 ]]; then - echo "Error: inotifywait failed!" - exit 1 - fi - - logger -i "$0: inotifywait returned $?. Killing all waybar processes..." - pkill waybar 2>&1 | logger -i - - if [[ $? -ne 0 ]]; then - echo "Error: Killing waybar failed!" - exit 1 - fi - - wait $waybar_pid - if [[ $? -ne 0 ]]; then - echo "Warning: Waybar process exited unexpectedly!" - fi - - logger -i "$0: killall waybar returned $?. Wait a sec..." -done +exec $WATCHER -a "$WAYBAR_LAUNCHER" -d "$WAYBAR_DIR" -p "waybar" diff --git a/configs/hyprland/scripts/env.sh b/configs/hyprland/scripts/env.sh index cfb5769..efa979c 100755 --- a/configs/hyprland/scripts/env.sh +++ b/configs/hyprland/scripts/env.sh @@ -1,11 +1,13 @@ #!/usr/bin/env bash +# utils shell : +export WATCHER="$HOME/.config/scripts/utils/watcher/main.sh" + # waybar env : export WAYBAR_DEV_MODE=false export WAYBAR_THEME="river" export WAYBAR_DIR="$HOME/.config/waybar/$WAYBAR_THEME" export WAYBAR_LAUNCHER="waybar -c $WAYBAR_DIR/config.jsonc -s $WAYBAR_DIR/style.css" -export WAYBAR_INOTIFY_EVENTS="-e close_write,move,create" # wallpaper configs - swaybg, swww, mpvpaper : export WALLPAPER_DAEMON="swaybg" diff --git a/configs/hyprland/scripts/utils/watcher/main.sh b/configs/hyprland/scripts/utils/watcher/main.sh new file mode 100755 index 0000000..61e8ca6 --- /dev/null +++ b/configs/hyprland/scripts/utils/watcher/main.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +usage() { + echo "Usage: $0 -a -d -p " + exit 1 +} + +while getopts ":a:d:p:" opt; do + case $opt in + p) process_name="$OPTARG" ;; + a) app_name="$OPTARG" ;; + d) watch_dir="$OPTARG" ;; + *) usage ;; + esac +done + +if [[ -z $app_name || -z $watch_dir || -z $process_name ]]; then + usage +fi + +if [[ ! -d $watch_dir ]]; then + echo "Error: Directory $watch_dir does not exist!" + exit 1 +fi + +start_application() { + echo "Starting $process_name..." + pkill $process_name + sleep 1 + exec $app_name +} + +restart_application() { + if pgrep -x "$process_name" >/dev/null; then + echo "Restarting $process_name..." + pkill $process_name + sleep 1 + $app_name & + else + echo "$app_name is not currently running." + fi +} + +start_application & + +inotifywait -q -m -r -e modify,delete,create "$watch_dir" | while read DIRECTORY EVENT FILE; do + restart_application +done diff --git a/configs/hyprland/swayosd/style.css b/configs/hyprland/swayosd/style.css new file mode 100644 index 0000000..87093d3 --- /dev/null +++ b/configs/hyprland/swayosd/style.css @@ -0,0 +1,42 @@ +window#osd { + padding: 12px 20px; + border-radius: 120px; + border: none; + background: alpha(@theme_bg_color, 0.8); +} + +window#osd #container { + margin: 16px; +} + +window#osd image, +window#osd label { + color: @theme_fg_color; +} + +window#osd progressbar:disabled, +window#osd image:disabled { + opacity: 0.5; +} + +window#osd progressbar { + transition: all ease-in-out 0.5s; + min-height: 6px; + border-radius: 999px; + background: transparent; + border: none; +} + +window#osd trough { + min-height: inherit; + border-radius: inherit; + border: none; + background: alpha(@theme_fg_color, 0.5); +} + +window#osd progress { + min-height: inherit; + border-radius: inherit; + border: none; + background: @theme_fg_color; +} \ No newline at end of file