From c2578231edeb0cb812bcd038d11d295132872141 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 3 Jun 2024 17:23:26 +0900 Subject: Wallpaper-Effects (Super Shift W) --- config/hypr/UserScripts/WallpaperEffects.sh | 96 +++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100755 config/hypr/UserScripts/WallpaperEffects.sh (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/WallpaperEffects.sh b/config/hypr/UserScripts/WallpaperEffects.sh new file mode 100755 index 00000000..de4470d2 --- /dev/null +++ b/config/hypr/UserScripts/WallpaperEffects.sh @@ -0,0 +1,96 @@ +#!/bin/bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ # +# Wallpaper Effects using imagemagick +# Inspiration from ML4W - Stephan Raabe https://gitlab.com/stephan-raabe/dotfiles + +# variables +current_wallpaper="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" +wallpaper_output="$HOME/.config/hypr/wallpaper_effects/.wallpaper_modified" +SCRIPTSDIR="$HOME/.config/hypr/scripts" +focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}') + +# Directory for swaync +iDIR="$HOME/.config/swaync/images" + +# swww transition config +FPS=60 +TYPE="wipe" +DURATION=2 +BEZIER=".43,1.19,1,.4" +SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION" + +# Define ImageMagick effects +# https://imagemagick.org/script/magick.php + +declare -A effects=( +["Black and White"]="magick $current_wallpaper -set colorspace Gray -separate -average $wallpaper_output" +["Blurred"]="magick $current_wallpaper -blur "20x30" $wallpaper_output" +["Solarize"]="magick $current_wallpaper -solarize 80% $wallpaper_output" +["Sepia-Tone"]="magick $current_wallpaper -sepia-tone 65% $wallpaper_output" +["Negate"]="magick $current_wallpaper -negate $wallpaper_output" +["Charcoal"]="magick $current_wallpaper -charcoal "10x90" $wallpaper_output" +["No Effects"]="no-effects" +) + +# Function to apply no effects +no_effects() { + swww img -o "$focused_monitor" "$current_wallpaper" $SWWW_PARAMS & + # Wait for swww command to complete + wait $! + # Run other commands after swww + wallust run "$current_wallpaper" -s & + # Wait to complete + wait $! + # Refresh rofi, waybar, wallust palettes + "${SCRIPTSDIR}/Refresh.sh" + notify-send -u low -i "$iDIR/bell.png" "No wallpaper effects" +} + +# Function to run rofi menu +main() { + # Populate rofi menu options + options="No Effects\n" + for effect in "${!effects[@]}"; do + if [ "$effect" != "No Effects" ]; then + options+="$effect\n" + fi + done + + # rofi + choice=$(echo -e "$options" | rofi -i -dmenu -config ~/.config/rofi/config-wallpaper-effect.rasi) + if [ ! -z "$choice" ]; then + # Check if the choice exists in the array + if [[ "${effects[$choice]+exists}" ]]; then + if [ "$choice" == "No Effects" ]; then + no_effects + else + # Apply selected effect + notify-send -i "$iDIR/bell.png" "Applying $choice effects" + eval "${effects[$choice]}" + # Wait for effects to be applied + sleep 1 + # Execute swww command after image conversion + swww img -o "$focused_monitor" "$wallpaper_output" $SWWW_PARAMS & + # Wait for swww command to complete + wait $! + # Run other commands after swww + wallust run "$wallpaper_output" -s & + # Wait for other commands to finish + wait $! + # Refresh rofi, waybar, wallust palettes + "${SCRIPTSDIR}/Refresh.sh" + notify-send -u low -i "$iDIR/bell.png" "$choice effects applied" + fi + else + echo "Effects not recognized." + fi + fi +} + +# Check if rofi is already running +if pidof rofi > /dev/null; then + pkill rofi + exit 0 +fi + +main -- cgit v1.2.3 From 83a1038c8b9dd7907e3677ee7dd5630c9286d0e8 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 3 Jun 2024 18:00:22 +0900 Subject: updated Wallpaper Effect scripts --- config/hypr/UserScripts/WallpaperEffects.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/WallpaperEffects.sh b/config/hypr/UserScripts/WallpaperEffects.sh index de4470d2..9122da34 100755 --- a/config/hypr/UserScripts/WallpaperEffects.sh +++ b/config/hypr/UserScripts/WallpaperEffects.sh @@ -23,12 +23,12 @@ SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration # https://imagemagick.org/script/magick.php declare -A effects=( -["Black and White"]="magick $current_wallpaper -set colorspace Gray -separate -average $wallpaper_output" +["Black & White"]="magick $current_wallpaper -set colorspace Gray -separate -average $wallpaper_output" ["Blurred"]="magick $current_wallpaper -blur "20x30" $wallpaper_output" ["Solarize"]="magick $current_wallpaper -solarize 80% $wallpaper_output" -["Sepia-Tone"]="magick $current_wallpaper -sepia-tone 65% $wallpaper_output" +["Sepia Tone"]="magick $current_wallpaper -sepia-tone 65% $wallpaper_output" ["Negate"]="magick $current_wallpaper -negate $wallpaper_output" -["Charcoal"]="magick $current_wallpaper -charcoal "10x90" $wallpaper_output" +["Charcoal"]="magick $current_wallpaper -charcoal "10x10" $wallpaper_output" ["No Effects"]="no-effects" ) @@ -44,6 +44,9 @@ no_effects() { # Refresh rofi, waybar, wallust palettes "${SCRIPTSDIR}/Refresh.sh" notify-send -u low -i "$iDIR/bell.png" "No wallpaper effects" + + # copying wallpaper for rofi menu + cp $current_wallpaper $wallpaper_output } # Function to run rofi menu @@ -65,7 +68,7 @@ main() { no_effects else # Apply selected effect - notify-send -i "$iDIR/bell.png" "Applying $choice effects" + notify-send -u normal -i "$iDIR/bell.png" "Applying $choice effects" eval "${effects[$choice]}" # Wait for effects to be applied sleep 1 -- cgit v1.2.3