mirror of
https://github.imc.re/void-land/hyprland-void-dots
synced 2025-04-27 01:03:43 +02:00
feat: watcher util
This commit is contained in:
parent
24badb6a3b
commit
bfc579c07e
7 changed files with 141 additions and 41 deletions
|
@ -7,7 +7,9 @@ exec-once = dbus-update-activation-environment --all &
|
||||||
exec-once = ~/.config/scripts/pipewire.sh &
|
exec-once = ~/.config/scripts/pipewire.sh &
|
||||||
exec-once = ~/.config/hypr/scripts/keyring-launch.sh &
|
exec-once = ~/.config/hypr/scripts/keyring-launch.sh &
|
||||||
exec-once = wl-paste --watch cliphist store &
|
exec-once = wl-paste --watch cliphist store &
|
||||||
exec-once = avizo-service &
|
exec-once = swayosd-server &
|
||||||
|
|
||||||
|
# exec-once = avizo-service &
|
||||||
|
|
||||||
# wallpaper :
|
# wallpaper :
|
||||||
exec-once = ~/.config/hypr/scripts/wallpaper-daemon.sh &
|
exec-once = ~/.config/hypr/scripts/wallpaper-daemon.sh &
|
||||||
|
|
|
@ -44,9 +44,9 @@ bind = $mainMod, Y, exec, $random_wallpaper
|
||||||
bind = $mainMod, I, exec, $kill_wallpaper_daemon
|
bind = $mainMod, I, exec, $kill_wallpaper_daemon
|
||||||
|
|
||||||
# Audio control
|
# Audio control
|
||||||
binde=, XF86AudioRaiseVolume, exec, volumectl -u up
|
binde=, XF86AudioRaiseVolume, exec, swayosd-client --output-volume raise
|
||||||
binde=, XF86AudioLowerVolume, exec, volumectl -u down
|
binde=, XF86AudioLowerVolume, exec, swayosd-client --output-volume lower
|
||||||
bind=, XF86AudioMute, exec, volumectl toggle-mute
|
bind=, XF86AudioMute, exec, swayosd-client --output-volume mute-toggle
|
||||||
bind=, XF86AudioPlay, exec, playerctl play-pause
|
bind=, XF86AudioPlay, exec, playerctl play-pause
|
||||||
bind=, XF86AudioPrev, exec, playerctl previous
|
bind=, XF86AudioPrev, exec, playerctl previous
|
||||||
bind=, XF86AudioNext, exec, playerctl next
|
bind=, XF86AudioNext, exec, playerctl next
|
||||||
|
|
41
configs/hyprland/hypr/scripts/swayosd-launch.sh
Executable file
41
configs/hyprland/hypr/scripts/swayosd-launch.sh
Executable file
|
@ -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
|
|
@ -2,39 +2,4 @@
|
||||||
|
|
||||||
source ~/.config/scripts/env.sh
|
source ~/.config/scripts/env.sh
|
||||||
|
|
||||||
if [[ ! -d "$WAYBAR_DIR" ]]; then
|
exec $WATCHER -a "$WAYBAR_LAUNCHER" -d "$WAYBAR_DIR" -p "waybar"
|
||||||
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
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# utils shell :
|
||||||
|
export WATCHER="$HOME/.config/scripts/utils/watcher/main.sh"
|
||||||
|
|
||||||
# waybar env :
|
# waybar env :
|
||||||
export WAYBAR_DEV_MODE=false
|
export WAYBAR_DEV_MODE=false
|
||||||
export WAYBAR_THEME="river"
|
export WAYBAR_THEME="river"
|
||||||
export WAYBAR_DIR="$HOME/.config/waybar/$WAYBAR_THEME"
|
export WAYBAR_DIR="$HOME/.config/waybar/$WAYBAR_THEME"
|
||||||
export WAYBAR_LAUNCHER="waybar -c $WAYBAR_DIR/config.jsonc -s $WAYBAR_DIR/style.css"
|
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 :
|
# wallpaper configs - swaybg, swww, mpvpaper :
|
||||||
export WALLPAPER_DAEMON="swaybg"
|
export WALLPAPER_DAEMON="swaybg"
|
||||||
|
|
48
configs/hyprland/scripts/utils/watcher/main.sh
Executable file
48
configs/hyprland/scripts/utils/watcher/main.sh
Executable file
|
@ -0,0 +1,48 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "Usage: $0 -a <application_name> -d <directory_to_watch> -p <process_name>"
|
||||||
|
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
|
42
configs/hyprland/swayosd/style.css
Normal file
42
configs/hyprland/swayosd/style.css
Normal file
|
@ -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;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue