| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | terminal=foot |
| 7 | wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" |
| 8 | wallpaper_output="$HOME/.config/hypr/wallpaper_effects/.wallpaper_modified" |
| 9 | SCRIPTSDIR="$HOME/.config/hypr/scripts" |
| 10 | focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') |
| 11 | rofi_theme="$HOME/.config/rofi/config-wallpaper-effect.rasi" |
| 12 | |
| 13 | |
| 14 | iDIR="$HOME/.config/swaync/images" |
| 15 | iDIRi="$HOME/.config/swaync/icons" |
| 16 | |
| 17 | |
| 18 | FPS=60 |
| 19 | TYPE="wipe" |
| 20 | DURATION=2 |
| 21 | BEZIER=".43,1.19,1,.4" |
| 22 | SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION --transition-bezier $BEZIER" |
| 23 | |
| 24 | |
| 25 | declare -A effects=( |
| 26 | ["No Effects"]="no-effects" |
| 27 | ["Black & White"]="magick $wallpaper_current -colorspace gray -sigmoidal-contrast 10,40% $wallpaper_output" |
| 28 | ["Blurred"]="magick $wallpaper_current -blur 0x10 $wallpaper_output" |
| 29 | ["Charcoal"]="magick $wallpaper_current -charcoal 0x5 $wallpaper_output" |
| 30 | ["Edge Detect"]="magick $wallpaper_current -edge 1 $wallpaper_output" |
| 31 | ["Emboss"]="magick $wallpaper_current -emboss 0x5 $wallpaper_output" |
| 32 | ["Frame Raised"]="magick $wallpaper_current +raise 150 $wallpaper_output" |
| 33 | ["Frame Sunk"]="magick $wallpaper_current -raise 150 $wallpaper_output" |
| 34 | ["Negate"]="magick $wallpaper_current -negate $wallpaper_output" |
| 35 | ["Oil Paint"]="magick $wallpaper_current -paint 4 $wallpaper_output" |
| 36 | ["Posterize"]="magick $wallpaper_current -posterize 4 $wallpaper_output" |
| 37 | ["Polaroid"]="magick $wallpaper_current -polaroid 0 $wallpaper_output" |
| 38 | ["Sepia Tone"]="magick $wallpaper_current -sepia-tone 65% $wallpaper_output" |
| 39 | ["Solarize"]="magick $wallpaper_current -solarize 80% $wallpaper_output" |
| 40 | ["Sharpen"]="magick $wallpaper_current -sharpen 0x5 $wallpaper_output" |
| 41 | ["Vignette"]="magick $wallpaper_current -vignette 0x3 $wallpaper_output" |
| 42 | ["Vignette-black"]="magick $wallpaper_current -background black -vignette 0x3 $wallpaper_output" |
| 43 | ["Zoomed"]="magick $wallpaper_current -gravity Center -extent 1:1 $wallpaper_output" |
| 44 | ) |
| 45 | |
| 46 | |
| 47 | no-effects() { |
| 48 | swww img -o "$focused_monitor" "$wallpaper_current" $SWWW_PARAMS && |
| 49 | wait $! |
| 50 | wallust run "$wallpaper_current" -s && |
| 51 | wait $! |
| 52 | |
| 53 | sleep 2 |
| 54 | "$SCRIPTSDIR/Refresh.sh" |
| 55 | |
| 56 | notify-send -u low -i "$iDIR/ja.png" "No wallpaper" "effects applied" |
| 57 | |
| 58 | cp "$wallpaper_current" "$wallpaper_output" |
| 59 | } |
| 60 | |
| 61 | |
| 62 | main() { |
| 63 | |
| 64 | options=("No Effects") |
| 65 | for effect in "${!effects[@]}"; do |
| 66 | [[ "$effect" != "No Effects" ]] && options+=("$effect") |
| 67 | done |
| 68 | |
| 69 | choice=$(printf "%s\n" "${options[@]}" | LC_COLLATE=C sort | rofi -dmenu -i -config $rofi_theme) |
| 70 | |
| 71 | |
| 72 | if [[ -n "$choice" ]]; then |
| 73 | if [[ "$choice" == "No Effects" ]]; then |
| 74 | no-effects |
| 75 | elif [[ "${effects[$choice]+exists}" ]]; then |
| 76 | |
| 77 | notify-send -u normal -i "$iDIR/ja.png" "Applying:" "$choice effects" |
| 78 | eval "${effects[$choice]}" |
| 79 | |
| 80 | |
| 81 | for pid in swaybg mpvpaper; do |
| 82 | killall -SIGUSR1 "$pid" |
| 83 | done |
| 84 | |
| 85 | sleep 1 |
| 86 | swww img -o "$focused_monitor" "$wallpaper_output" $SWWW_PARAMS & |
| 87 | |
| 88 | sleep 2 |
| 89 | |
| 90 | wallust run "$wallpaper_output" -s & |
| 91 | sleep 1 |
| 92 | |
| 93 | "${SCRIPTSDIR}/Refresh.sh" |
| 94 | notify-send -u low -i "$iDIR/ja.png" "$choice" "effects applied" |
| 95 | else |
| 96 | echo "Effect '$choice' not recognized." |
| 97 | fi |
| 98 | fi |
| 99 | } |
| 100 | |
| 101 | |
| 102 | if pidof rofi > /dev/null; then |
| 103 | pkill rofi |
| 104 | fi |
| 105 | |
| 106 | main |
| 107 | |
| 108 | sleep 1 |
| 109 | |
| 110 | if [[ -n "$choice" ]]; then |
| 111 | sddm_sequoia="/usr/share/sddm/themes/sequoia_2" |
| 112 | if [ -d "$sddm_sequoia" ]; then |
| 113 | |
| 114 | |
| 115 | if pidof yad > /dev/null; then |
| 116 | killall yad |
| 117 | fi |
| 118 | |
| 119 | if yad --info --text="Set current wallpaper as SDDM background?\n\nNOTE: This only applies to SEQUOIA SDDM Theme" \ |
| 120 | --text-align=left \ |
| 121 | --title="SDDM Background" \ |
| 122 | --timeout=5 \ |
| 123 | --timeout-indicator=right \ |
| 124 | --button="yad-yes:0" \ |
| 125 | --button="yad-no:1" \ |
| 126 | ; then |
| 127 | |
| 128 | |
| 129 | if ! command -v "$terminal" &>/dev/null; then |
| 130 | notify-send -i "$iDIR/ja.png" "Missing $terminal" "Install $terminal to enable setting of wallpaper background" |
| 131 | exit 1 |
| 132 | fi |
| 133 | |
| 134 | |
| 135 | $terminal -e bash -c "echo 'Enter your password to set wallpaper as SDDM Background'; \ |
| 136 | sudo cp -r $wallpaper_output '$sddm_sequoia/backgrounds/default' && \ |
| 137 | notify-send -i '$iDIR/ja.png' 'SDDM' 'Background SET'" |
| 138 | fi |
| 139 | fi |
| 140 | fi |