hypr(env,scripts,autostart, hyprlock): add new notification system, add media to hyprlock, organize scripts, add xdg env vars, use less blur size

This commit is contained in:
retrozinndev
2025-01-07 16:46:46 -03:00
parent c505ecf4cf
commit 89ec22cb48
11 changed files with 167 additions and 48 deletions
+24 -24
View File
@@ -1,58 +1,58 @@
#!/usr/bin/env bash
# This script is made by retrozinndev (João Dias), It is licensed under
# the MIT License as in retrozinndev/Hyprland-Dots repository.
# GitHub: https://github.com/retrozinndev
# Dotfiles: https://github.com/retrozinndev/Hyprland-Dots
# The script prompts the user with anyrun or wofi to choose an image file inside
# Prompts the user with anyrun or wofi to choose an image file inside
# the defined $WALLPAPERS_DIR. If the user selects an entry, it automatically
# writes changes to the hyprpaper.conf file and hot-reloads wallpaper if hyprpaper
# is running.
# --------------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From https://github.com/retrozinndev/Hyprland-Dots
HYPRPAPER_FILE="$HOME/.config/hypr/hyprpaper.conf"
COLORSCHEME_STYLE="darken" # lighten / darken
if [[ $WALLPAPERS_DIR == "" ]]; then
WALLPAPERS_DIR="$HOME/wallpapers"
fi
HYPRPAPER_FILE="$HOME/.config/hypr/hyprpaper.conf"
if [[ -f /bin/anyrun ]]; then
WALLPAPER_SELECT_CMD="anyrun --plugins libstdin.so"
elif [[ -f /bin/wofi ]]; then
WALLPAPER_SELECT_CMD="wofi --dmenu"
else
notify-send -u normal "Hyprpaper script" "Couldn't find anyrun or wofi for dmenu! Try installing one of these two before selecting wallpaper!"
notify-send -u normal -a "Wallpaper" "Dmenu not found" "Couldn't find anyrun or wofi for dmenu! Try installing one of these two before selecting wallpaper!"
exit 1
fi
if [[ -z $(ls -A $WALLPAPERS_DIR) ]]
then
notify-send -u normal "Hyprpaper script" "Couldn't find any wallpaper inside \`~/wallpapers\`, try putting an image you like in there to choose it!"
notify-send -u normal -a "Wallpaper" "Wallpapers not found" "Couldn't find any wallpaper inside \`~/wallpapers\`, try putting an image you like in there to choose it!"
exit 1
fi
Update_wallpaper_settings() {
echo "Writing to hyprpaper config file"
function Write_changes() {
echo "Writing to hyprpaper config file..."
echo "" > $HYPRPAPER_FILE # Cleans Hyprpaper conf
echo \
'$wallpaper'" = $SET_WALLPAPER_FULL
echo "\$wallpaper = $SET_WALLPAPER_FULL" >> $HYPRPAPER_FILE
echo "" >> $HYPRPAPER_FILE
echo "splash = true" >> $HYPRPAPER_FILE
echo "preload = \$wallpaper" >> $HYPRPAPER_FILE
echo "wallpaper = , \$wallpaper" >> $HYPRPAPER_FILE
splash = true
preload = "'$wallpaper'"
wallpaper = , "'$wallpaper'"" | sed -e "s/^(\\[n])//g" > $HYPRPAPER_FILE
}
Hot_reload_wallpaper() {
echo "Hot-reloading wallpaper"
Reload_wallpaper() {
echo "Hot-reloading wallpaper..."
hyprctl hyprpaper unload all
hyprctl hyprpaper preload "$SET_WALLPAPER_FULL"
hyprctl hyprpaper wallpaper ", $SET_WALLPAPER_FULL"
}
Reload_pywal() {
echo "Reloading pywal colorscheme"
wal -q -t --cols16 darken -i "$SET_WALLPAPER_FULL"
echo "Reloading pywal colorscheme..."
wal -q -t --cols16 $COLORSCHEME_STYLE -i "$SET_WALLPAPER_FULL"
}
Reload_eww() {
@@ -64,7 +64,7 @@ Reload_eww() {
SET_WALLPAPER_NAME="$(ls $WALLPAPERS_DIR | $WALLPAPER_SELECT_CMD)"
SET_WALLPAPER_FULL="$WALLPAPERS_DIR/$SET_WALLPAPER_NAME"
echo "Wallpaper: $SET_WALLPAPER_NAME"
echo "Selected wallpaper: $SET_WALLPAPER_NAME"
# Check if input wallpaper is empty
if [[ $SET_WALLPAPER_NAME == "" ]] || [[ $SET_WALLPAPER_NAME == " " ]]
@@ -82,9 +82,9 @@ then
fi
fi
Hot_reload_wallpaper
Reload_pywal
Reload_wallpaper
Reload_eww
Update_wallpaper_settings
Write_changes
exit 0
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# This script loads/generate color schemes from current
# wallpaper using pywal16.
# ----------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From https://github.com/retrozinndev/Hyprland-Dots
wallpaper="$(cat $HOME'/.config/hypr/hyprpaper.conf' | grep '$wallpaper =' | sed -e 's/^$wallpaper = //')"
if ! [[ -f "$wallpaper" ]]; then
notify-send -a "Wallpaper" "Couldn't load" "Wallpaper file not found! Please check for the wallpaper: $wallpaper."
exit 1
fi
if [[ -d "$HOME/.cache/wal" ]]; then
wal -R
else
wal -q -t --cols16 darken -i "$wallpaper"
fi
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# This script checks if night light was enabled last
# boot, and runs hyprsunset if that's the case.
# ---------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From https://github.com/retrozinndev/Hyprland-Dots
if [[ -f "$HOME/.cache/night-light.pid" ]]; then
rm "$HOME/.cache/night-light.pid"
sh $HOME/.config/eww/scripts/night-light.sh
fi
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# This script runs notification-handler.sh script
# and handles any issues that happens with it.
# --------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From https://github.com/retrozinndev/Hyprland-Dots
eww_config_dir=$(eww get EWW_CONFIG_DIR)
logfile="$HOME/.cache/notification-handler-daemon.log"
function Send_log() {
echo "[$1]${@/$1}" >> $logfile
}
function Exit_daemon() {
Send_log "info" "Handler exited normally, quitting daemon."
exit 0
}
function Restart_handler() {
sh $eww_config_dir/scripts/notification-handler.sh &
pid_handler=$!
Send_log "info" "Handler started!"
Send_log "info" "Handler script PID: $pid_handler"
wait $pid_handler && Exit_daemon || \
(Send_log "error" "An error occurred and handler stopped"
Send_log "info" "Clearing history and starting handler again."
Restart_handler)
}
trap "Send_log 'info' 'SIGINT received, stopping daemon and handler' ; kill \$pid_handler ; exit 1" SIGINT
trap "Send_log 'info' 'SIGTERM received, stopping daemon and handler' ; kill \$pid_handler ; exit 1" SIGTERM
echo '' > $logfile
Send_log "info" "Starting Daemon..."
Send_log "info" "Daemon script PID: $$"
Restart_handler
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# This script triggers the Eww Volume Popup Window
# ---------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From https://github.com/retrozinndev/Hyprland-Dots