From 548ade37e52f92b70dfe08a53942ef1ac57b3ea7 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 16 Mar 2025 15:50:27 +0900 Subject: initial mpvpaper support --- config/hypr/UserScripts/WallpaperSelect.sh | 287 ++++++++++++++++++----------- 1 file changed, 176 insertions(+), 111 deletions(-) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index cf677f9c..ee46fdb6 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -12,42 +12,55 @@ wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" iDIR="$HOME/.config/swaync/images" iDIRi="$HOME/.config/swaync/icons" +# swww transition config +FPS=60 +TYPE="any" +DURATION=2 +BEZIER=".43,1.19,1,.4" +SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION --transition-bezier $BEZIER" + # Check if package bc exists if ! command -v bc &>/dev/null; then -notify-send -i "$iDIR/ja.png" "bc missing" "Install package bc first" -exit 1 + notify-send -i "$iDIR/ja.png" "bc missing" "Install package bc first" + exit 1 fi -# variables +# Variables rofi_theme="$HOME/.config/rofi/config-wallpaper.rasi" focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') +# Ensure focused_monitor is detected +if [[ -z "$focused_monitor" ]]; then + notify-send -i "$iDIR/ja.png" "E-R-R-O-R" "Could not detect focused monitor" + exit 1 +fi + # Monitor details scale_factor=$(hyprctl monitors -j | jq -r --arg mon "$focused_monitor" '.[] | select(.name == $mon) | .scale') monitor_height=$(hyprctl monitors -j | jq -r --arg mon "$focused_monitor" '.[] | select(.name == $mon) | .height') icon_size=$(echo "scale=1; ($monitor_height * 3) / ($scale_factor * 150)" | bc) - -# Apply limit adjusted_icon_size=$(echo "$icon_size" | awk '{if ($1 < 15) $1 = 20; if ($1 > 25) $1 = 25; print $1}') - -# Setting the rofi override with the adjusted icon size rofi_override="element-icon{size:${adjusted_icon_size}%;}" -# swww transition config -FPS=60 -TYPE="any" -DURATION=2 -BEZIER=".43,1.19,1,.4" -SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION --transition-bezier $BEZIER" +# Kill existing wallpaper daemons +kill_wallpaper_for_video() { + killall swww + pkill swaybg + pkill hyprpaper +} -# Check if swaybg is running -if pidof swaybg > /dev/null; then - pkill swaybg -fi +kill_wallpaper_for_image() { + killall mpvpaper + pkill swaybg + pkill hyprpaper +} -# Retrieve image files using null delimiter to handle spaces in filenames -mapfile -d '' PICS < <(find -L "${wallDIR}" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.pnm" -o -iname "*.tga" -o -iname "*.tiff" -o -iname "*.webp" -o -iname "*.bmp" -o -iname "*.farbfeld" -o -iname "*.png" -o -iname "*.gif" \) -print0) +# Retrieve wallpapers (both images & videos) +mapfile -d '' PICS < <(find -L "${wallDIR}" -type f \( \ + -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o \ + -iname "*.bmp" -o -iname "*.tiff" -o -iname "*.webp" -o \ + -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.mov" -o -iname "*.webm" \) -print0) RANDOM_PIC="${PICS[$((RANDOM % ${#PICS[@]}))]}" RANDOM_PIC_NAME=". random" @@ -57,112 +70,164 @@ rofi_command="rofi -i -show -dmenu -config $rofi_theme -theme-str $rofi_override # Sorting Wallpapers menu() { - # Sort the PICS array - IFS=$'\n' sorted_options=($(sort <<<"${PICS[*]}")) - - # Place ". random" at the beginning with the random picture as an icon - printf "%s\x00icon\x1f%s\n" "$RANDOM_PIC_NAME" "$RANDOM_PIC" - - for pic_path in "${sorted_options[@]}"; do - pic_name=$(basename "$pic_path") + IFS=$'\n' sorted_options=($(sort <<<"${PICS[*]}")) - # Displaying .gif to indicate animated images - if [[ ! "$pic_name" =~ \.gif$ ]]; then - printf "%s\x00icon\x1f%s\n" "$(echo "$pic_name" | cut -d. -f1)" "$pic_path" + printf "%s\x00icon\x1f%s\n" "$RANDOM_PIC_NAME" "$RANDOM_PIC" + + for pic_path in "${sorted_options[@]}"; do + pic_name=$(basename "$pic_path") + printf "%s\x00icon\x1f%s\n" "$(echo "$pic_name" | cut -d. -f1)" "$pic_path" + done +} + +# Offer SDDM Sequioa Wallpaper Option (only for non-video wallpapers) +set_sddm_wallpaper() { + sleep 1 + sddm_sequoia="/usr/share/sddm/themes/sequoia_2" + + if [ -d "$sddm_sequoia" ]; then + + # Check if yad is running to avoid multiple notifications + if pidof yad > /dev/null; then + killall yad + fi + + if yad --info --text="Set current wallpaper as SDDM background?\n\nNOTE: This only applies to SEQUOIA SDDM Theme" \ + --text-align=left \ + --title="SDDM Background" \ + --timeout=5 \ + --timeout-indicator=right \ + --button="yes:0" \ + --button="no:1"; then + + # Check if terminal exists + if ! command -v "$terminal" &>/dev/null; then + notify-send -i "$iDIR/ja.png" "Missing $terminal" "Install $terminal to enable setting of wallpaper background" + exit 1 + fi + + # Open terminal to enter password + $terminal -e bash -c "echo 'Enter your password to set wallpaper as SDDM Background'; \ + sudo cp -r $wallpaper_current '$sddm_sequoia/backgrounds/default' && \ + notify-send -i '$iDIR/ja.png' 'SDDM' 'Background SET'" + fi + fi +} + +# setting up $HOME/.config/hypr/UserConfigs/Startup_Apps.conf +modify_startup_config() { + local selected_file="$1" + + # Path to the configuration file + local startup_config="$HOME/.config/hypr/UserConfigs/Startup_Apps.conf" + + # Check if it's a live wallpaper (video) + if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm)$ ]]; then + # Comment out the line for swww-daemon + sed -i '/^\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb.*$/s/^/\#/' "$startup_config" + + # Update the livewallpaper variable with the selected video path (using $HOME) + selected_file="${selected_file/#$HOME/\$HOME}" # Replace /home/user with $HOME + sed -i "s|^\$livewallpaper=.*|\$livewallpaper=\"$selected_file\"|" "$startup_config" + + # Uncomment the mpvpaper line and set it with the live wallpaper path + sed -i '/^\s*#\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^#\s*//; s|mpvpaper\s*'.*'|mpvpaper '*' -o \"no-audio --loop\" \"\$livewallpaper\"|' "$startup_config" + + echo "Configured for live wallpaper (video)." else - printf "%s\n" "$pic_name" + sed -i 's/^#\(exec-once = swww-daemon.*\)$/\1/' "$startup_config" + + # Comment out the mpvpaper line + sed -i '/^exec-once = mpvpaper\s*'.*'/s/^/#/' "$startup_config" fi - done } -# initiate swww if not running -swww query || swww-daemon --format xrgb +# Apply Image Wallpaper +apply_image_wallpaper() { + local image_path="$1" -# Choice of wallpapers -main() { - choice=$(menu | $rofi_command) - - choice=$(echo "$choice" | xargs) - RANDOM_PIC_NAME=$(echo "$RANDOM_PIC_NAME" | xargs) - - # No choice case - if [[ -z "$choice" ]]; then - echo "No choice selected. Exiting." - exit 0 - fi - - # Random choice case - if [[ "$choice" == "$RANDOM_PIC_NAME" ]]; then - swww img -o "$focused_monitor" "$RANDOM_PIC" $SWWW_PARAMS; - sleep 2 + kill_wallpaper_for_image + + # Start swww-daemon if not running + if ! pgrep -x "swww-daemon" > /dev/null; then + echo "Starting swww-daemon..." + swww-daemon --format xrgb & + fi + + # Apply static image wallpaper using swww + sleep 1 + swww img -o "$focused_monitor" "$image_path" $SWWW_PARAMS + + # Run additional scripts "$SCRIPTSDIR/WallustSwww.sh" - sleep 0.5 + wait $! + sleep 2 "$SCRIPTSDIR/Refresh.sh" - exit 0 - fi - - pic_index=-1 - for i in "${!PICS[@]}"; do - filename=$(basename "${PICS[$i]}") - if [[ "$filename" == "$choice"* ]]; then - pic_index=$i - break + sleep 1 + + # set SDDM wallpaper + set_sddm_wallpaper +} + +# Apply Video Wallpaper +apply_video_wallpaper() { + local video_path="$1" + + # Check if mpvpaper is installed + if ! command -v mpvpaper &> /dev/null; then + notify-send -i "$iDIR/ja.png" "E-R-R-O-R" "mpvpaper not found" + return 1 fi - done + kill_wallpaper_for_video - if [[ $pic_index -ne -1 ]]; then - swww img -o "$focused_monitor" "${PICS[$pic_index]}" $SWWW_PARAMS - else - echo "Image not found." - exit 1 - fi + # Apply video wallpaper using mpvpaper + mpvpaper '*' -o "no-audio --loop" "$video_path" & +} +# Main function +main() { + choice=$(menu | $rofi_command) + choice=$(echo "$choice" | xargs) + RANDOM_PIC_NAME=$(echo "$RANDOM_PIC_NAME" | xargs) + + if [[ -z "$choice" ]]; then + echo "No choice selected. Exiting." + exit 0 + fi + + # Handle random selection correctly + if [[ "$choice" == "$RANDOM_PIC_NAME" ]]; then + choice=$(basename "$RANDOM_PIC") + fi + + # Find the selected file + selected_file="" + for pic in "${PICS[@]}"; do + if [[ "$(basename "$pic")" == "$choice"* ]]; then + selected_file="$pic" + break + fi + done + + if [[ -z "$selected_file" ]]; then + echo "File not found." + exit 1 + fi + + # Modify the Startup_Apps.conf file based on wallpaper type + modify_startup_config "$selected_file" + + # **CHECK FIRST** if it's a video or an image **before calling any function** + if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm)$ ]]; then + apply_video_wallpaper "$selected_file" + else + apply_image_wallpaper "$selected_file" + fi } # Check if rofi is already running if pidof rofi > /dev/null; then - pkill rofi + pkill rofi fi -main - -wait $! -"$SCRIPTSDIR/WallustSwww.sh" && - -wait $! -sleep 2 -"$SCRIPTSDIR/Refresh.sh" - -sleep 1 -# Check if user selected a wallpaper -if [[ -n "$choice" ]]; then - sddm_sequoia="/usr/share/sddm/themes/sequoia_2" - if [ -d "$sddm_sequoia" ]; then - - # Check if yad is running to avoid multiple yad notification - if pidof yad > /dev/null; then - killall yad - fi - - if yad --info --text="Set current wallpaper as SDDM background?\n\nNOTE: This only applies to SEQUOIA SDDM Theme" \ - --text-align=left \ - --title="SDDM Background" \ - --timeout=5 \ - --timeout-indicator=right \ - --button="yad-yes:0" \ - --button="yad-no:1" \ - ; then - - # Check if terminal exists - if ! command -v "$terminal" &>/dev/null; then - notify-send -i "$iDIR/ja.png" "Missing $terminal" "Install $terminal to enable setting of wallpaper background" - exit 1 - fi - - # Open terminal to enter password - $terminal -e bash -c "echo 'Enter your password to set wallpaper as SDDM Background'; \ - sudo cp -r $wallpaper_current '$sddm_sequoia/backgrounds/default' && \ - notify-send -i '$iDIR/ja.png' 'SDDM' 'Background SET'" - fi - fi -fi \ No newline at end of file +main \ No newline at end of file -- cgit v1.2.3 From 9718887ee05da55d78fb26e2d1a61d90a17a4965 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 16 Mar 2025 19:39:05 +0900 Subject: added a killall command for mpvpaper to avoid multiple mpvpaper process --- config/hypr/UserScripts/WallpaperSelect.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index ee46fdb6..0816cd49 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -46,6 +46,7 @@ rofi_override="element-icon{size:${adjusted_icon_size}%;}" # Kill existing wallpaper daemons kill_wallpaper_for_video() { killall swww + killall mpvpaper pkill swaybg pkill hyprpaper } -- cgit v1.2.3 From b1e7302265578fa070262f089d5751fad8dbea8c Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 16 Mar 2025 20:23:22 +0900 Subject: adjusted WallpaperSelect.sh & Rofi-Beats.sh to prevent killing the mpv used by mpvpaper --- config/hypr/UserScripts/RofiBeats.sh | 37 +++++++++++++++++++----------- config/hypr/UserScripts/WallpaperSelect.sh | 7 +++--- 2 files changed, 26 insertions(+), 18 deletions(-) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index b134c8a2..781e9f64 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -1,6 +1,6 @@ #!/bin/bash # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## -# For Rofi Beats to play online Music or Locally save media files +# For Rofi Beats to play online Music or Locally saved media files # Variables mDIR="$HOME/Music/" @@ -41,7 +41,7 @@ populate_local_music() { # Function for displaying notifications notification() { - notify-send -u normal -i "$iDIR/music.png" " Now Playing:" " $@" + notify-send -u normal -i "$iDIR/music.png" "Now Playing:" "$@" } # Main function for playing local music @@ -60,8 +60,6 @@ play_local_music() { if [ "${filenames[$i]}" = "$choice" ]; then notification "$choice" - - # Play the selected local music file using mpv mpv --playlist-start="$i" --loop-playlist --vid=no "${local_music[@]}" break @@ -95,18 +93,30 @@ play_online_music() { mpv --shuffle --vid=no "$link" } +# Function to stop music and kill mpv processes +stop_music() { + mpv_pids=$(pgrep -x mpv) -# Check if an online music process is running and send a notification, otherwise run the main function -pkill mpv && notify-send -u low -i "$iDIR/music.png" "Music stopped" || { + if [ -n "$mpv_pids" ]; then + # Get the PID of the mpv process used by mpvpaper (using the unique argument added) + mpvpaper_pid=$(ps aux | grep -- 'unique-wallpaper-process' | grep -v 'grep' | awk '{print $2}') -# Check if rofi is already running -if pidof rofi > /dev/null; then - pkill rofi -fi + for pid in $mpv_pids; do + if ! echo "$mpvpaper_pid" | grep -q "$pid"; then + kill -9 $pid || true + fi + done + notify-send -u low -i "$iDIR/music.png" "Music stopped" || true + fi +} +# Check if music is already playing +if pgrep -x "mpv" > /dev/null; then + stop_music +else + user_choice=$(printf "Play from Online Stations\nPlay from Music directory\nShuffle Play from Music directory" | rofi -dmenu -config $rofi_theme_1) -# Prompt the user to choose between local and online music -user_choice=$(printf "Play from Online Stations\nPlay from Music directory\nShuffle Play from Music directory" | rofi -dmenu -config $rofi_theme_1) + echo "User choice: $user_choice" case "$user_choice" in "Play from Music directory") @@ -119,7 +129,6 @@ user_choice=$(printf "Play from Online Stations\nPlay from Music directory\nShuf shuffle_local_music ;; *) - echo "Invalid choice" ;; esac -} +fi \ No newline at end of file diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index 0816cd49..161611d8 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -46,7 +46,7 @@ rofi_override="element-icon{size:${adjusted_icon_size}%;}" # Kill existing wallpaper daemons kill_wallpaper_for_video() { killall swww - killall mpvpaper + killall mpvpaper pkill swaybg pkill hyprpaper } @@ -170,7 +170,6 @@ apply_image_wallpaper() { set_sddm_wallpaper } -# Apply Video Wallpaper apply_video_wallpaper() { local video_path="$1" @@ -181,8 +180,8 @@ apply_video_wallpaper() { fi kill_wallpaper_for_video - # Apply video wallpaper using mpvpaper - mpvpaper '*' -o "no-audio --loop" "$video_path" & + # Apply video wallpaper using mpvpaper, adding a unique argument + mpvpaper '*' -o "no-audio --loop --unique-wallpaper-process" "$video_path" & } # Main function -- cgit v1.2.3 From d304be01de82f68e8ae8c763e163f366f02f2438 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 16 Mar 2025 22:39:19 +0900 Subject: update wallpaper select --- config/hypr/UserScripts/WallpaperSelect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index 161611d8..14f413d0 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -181,7 +181,7 @@ apply_video_wallpaper() { kill_wallpaper_for_video # Apply video wallpaper using mpvpaper, adding a unique argument - mpvpaper '*' -o "no-audio --loop --unique-wallpaper-process" "$video_path" & + mpvpaper '*' -o "load-scripts=no no-audio --loop --unique-wallpaper-process" "$video_path" & } # Main function -- cgit v1.2.3 From 983440c0b21cbfeaba327b4e72897c42f7e79ddc Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 17 Mar 2025 16:56:35 +0900 Subject: minor improvement on wallpaper select to handle video files --- config/hypr/UserScripts/WallpaperSelect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index 14f413d0..ff846992 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -218,7 +218,7 @@ main() { modify_startup_config "$selected_file" # **CHECK FIRST** if it's a video or an image **before calling any function** - if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm)$ ]]; then + if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm|MP4|MKV|MOV|WEBM)$ ]]; then apply_video_wallpaper "$selected_file" else apply_image_wallpaper "$selected_file" -- cgit v1.2.3 From 26844e3e21ccb9694ab902fe5176859c92de47ca Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Wed, 19 Mar 2025 10:17:26 +0900 Subject: updated wallpaper select. Better handling of wallpaper files --- config/hypr/UserScripts/WallpaperSelect.sh | 61 ++++++++++++------------------ 1 file changed, 25 insertions(+), 36 deletions(-) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index ff846992..99550db8 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -43,18 +43,19 @@ icon_size=$(echo "scale=1; ($monitor_height * 3) / ($scale_factor * 150)" | bc) adjusted_icon_size=$(echo "$icon_size" | awk '{if ($1 < 15) $1 = 20; if ($1 > 25) $1 = 25; print $1}') rofi_override="element-icon{size:${adjusted_icon_size}%;}" -# Kill existing wallpaper daemons -kill_wallpaper_for_video() { - killall swww - killall mpvpaper - pkill swaybg - pkill hyprpaper +# Kill existing wallpaper daemons for video +kill_wallpaper_for_video() { + pkill swww 2>/dev/null + pkill mpvpaper 2>/dev/null + pkill swaybg 2>/dev/null + pkill hyprpaper 2>/dev/null } +# Kill existing wallpaper daemons for image kill_wallpaper_for_image() { - killall mpvpaper - pkill swaybg - pkill hyprpaper + pkill mpvpaper 2>/dev/null + pkill swaybg 2>/dev/null + pkill hyprpaper 2>/dev/null } # Retrieve wallpapers (both images & videos) @@ -115,31 +116,27 @@ set_sddm_wallpaper() { fi } -# setting up $HOME/.config/hypr/UserConfigs/Startup_Apps.conf modify_startup_config() { local selected_file="$1" - - # Path to the configuration file local startup_config="$HOME/.config/hypr/UserConfigs/Startup_Apps.conf" # Check if it's a live wallpaper (video) if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm)$ ]]; then - # Comment out the line for swww-daemon + # For video wallpapers: sed -i '/^\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb.*$/s/^/\#/' "$startup_config" + sed -i '/^\s*#\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^#\s*//;' "$startup_config" # Update the livewallpaper variable with the selected video path (using $HOME) selected_file="${selected_file/#$HOME/\$HOME}" # Replace /home/user with $HOME sed -i "s|^\$livewallpaper=.*|\$livewallpaper=\"$selected_file\"|" "$startup_config" - # Uncomment the mpvpaper line and set it with the live wallpaper path - sed -i '/^\s*#\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^#\s*//; s|mpvpaper\s*'.*'|mpvpaper '*' -o \"no-audio --loop\" \"\$livewallpaper\"|' "$startup_config" - echo "Configured for live wallpaper (video)." else - sed -i 's/^#\(exec-once = swww-daemon.*\)$/\1/' "$startup_config" + # For image wallpapers: + sed -i '/^\s*#\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb.*$/s/^#\s*//;' "$startup_config" + sed -i '/^\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^/\#/' "$startup_config" - # Comment out the mpvpaper line - sed -i '/^exec-once = mpvpaper\s*'.*'/s/^/#/' "$startup_config" + echo "Configured for static wallpaper (image)." fi } @@ -149,24 +146,20 @@ apply_image_wallpaper() { kill_wallpaper_for_image - # Start swww-daemon if not running if ! pgrep -x "swww-daemon" > /dev/null; then echo "Starting swww-daemon..." swww-daemon --format xrgb & fi - - # Apply static image wallpaper using swww - sleep 1 + swww img -o "$focused_monitor" "$image_path" $SWWW_PARAMS # Run additional scripts "$SCRIPTSDIR/WallustSwww.sh" wait $! - sleep 2 + sleep 1 "$SCRIPTSDIR/Refresh.sh" sleep 1 - # set SDDM wallpaper set_sddm_wallpaper } @@ -180,7 +173,7 @@ apply_video_wallpaper() { fi kill_wallpaper_for_video - # Apply video wallpaper using mpvpaper, adding a unique argument + # Apply video wallpaper using mpvpaper, adding a unique argument (for mpris waybar module) mpvpaper '*' -o "load-scripts=no no-audio --loop --unique-wallpaper-process" "$video_path" & } @@ -200,21 +193,17 @@ main() { choice=$(basename "$RANDOM_PIC") fi - # Find the selected file - selected_file="" - for pic in "${PICS[@]}"; do - if [[ "$(basename "$pic")" == "$choice"* ]]; then - selected_file="$pic" - break - fi - done + choice_basename=$(basename "$choice" | sed 's/\(.*\)\.[^.]*$/\1/') + + # Search for the selected file in the wallpapers directory, including subdirectories + selected_file=$(find /home/ja/Pictures/wallpapers -iname "$choice_basename.*" -print -quit) if [[ -z "$selected_file" ]]; then - echo "File not found." + echo "File not found. Selected choice: $choice" exit 1 fi - # Modify the Startup_Apps.conf file based on wallpaper type + # Modify the Startup_Apps.conf file based on wallpaper type modify_startup_config "$selected_file" # **CHECK FIRST** if it's a video or an image **before calling any function** -- cgit v1.2.3 From 609ce12913e79ccd0951b28a18d6ca5b3fa34905 Mon Sep 17 00:00:00 2001 From: "Ja.KooLit" <85185940+JaKooLit@users.noreply.github.com> Date: Wed, 19 Mar 2025 18:59:21 +0900 Subject: Update WallpaperSelect.sh --- config/hypr/UserScripts/WallpaperSelect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index 99550db8..f9051f2e 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -196,7 +196,7 @@ main() { choice_basename=$(basename "$choice" | sed 's/\(.*\)\.[^.]*$/\1/') # Search for the selected file in the wallpapers directory, including subdirectories - selected_file=$(find /home/ja/Pictures/wallpapers -iname "$choice_basename.*" -print -quit) + selected_file=$(find $wallDIR -iname "$choice_basename.*" -print -quit) if [[ -z "$selected_file" ]]; then echo "File not found. Selected choice: $choice" -- cgit v1.2.3 From 3446b1047f1139ea4d4bcf8b2a6c883d51583433 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Wed, 19 Mar 2025 19:38:44 +0900 Subject: Updated WallpaperSelect.sh, Refresh.sh & RefreshNoWaybar.sh --- config/hypr/UserScripts/WallpaperSelect.sh | 7 +++---- config/hypr/scripts/Refresh.sh | 3 ++- config/hypr/scripts/RefreshNoWaybar.sh | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index f9051f2e..fa4d9c54 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -155,8 +155,7 @@ apply_image_wallpaper() { # Run additional scripts "$SCRIPTSDIR/WallustSwww.sh" - wait $! - sleep 1 + sleep 2 "$SCRIPTSDIR/Refresh.sh" sleep 1 @@ -174,7 +173,7 @@ apply_video_wallpaper() { kill_wallpaper_for_video # Apply video wallpaper using mpvpaper, adding a unique argument (for mpris waybar module) - mpvpaper '*' -o "load-scripts=no no-audio --loop --unique-wallpaper-process" "$video_path" & + mpvpaper '*' -o "load-scripts=no no-audio --loop" "$video_path" & } # Main function @@ -196,7 +195,7 @@ main() { choice_basename=$(basename "$choice" | sed 's/\(.*\)\.[^.]*$/\1/') # Search for the selected file in the wallpapers directory, including subdirectories - selected_file=$(find $wallDIR -iname "$choice_basename.*" -print -quit) + selected_file=$(find "$wallDIR" -iname "$choice_basename.*" -print -quit) if [[ -z "$selected_file" ]]; then echo "File not found. Selected choice: $choice" diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh index 3bd22463..2d7887a5 100755 --- a/config/hypr/scripts/Refresh.sh +++ b/config/hypr/scripts/Refresh.sh @@ -24,7 +24,6 @@ done # added since wallust sometimes not applying killall -SIGUSR2 waybar -killall -SIGUSR2 swaync # quit ags & relaunch ags #ags -q && ags & @@ -41,6 +40,8 @@ waybar & # relaunch swaync sleep 0.5 swaync > /dev/null 2>&1 & +# reload swaync +swaync-client --reload-config # Relaunching rainbow borders if the script exists sleep 1 diff --git a/config/hypr/scripts/RefreshNoWaybar.sh b/config/hypr/scripts/RefreshNoWaybar.sh index 85332a32..0ac00f14 100755 --- a/config/hypr/scripts/RefreshNoWaybar.sh +++ b/config/hypr/scripts/RefreshNoWaybar.sh @@ -31,6 +31,9 @@ done # Wallust refresh ${SCRIPTSDIR}/WallustSwww.sh & +# reload swaync +swaync-client --reload-configv + # Relaunching rainbow borders if the script exists sleep 1 if file_exists "${UserScripts}/RainbowBorders.sh"; then -- cgit v1.2.3 From c414b2b4bb3a5be82ce48c054b35803a04c8517e Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Thu, 20 Mar 2025 18:08:17 +0900 Subject: updated some scripts to reflect new images on swaync --- config/hypr/Monitor_Profiles/README | 9 ++++++-- config/hypr/UserScripts/WallpaperSelect.sh | 8 +++---- config/hypr/UserScripts/ZshChangeTheme.sh | 4 ++-- config/hypr/scripts/ChangeBlur.sh | 6 ++--- config/hypr/scripts/Distro_update.sh | 16 ++++++------- config/hypr/scripts/Kitty_themes.sh | 10 ++++++-- config/hypr/scripts/KooLsDotsUpdate.sh | 16 ++++++------- config/hypr/scripts/Kool_Quick_Settings.sh | 10 ++++---- config/hypr/scripts/ScreenShot.sh | 2 +- config/hypr/wallust/wallust-hyprland.conf | 36 ++++++++++++++--------------- config/swaync/images/error.png | Bin 0 -> 62849 bytes config/swaync/images/note.png | Bin 0 -> 152249 bytes 12 files changed, 64 insertions(+), 53 deletions(-) create mode 100644 config/swaync/images/error.png create mode 100644 config/swaync/images/note.png (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/Monitor_Profiles/README b/config/hypr/Monitor_Profiles/README index b2e218c5..86075d77 100644 --- a/config/hypr/Monitor_Profiles/README +++ b/config/hypr/Monitor_Profiles/README @@ -3,7 +3,12 @@ # Create a unique file name i.e. Mirror, or Office, Scale, etc etc # tip: You can easily create a profile using nwg-displays -# after which, you can copy the ~/.config/hypr/monitors.conf file in this directory +# after creating a profile using nwg-displays, copy the ~/.config/hypr/monitors.conf file to this directory with a unique file name +# suggest not to call it default -# Note, after selecting Profiles wanted, it will copy contents into ~/.config/hypr/monitors.conf + +# Note, after selecting Profiles wanted via Rofi (SUPER SHIFT E), previous content of ~/.config/hypr/monitors.conf will be backed up and named as Previous_Profile.conf + +# Monitor profile should be loaded automatically once selected by KooL Rofi Settings ROfi Menu, unless you disabled the auto-reload function on Hyprland settings. +# However, if it does not load, kindly log out and re-login. This seem apparent if you are using a Virtual Environment. diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index fa4d9c54..e26dcd46 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -21,7 +21,7 @@ SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration # Check if package bc exists if ! command -v bc &>/dev/null; then - notify-send -i "$iDIR/ja.png" "bc missing" "Install package bc first" + notify-send -i "$iDIR/error.png" "bc missing" "Install package bc first" exit 1 fi @@ -31,7 +31,7 @@ focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') # Ensure focused_monitor is detected if [[ -z "$focused_monitor" ]]; then - notify-send -i "$iDIR/ja.png" "E-R-R-O-R" "Could not detect focused monitor" + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Could not detect focused monitor" exit 1 fi @@ -104,7 +104,7 @@ set_sddm_wallpaper() { # Check if terminal exists if ! command -v "$terminal" &>/dev/null; then - notify-send -i "$iDIR/ja.png" "Missing $terminal" "Install $terminal to enable setting of wallpaper background" + notify-send -i "$iDIR/error.png" "Missing $terminal" "Install $terminal to enable setting of wallpaper background" exit 1 fi @@ -167,7 +167,7 @@ apply_video_wallpaper() { # Check if mpvpaper is installed if ! command -v mpvpaper &> /dev/null; then - notify-send -i "$iDIR/ja.png" "E-R-R-O-R" "mpvpaper not found" + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "mpvpaper not found" return 1 fi kill_wallpaper_for_video diff --git a/config/hypr/UserScripts/ZshChangeTheme.sh b/config/hypr/UserScripts/ZshChangeTheme.sh index 4919a890..cffaf5cb 100755 --- a/config/hypr/UserScripts/ZshChangeTheme.sh +++ b/config/hypr/UserScripts/ZshChangeTheme.sh @@ -10,7 +10,7 @@ iDIR="$HOME/.config/swaync/images" rofi_theme="$HOME/.config/rofi/config-zsh-theme.rasi" if [ -n "$(grep -i nixos < /etc/os-release)" ]; then - notify-send -i "$iDIR/ja.png" "NOT Supported" "Sorry NixOS does not support this KooL feature" + notify-send -i "$iDIR/note.png" "NOT Supported" "Sorry NixOS does not support this KooL feature" exit 1 fi @@ -57,7 +57,7 @@ main() { sed -i "s/^$var_name=.*/$var_name=\"$theme_to_set\"/" "$zsh_path" notify-send -i "$iDIR/ja.png" "OMZ theme" "applied. restart your terminal" else - notify-send -i "$iDIR/ja.png" "Error:" "~.zshrc file not found!" + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "~.zshrc file not found!" fi } diff --git a/config/hypr/scripts/ChangeBlur.sh b/config/hypr/scripts/ChangeBlur.sh index 46aaad68..895987a4 100755 --- a/config/hypr/scripts/ChangeBlur.sh +++ b/config/hypr/scripts/ChangeBlur.sh @@ -2,16 +2,16 @@ # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # Script for changing blurs on the fly -notif="$HOME/.config/swaync/images/ja.png" +notif="$HOME/.config/swaync/images" STATE=$(hyprctl -j getoption decoration:blur:passes | jq ".int") if [ "${STATE}" == "2" ]; then hyprctl keyword decoration:blur:size 2 hyprctl keyword decoration:blur:passes 1 - notify-send -e -u low -i "$notif" " Less Blur" + notify-send -e -u low -i "$notif/note.png" " Less Blur" else hyprctl keyword decoration:blur:size 5 hyprctl keyword decoration:blur:passes 2 - notify-send -e -u low -i "$notif" " Normal Blur" + notify-send -e -u low -i "$notif/ja.png" " Normal Blur" fi diff --git a/config/hypr/scripts/Distro_update.sh b/config/hypr/scripts/Distro_update.sh index c687ba0c..b0b1446b 100755 --- a/config/hypr/scripts/Distro_update.sh +++ b/config/hypr/scripts/Distro_update.sh @@ -3,11 +3,11 @@ # Simple bash script to check and will try to update your system # Local Paths -iDIR="$HOME/.config/swaync/images/ja.png" +iDIR="$HOME/.config/swaync/images" # Check for required tools (kitty) if ! command -v kitty &> /dev/null; then - notify-send -i $iDIR "Need Kitty:" "Kitty terminal not found. Please install Kitty terminal." + notify-send -i "$iDIR/error.png" "Need Kitty:" "Kitty terminal not found. Please install Kitty terminal." exit 1 fi @@ -16,25 +16,25 @@ if command -v paru &> /dev/null || command -v yay &> /dev/null; then # Arch-based if command -v paru &> /dev/null; then kitty -T update paru -Syu - notify-send -i $iDIR -u low 'Arch-based system' 'has been updated.' + notify-send -i "$iDIR/ja.png" -u low 'Arch-based system' 'has been updated.' else kitty -T update yay -Syu - notify-send -i $iDIR -u low 'Arch-based system' 'has been updated.' + notify-send -i "$iDIR/ja.png" -u low 'Arch-based system' 'has been updated.' fi elif command -v dnf &> /dev/null; then # Fedora-based kitty -T update sudo dnf update --refresh -y - notify-send -i $iDIR -u low 'Fedora system' 'has been updated.' + notify-send -i "$iDIR/ja.png" -u low 'Fedora system' 'has been updated.' elif command -v apt &> /dev/null; then # Debian-based (Debian, Ubuntu, etc.) kitty -T update sudo apt update && sudo apt upgrade -y - notify-send -i $iDIR -u low 'Debian/Ubuntu system' 'has been updated.' + notify-send -i "$iDIR/ja.png" -u low 'Debian/Ubuntu system' 'has been updated.' elif command -v zypper &> /dev/null; then # openSUSE-based kitty -T update sudo zypper dup -y - notify-send -i $iDIR -u low 'openSUSE system' 'has been updated.' + notify-send -i "$iDIR/ja.png" -u low 'openSUSE system' 'has been updated.' else # Unsupported distro - notify-send -i $iDIR -u critical "Unsupported system" "This script does not support your distribution." + notify-send -i "$iDIR/error.png" -u critical "Unsupported system" "This script does not support your distribution." exit 1 fi diff --git a/config/hypr/scripts/Kitty_themes.sh b/config/hypr/scripts/Kitty_themes.sh index 471b7143..31c19a1d 100755 --- a/config/hypr/scripts/Kitty_themes.sh +++ b/config/hypr/scripts/Kitty_themes.sh @@ -9,12 +9,18 @@ kitty_config="$HOME/.config/kitty/kitty.conf" iDIR="$HOME/.config/swaync/images" rofi_theme="$HOME/.config/rofi/config-kitty-theme.rasi" +# Check if the Kitty Themes directory exists +if [ ! -d "$kitty_themes_DiR" ]; then + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Unable to locate Kitty Themes directory. Exiting....." + exit 1 +fi + # List the kitty-theme files from the themes directory theme=$(ls "$kitty_themes_DiR"/*.conf | xargs -n 1 basename | sed 's/\.conf$//' | rofi -dmenu -config $rofi_theme) -# Check if the user selected a theme +# Check if no theme was selected, and exit if empty if [ -z "$theme" ]; then - echo "No theme selected, exiting..." + notify-send -u low -i "$iDIR/note.png" "No kitty theme" "selected. Exiting....." exit 1 fi diff --git a/config/hypr/scripts/KooLsDotsUpdate.sh b/config/hypr/scripts/KooLsDotsUpdate.sh index 4996da82..f4b8814a 100755 --- a/config/hypr/scripts/KooLsDotsUpdate.sh +++ b/config/hypr/scripts/KooLsDotsUpdate.sh @@ -4,13 +4,13 @@ # Local Paths local_dir="$HOME/.config/hypr" -iDIR="$HOME/.config/swaync/images/ja.png" +iDIR="$HOME/.config/swaync/images/" local_version=$(ls $local_dir/v* 2>/dev/null | sort -V | tail -n 1 | sed 's/.*v\(.*\)/\1/') KooL_Dots_DIR="$HOME/Hyprland-Dots" # exit if cannot find local version if [ -z "$local_version" ]; then - notify-send -i $iDIR "ERROR "!?!?!!"" "Unable to find KooL's dots version . exiting.... " + notify-send -i "$iDIR/error.png" "ERROR "!?!?!!"" "Unable to find KooL's dots version . exiting.... " exit 1 fi @@ -28,12 +28,12 @@ fi # Comparing local and github versions if [ "$(echo -e "$github_version\n$local_version" | sort -V | head -n 1)" = "$github_version" ]; then - notify-send -i $iDIR "KooL Hyprland:" "No update available" + notify-send -i "$iDIR/note.png" "KooL Hyprland:" "No update available" exit 0 else # update available notify_cmd_base="notify-send -t 10000 -A action1=Update -A action2=NO -h string:x-canonical-private-synchronous:shot-notify" - notify_cmd_shot="${notify_cmd_base} -i $iDIR" + notify_cmd_shot="${notify_cmd_base} -i $iDIR/ja.png" response=$($notify_cmd_shot "KooL Hyprland:" "Update available! Update now?") @@ -41,7 +41,7 @@ else "action1") if [ -d $KooL_Dots_DIR ]; then if ! command -v kitty &> /dev/null; then - notify-send -i $iDIR "Need Kitty:" "Kitty terminal not found. Please install Kitty terminal." + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Kitty terminal not found. Please install Kitty terminal." exit 1 fi kitty -e bash -c " @@ -49,12 +49,12 @@ else git stash && git pull && ./copy.sh && - notify-send -u critical -i $iDIR 'Update Completed:' 'Kindly log out and relogin to take effect' + notify-send -u critical -i "$iDIR/ja.png" 'Update Completed:' 'Kindly log out and relogin to take effect' " else if ! command -v kitty &> /dev/null; then - notify-send -i $iDIR "Need Kitty:" "Kitty terminal not found. Please install Kitty terminal." + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Kitty terminal not found. Please install Kitty terminal." exit 1 fi kitty -e bash -c " @@ -62,7 +62,7 @@ else cd $KooL_Dots_DIR && chmod +x copy.sh && ./copy.sh && - notify-send -u critical -i $iDIR 'Update Completed:' 'Kindly log out and relogin to take effect' + notify-send -u critical -i "$iDIR/ja.png" 'Update Completed:' 'Kindly log out and relogin to take effect' " fi ;; diff --git a/config/hypr/scripts/Kool_Quick_Settings.sh b/config/hypr/scripts/Kool_Quick_Settings.sh index 85351216..e43749bf 100755 --- a/config/hypr/scripts/Kool_Quick_Settings.sh +++ b/config/hypr/scripts/Kool_Quick_Settings.sh @@ -66,31 +66,31 @@ main() { "Choose Kitty Terminal Theme") $scriptsDir/Kitty_themes.sh ;; "Configure Monitors (nwg-displays)") if ! command -v nwg-displays &>/dev/null; then - notify-send -i "$iDIR/ja.png" "E-R-R-O-R" "Install nwg-displays first" + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Install nwg-displays first" exit 1 fi nwg-displays ;; "Configure Workspace Rules (nwg-displays)") if ! command -v nwg-displays &>/dev/null; then - notify-send -i "$iDIR/ja.png" "E-R-R-O-R" "Install nwg-displays first" + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Install nwg-displays first" exit 1 fi nwg-displays ;; "GTK Settings (nwg-look)") if ! command -v nwg-look &>/dev/null; then - notify-send -i "$iDIR/ja.png" "E-R-R-O-R" "Install nwg-look first" + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Install nwg-look first" exit 1 fi nwg-look ;; "QT Apps Settings (qt6ct)") if ! command -v qt6ct &>/dev/null; then - notify-send -i "$iDIR/ja.png" "E-R-R-O-R" "Install qt6ct first" + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Install qt6ct first" exit 1 fi qt6ct ;; "QT Apps Settings (qt5ct)") if ! command -v qt5ct &>/dev/null; then - notify-send -i "$iDIR/ja.png" "E-R-R-O-R" "Install qt5ct first" + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Install qt5ct first" exit 1 fi qt5ct ;; diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 852be4b0..b0f666aa 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -18,7 +18,7 @@ active_window_path="${dir}/${active_window_file}" notify_cmd_base="notify-send -t 10000 -A action1=Open -A action2=Delete -h string:x-canonical-private-synchronous:shot-notify" notify_cmd_shot="${notify_cmd_base} -i ${iDIR}/picture.png " notify_cmd_shot_win="${notify_cmd_base} -i ${iDIR}/picture.png " -notify_cmd_NOT="notify-send -u low -i ${iDoR}/ja.png " +notify_cmd_NOT="notify-send -u low -i ${iDoR}/note.png " # notify and view screenshot notify_view() { diff --git a/config/hypr/wallust/wallust-hyprland.conf b/config/hypr/wallust/wallust-hyprland.conf index 92bcfc7c..c7c1debe 100644 --- a/config/hypr/wallust/wallust-hyprland.conf +++ b/config/hypr/wallust/wallust-hyprland.conf @@ -1,21 +1,21 @@ # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ # /* wallust template - colors-hyprland */ -$background = rgb(1E1516) -$foreground = rgb(ACF2F1) -$color0 = rgb(463C3D) -$color1 = rgb(181916) -$color2 = rgb(073122) -$color3 = rgb(073122) -$color4 = rgb(0E455E) -$color5 = rgb(0D942F) -$color6 = rgb(0DA4A1) -$color7 = rgb(80E4E2) -$color8 = rgb(59A09E) -$color9 = rgb(20211D) -$color10 = rgb(09422D) -$color11 = rgb(09422D) -$color12 = rgb(135C7D) -$color13 = rgb(11C63F) -$color14 = rgb(11DAD6) -$color15 = rgb(80E4E2) +$background = rgb(010102) +$foreground = rgb(FDF8FE) +$color0 = rgb(313131) +$color1 = rgb(09050C) +$color2 = rgb(221647) +$color3 = rgb(2C1A40) +$color4 = rgb(5E3887) +$color5 = rgb(7344A6) +$color6 = rgb(BAB0BD) +$color7 = rgb(F3ECF5) +$color8 = rgb(AAA5AC) +$color9 = rgb(0B0711) +$color10 = rgb(2D1D5F) +$color11 = rgb(3B2355) +$color12 = rgb(7D4AB4) +$color13 = rgb(9A5BDD) +$color14 = rgb(F8EAFC) +$color15 = rgb(F3ECF5) diff --git a/config/swaync/images/error.png b/config/swaync/images/error.png new file mode 100644 index 00000000..620b05af Binary files /dev/null and b/config/swaync/images/error.png differ diff --git a/config/swaync/images/note.png b/config/swaync/images/note.png new file mode 100644 index 00000000..81c82e87 Binary files /dev/null and b/config/swaync/images/note.png differ -- cgit v1.2.3 From d23a644072d5d6774f373bce8f7d5734905bf659 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Thu, 20 Mar 2025 20:13:24 +0900 Subject: minor WallpaperSelect.sh update --- config/hypr/UserScripts/WallpaperSelect.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index e26dcd46..4dde34f8 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -45,7 +45,7 @@ rofi_override="element-icon{size:${adjusted_icon_size}%;}" # Kill existing wallpaper daemons for video kill_wallpaper_for_video() { - pkill swww 2>/dev/null + swww kill 2>/dev/null pkill mpvpaper 2>/dev/null pkill swaybg 2>/dev/null pkill hyprpaper 2>/dev/null @@ -172,7 +172,7 @@ apply_video_wallpaper() { fi kill_wallpaper_for_video - # Apply video wallpaper using mpvpaper, adding a unique argument (for mpris waybar module) + # Apply video wallpaper using mpvpaper mpvpaper '*' -o "load-scripts=no no-audio --loop" "$video_path" & } -- cgit v1.2.3 From a953e38d3dd49c8891b7f666e2329904bd75bbeb Mon Sep 17 00:00:00 2001 From: loner Date: Thu, 20 Mar 2025 20:01:28 +0800 Subject: Fixed the preview of wallpaper --- config/hypr/UserScripts/WallpaperSelect.sh | 263 +++++++++++++++-------------- 1 file changed, 140 insertions(+), 123 deletions(-) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index 4dde34f8..34e44353 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -1,5 +1,5 @@ #!/bin/bash -# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ # This script for selecting wallpapers (SUPER W) # WALLPAPERS PATH @@ -21,8 +21,8 @@ SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration # Check if package bc exists if ! command -v bc &>/dev/null; then - notify-send -i "$iDIR/error.png" "bc missing" "Install package bc first" - exit 1 + notify-send -i "$iDIR/error.png" "bc missing" "Install package bc first" + exit 1 fi # Variables @@ -31,8 +31,8 @@ focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') # Ensure focused_monitor is detected if [[ -z "$focused_monitor" ]]; then - notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Could not detect focused monitor" - exit 1 + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Could not detect focused monitor" + exit 1 fi # Monitor details @@ -45,24 +45,24 @@ rofi_override="element-icon{size:${adjusted_icon_size}%;}" # Kill existing wallpaper daemons for video kill_wallpaper_for_video() { - swww kill 2>/dev/null - pkill mpvpaper 2>/dev/null - pkill swaybg 2>/dev/null - pkill hyprpaper 2>/dev/null + swww kill 2>/dev/null + pkill mpvpaper 2>/dev/null + pkill swaybg 2>/dev/null + pkill hyprpaper 2>/dev/null } # Kill existing wallpaper daemons for image kill_wallpaper_for_image() { - pkill mpvpaper 2>/dev/null - pkill swaybg 2>/dev/null - pkill hyprpaper 2>/dev/null + pkill mpvpaper 2>/dev/null + pkill swaybg 2>/dev/null + pkill hyprpaper 2>/dev/null } # Retrieve wallpapers (both images & videos) mapfile -d '' PICS < <(find -L "${wallDIR}" -type f \( \ - -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o \ - -iname "*.bmp" -o -iname "*.tiff" -o -iname "*.webp" -o \ - -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.mov" -o -iname "*.webm" \) -print0) + -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o \ + -iname "*.bmp" -o -iname "*.tiff" -o -iname "*.webp" -o \ + -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.mov" -o -iname "*.webm" \) -print0) RANDOM_PIC="${PICS[$((RANDOM % ${#PICS[@]}))]}" RANDOM_PIC_NAME=". random" @@ -72,150 +72,167 @@ rofi_command="rofi -i -show -dmenu -config $rofi_theme -theme-str $rofi_override # Sorting Wallpapers menu() { - IFS=$'\n' sorted_options=($(sort <<<"${PICS[*]}")) - - printf "%s\x00icon\x1f%s\n" "$RANDOM_PIC_NAME" "$RANDOM_PIC" - - for pic_path in "${sorted_options[@]}"; do - pic_name=$(basename "$pic_path") - printf "%s\x00icon\x1f%s\n" "$(echo "$pic_name" | cut -d. -f1)" "$pic_path" - done + IFS=$'\n' sorted_options=($(sort <<<"${PICS[*]}")) + + printf "%s\x00icon\x1f%s\n" "$RANDOM_PIC_NAME" "$RANDOM_PIC" + + for pic_path in "${sorted_options[@]}"; do + pic_name=$(basename "$pic_path") + if [[ "$pic_name" =~ \.gif$ ]]; then + cache_gif_image="$HOME/.cache/gif_preview/${pic_name}.png" + if [[ ! -f "$cache_gif_image" ]]; then + mkdir -p "$HOME/.cache/gif_preview" + magick "$pic_path[0]" -resize 1920x1080 "$cache_gif_image" + fi + printf "%s\x00icon\x1f%s\n" "$pic_name" "$cache_gif_image" + elif [[ "$pic_name" =~ \.(mp4|mkv|mov|webm|MP4|MKV|MOV|WEBM)$ ]]; then + cache_preview_image="$HOME/.cache/video_preview/${pic_name}.png" + if [[ ! -f "$cache_preview_image" ]]; then + mkdir -p "$HOME/.cache/video_preview" + ffmpeg -v error -y -i "$pic_path" -ss 00:00:01.000 -vframes 1 "$cache_preview_image" + fi + printf "%s\x00icon\x1f%s\n" "$pic_name" "$cache_preview_image" + else + printf "%s\x00icon\x1f%s\n" "$(echo "$pic_name" | cut -d. -f1)" "$pic_path" + fi + done } # Offer SDDM Sequioa Wallpaper Option (only for non-video wallpapers) set_sddm_wallpaper() { - sleep 1 - sddm_sequoia="/usr/share/sddm/themes/sequoia_2" - - if [ -d "$sddm_sequoia" ]; then - - # Check if yad is running to avoid multiple notifications - if pidof yad > /dev/null; then - killall yad - fi - - if yad --info --text="Set current wallpaper as SDDM background?\n\nNOTE: This only applies to SEQUOIA SDDM Theme" \ - --text-align=left \ - --title="SDDM Background" \ - --timeout=5 \ - --timeout-indicator=right \ - --button="yes:0" \ - --button="no:1"; then - - # Check if terminal exists - if ! command -v "$terminal" &>/dev/null; then - notify-send -i "$iDIR/error.png" "Missing $terminal" "Install $terminal to enable setting of wallpaper background" - exit 1 - fi - - # Open terminal to enter password - $terminal -e bash -c "echo 'Enter your password to set wallpaper as SDDM Background'; \ + sleep 1 + sddm_sequoia="/usr/share/sddm/themes/sequoia_2" + + if [ -d "$sddm_sequoia" ]; then + + # Check if yad is running to avoid multiple notifications + if pidof yad >/dev/null; then + killall yad + fi + + if yad --info --text="Set current wallpaper as SDDM background?\n\nNOTE: This only applies to SEQUOIA SDDM Theme" \ + --text-align=left \ + --title="SDDM Background" \ + --timeout=5 \ + --timeout-indicator=right \ + --button="yes:0" \ + --button="no:1"; then + + # Check if terminal exists + if ! command -v "$terminal" &>/dev/null; then + notify-send -i "$iDIR/error.png" "Missing $terminal" "Install $terminal to enable setting of wallpaper background" + exit 1 + fi + + # Open terminal to enter password + $terminal -e bash -c "echo 'Enter your password to set wallpaper as SDDM Background'; \ sudo cp -r $wallpaper_current '$sddm_sequoia/backgrounds/default' && \ notify-send -i '$iDIR/ja.png' 'SDDM' 'Background SET'" - fi fi + fi } modify_startup_config() { - local selected_file="$1" - local startup_config="$HOME/.config/hypr/UserConfigs/Startup_Apps.conf" - - # Check if it's a live wallpaper (video) - if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm)$ ]]; then - # For video wallpapers: - sed -i '/^\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb.*$/s/^/\#/' "$startup_config" - sed -i '/^\s*#\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^#\s*//;' "$startup_config" - - # Update the livewallpaper variable with the selected video path (using $HOME) - selected_file="${selected_file/#$HOME/\$HOME}" # Replace /home/user with $HOME - sed -i "s|^\$livewallpaper=.*|\$livewallpaper=\"$selected_file\"|" "$startup_config" - - echo "Configured for live wallpaper (video)." - else - # For image wallpapers: - sed -i '/^\s*#\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb.*$/s/^#\s*//;' "$startup_config" - sed -i '/^\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^/\#/' "$startup_config" - - echo "Configured for static wallpaper (image)." - fi + local selected_file="$1" + local startup_config="$HOME/.config/hypr/UserConfigs/Startup_Apps.conf" + + # Check if it's a live wallpaper (video) + if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm)$ ]]; then + # For video wallpapers: + sed -i '/^\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb.*$/s/^/\#/' "$startup_config" + sed -i '/^\s*#\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^#\s*//;' "$startup_config" + + # Update the livewallpaper variable with the selected video path (using $HOME) + selected_file="${selected_file/#$HOME/\$HOME}" # Replace /home/user with $HOME + sed -i "s|^\$livewallpaper=.*|\$livewallpaper=\"$selected_file\"|" "$startup_config" + + echo "Configured for live wallpaper (video)." + else + # For image wallpapers: + sed -i '/^\s*#\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb.*$/s/^#\s*//;' "$startup_config" + sed -i '/^\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^/\#/' "$startup_config" + + echo "Configured for static wallpaper (image)." + fi } # Apply Image Wallpaper apply_image_wallpaper() { - local image_path="$1" + local image_path="$1" - kill_wallpaper_for_image + kill_wallpaper_for_image - if ! pgrep -x "swww-daemon" > /dev/null; then - echo "Starting swww-daemon..." - swww-daemon --format xrgb & - fi - - swww img -o "$focused_monitor" "$image_path" $SWWW_PARAMS + if ! pgrep -x "swww-daemon" >/dev/null; then + echo "Starting swww-daemon..." + swww-daemon --format xrgb & + fi + + swww img -o "$focused_monitor" "$image_path" $SWWW_PARAMS - # Run additional scripts - "$SCRIPTSDIR/WallustSwww.sh" - sleep 2 - "$SCRIPTSDIR/Refresh.sh" - sleep 1 + # Run additional scripts + "$SCRIPTSDIR/WallustSwww.sh" + sleep 2 + "$SCRIPTSDIR/Refresh.sh" + sleep 1 - set_sddm_wallpaper + set_sddm_wallpaper } apply_video_wallpaper() { - local video_path="$1" + local video_path="$1" - # Check if mpvpaper is installed - if ! command -v mpvpaper &> /dev/null; then - notify-send -i "$iDIR/error.png" "E-R-R-O-R" "mpvpaper not found" - return 1 - fi - kill_wallpaper_for_video + # Check if mpvpaper is installed + if ! command -v mpvpaper &>/dev/null; then + notify-send -i "$iDIR/error.png" "E-R-R-O-R" "mpvpaper not found" + return 1 + fi + kill_wallpaper_for_video - # Apply video wallpaper using mpvpaper - mpvpaper '*' -o "load-scripts=no no-audio --loop" "$video_path" & + # Apply video wallpaper using mpvpaper + mpvpaper '*' -o "load-scripts=no no-audio --loop" "$video_path" & } # Main function main() { - choice=$(menu | $rofi_command) - choice=$(echo "$choice" | xargs) - RANDOM_PIC_NAME=$(echo "$RANDOM_PIC_NAME" | xargs) + choice=$(menu | $rofi_command) + choice=$(echo "$choice" | xargs) + RANDOM_PIC_NAME=$(echo "$RANDOM_PIC_NAME" | xargs) - if [[ -z "$choice" ]]; then - echo "No choice selected. Exiting." - exit 0 - fi + if [[ -z "$choice" ]]; then + echo "No choice selected. Exiting." + exit 0 + fi - # Handle random selection correctly - if [[ "$choice" == "$RANDOM_PIC_NAME" ]]; then - choice=$(basename "$RANDOM_PIC") - fi + # Handle random selection correctly + if [[ "$choice" == "$RANDOM_PIC_NAME" ]]; then + choice=$(basename "$RANDOM_PIC") + fi - choice_basename=$(basename "$choice" | sed 's/\(.*\)\.[^.]*$/\1/') + choice_basename=$(basename "$choice" | sed 's/\(.*\)\.[^.]*$/\1/') - # Search for the selected file in the wallpapers directory, including subdirectories - selected_file=$(find "$wallDIR" -iname "$choice_basename.*" -print -quit) + # Search for the selected file in the wallpapers directory, including subdirectories + selected_file=$(find "$wallDIR" -iname "$choice_basename.*" -print -quit) - if [[ -z "$selected_file" ]]; then - echo "File not found. Selected choice: $choice" - exit 1 - fi + if [[ -z "$selected_file" ]]; then + echo "File not found. Selected choice: $choice" + exit 1 + fi - # Modify the Startup_Apps.conf file based on wallpaper type - modify_startup_config "$selected_file" + # Modify the Startup_Apps.conf file based on wallpaper type + modify_startup_config "$selected_file" - # **CHECK FIRST** if it's a video or an image **before calling any function** - if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm|MP4|MKV|MOV|WEBM)$ ]]; then - apply_video_wallpaper "$selected_file" - else - apply_image_wallpaper "$selected_file" - fi + # **CHECK FIRST** if it's a video or an image **before calling any function** + if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm|MP4|MKV|MOV|WEBM)$ ]]; then + apply_video_wallpaper "$selected_file" + else + apply_image_wallpaper "$selected_file" + fi } # Check if rofi is already running -if pidof rofi > /dev/null; then - pkill rofi +if pidof rofi >/dev/null; then + pkill rofi fi -main \ No newline at end of file +main + -- cgit v1.2.3 From 2d927892e5354abb14b9738d895b7084452886e2 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Thu, 20 Mar 2025 22:06:47 +0900 Subject: updated startup apps.conf and WallpaperSelect.sh as it seems that it is also uncommented the lower part exec-once - swww --- config/hypr/UserConfigs/Startup_Apps.conf | 2 +- config/hypr/UserScripts/WallpaperSelect.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'config/hypr/UserScripts/WallpaperSelect.sh') diff --git a/config/hypr/UserConfigs/Startup_Apps.conf b/config/hypr/UserConfigs/Startup_Apps.conf index bdc0b447..702f9a90 100644 --- a/config/hypr/UserConfigs/Startup_Apps.conf +++ b/config/hypr/UserConfigs/Startup_Apps.conf @@ -11,7 +11,7 @@ $livewallpaper="" # wallpaper stuff exec-once = swww-daemon --format xrgb -#exec-once = mpvpaper * -o "no-audio --loop" "$livewallpaper" +#exec-once = mpvpaper '*' -o "load-scripts=no no-audio --loop" $livewallpaper # wallpaper random #exec-once = $SwwwRandom $wallDIR # random wallpaper switcher every 30 minutes diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index 34e44353..b5943586 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -139,7 +139,7 @@ modify_startup_config() { # Check if it's a live wallpaper (video) if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm)$ ]]; then # For video wallpapers: - sed -i '/^\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb.*$/s/^/\#/' "$startup_config" + sed -i '/^\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb\s*$/s/^/\#/' "$startup_config" sed -i '/^\s*#\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^#\s*//;' "$startup_config" # Update the livewallpaper variable with the selected video path (using $HOME) @@ -149,7 +149,8 @@ modify_startup_config() { echo "Configured for live wallpaper (video)." else # For image wallpapers: - sed -i '/^\s*#\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb.*$/s/^#\s*//;' "$startup_config" + sed -i '/^\s*#\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb\s*$/s/^\s*#\s*//;' "$startup_config" + sed -i '/^\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^/\#/' "$startup_config" echo "Configured for static wallpaper (image)." -- cgit v1.2.3