aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaKooLit <jimmielovejay.com>2024-07-11 01:25:15 +0900
committerJaKooLit <jimmielovejay.com>2024-07-11 01:25:15 +0900
commit50884ce82893d426f42d766e68a97bb419d9d869 (patch)
tree6d399e521bb14c1538884b89eb886d36f1bd9263
parent3836d2c008c7e0b2a6270ee5132c2a08d10bccc3 (diff)
updated wallpaper effects
-rwxr-xr-xconfig/hypr/UserScripts/WallpaperEffects.sh105
-rw-r--r--config/rofi/config-wallpaper-effect.rasi2
2 files changed, 51 insertions, 56 deletions
diff --git a/config/hypr/UserScripts/WallpaperEffects.sh b/config/hypr/UserScripts/WallpaperEffects.sh
index 84f8fd7b..cc6a5781 100755
--- a/config/hypr/UserScripts/WallpaperEffects.sh
+++ b/config/hypr/UserScripts/WallpaperEffects.sh
@@ -1,9 +1,9 @@
#!/bin/bash
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ #
-# Wallpaper Effects using imagemagick
+# Wallpaper Effects using ImageMagick
# Inspiration from ML4W - Stephan Raabe https://gitlab.com/stephan-raabe/dotfiles
-# variables
+# Variables
current_wallpaper="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current"
wallpaper_output="$HOME/.config/hypr/wallpaper_effects/.wallpaper_modified"
SCRIPTSDIR="$HOME/.config/hypr/scripts"
@@ -20,27 +20,26 @@ 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 & White"]="magick $current_wallpaper -colorspace gray -sigmoidal-contrast 10,40% $wallpaper_output"
-["Blurred"]="magick $current_wallpaper -blur 0x5 $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 0x5 $wallpaper_output"
-["Edge Detect"]="magick $current_wallpaper -edge 1 $wallpaper_output"
-["Emboss"]="magick $current_wallpaper -emboss 0x5 $wallpaper_output"
-["Sharpen"]="magick $current_wallpaper -sharpen 0x5 $wallpaper_output"
-["Oil Paint"]="magick $current_wallpaper -paint 4 $wallpaper_output"
-["Vignette"]="magick $current_wallpaper -vignette 0x5 $wallpaper_output"
-["Posterize"]="magick $current_wallpaper -posterize 4 $wallpaper_output"
-["Polaroid"]="magick $current_wallpaper -polaroid 0 $wallpaper_output"
-["No Effects"]="no-effects"
+ ["No Effects"]="no-effects"
+ ["Black & White"]="magick $current_wallpaper -colorspace gray -sigmoidal-contrast 10,40% $wallpaper_output"
+ ["Blurred"]="magick $current_wallpaper -blur 0x10 $wallpaper_output"
+ ["Charcoal"]="magick $current_wallpaper -charcoal 0x5 $wallpaper_output"
+ ["Edge Detect"]="magick $current_wallpaper -edge 1 $wallpaper_output"
+ ["Emboss"]="magick $current_wallpaper -emboss 0x5 $wallpaper_output"
+ ["Negate"]="magick $current_wallpaper -negate $wallpaper_output"
+ ["Oil Paint"]="magick $current_wallpaper -paint 4 $wallpaper_output"
+ ["Posterize"]="magick $current_wallpaper -posterize 4 $wallpaper_output"
+ ["Polaroid"]="magick $current_wallpaper -polaroid 0 $wallpaper_output"
+ ["Sepia Tone"]="magick $current_wallpaper -sepia-tone 65% $wallpaper_output"
+ ["Solarize"]="magick $current_wallpaper -solarize 80% $wallpaper_output"
+ ["Sharpen"]="magick $current_wallpaper -sharpen 0x5 $wallpaper_output"
+ ["Vignette"]="magick $current_wallpaper -vignette 0x5 $wallpaper_output"
+ ["Zoomed"]="magick $current_wallpaper -gravity Center -extent 1:1 $wallpaper_output"
)
# Function to apply no effects
-no_effects() {
+no-effects() {
swww img -o "$focused_monitor" "$current_wallpaper" $SWWW_PARAMS &
# Wait for swww command to complete
wait $!
@@ -51,56 +50,52 @@ 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
+ # copying wallpaper for rofi menu
+ cp "$current_wallpaper" "$wallpaper_output"
}
# Function to run rofi menu
main() {
# Populate rofi menu options
- options="No Effects"
+ options=("No Effects")
for effect in "${!effects[@]}"; do
- if [ "$effect" != "No Effects" ]; then
- options+="\n$effect"
- fi
+ [[ "$effect" != "No Effects" ]] && options+=("$effect")
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 -u normal -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
+ # Show rofi menu and handle user choice
+ choice=$(printf "%s\n" "${options[@]}" | LC_COLLATE=C sort | rofi -dmenu -p "Choose effect" -i -config ~/.config/rofi/config-wallpaper-effect.rasi)
+
+ # Process user choice
+ if [[ -n "$choice" ]]; then
+ if [[ "$choice" == "No Effects" ]]; then
+ no-effects
+ elif [[ "${effects[$choice]+exists}" ]]; then
+ # Apply selected effect
+ notify-send -u normal -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 $!
+ # Wait for other commands to finish
+ 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"
else
- echo "Effects not recognized."
+ echo "Effect '$choice' not recognized."
fi
fi
}
-# Check if rofi is already running
+# Check if rofi is already running and kill it
if pidof rofi > /dev/null; then
- pkill rofi
- exit 0
+ pkill rofi
+ exit 0
fi
main
diff --git a/config/rofi/config-wallpaper-effect.rasi b/config/rofi/config-wallpaper-effect.rasi
index bd5948c9..d9b27d6b 100644
--- a/config/rofi/config-wallpaper-effect.rasi
+++ b/config/rofi/config-wallpaper-effect.rasi
@@ -18,7 +18,7 @@ window {
listview {
fixed-columns: false;
colums: 2;
- lines: 7;
+ lines: 8;
}
/* ---- Inputbar ---- */
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage