Browse Source

Wallpaper-Effects (Super Shift W)

pull/323/head
JaKooLit 2 years ago
parent
commit
c2578231ed
  1. 1
      config/hypr/UserConfigs/ENVariables.conf
  2. 2
      config/hypr/UserConfigs/UserSettings.conf
  3. 96
      config/hypr/UserScripts/WallpaperEffects.sh
  4. 1
      config/hypr/configs/Keybinds.conf
  5. 12
      config/hypr/hyprlock.conf
  6. 4
      config/hypr/scripts/WallustSwww.sh
  7. BIN
      config/hypr/wallpaper_effects/.wallpaper_current
  8. BIN
      config/hypr/wallpaper_effects/.wallpaper_modified
  9. 27
      config/rofi/config-wallpaper-effect.rasi

1
config/hypr/UserConfigs/ENVariables.conf

@ -38,6 +38,7 @@ env = ELECTRON_OZONE_PLATFORM_HINT,auto
#env = NVD_BACKEND,direct
# FOR VM and POSSIBLY NVIDIA
#env = WLR_NO_HARDWARE_CURSORS,1
#env = WLR_RENDERER_ALLOW_SOFTWARE,1
# nvidia firefox (for hardware acceleration on FF)?

2
config/hypr/UserConfigs/UserSettings.conf

@ -150,4 +150,4 @@ xwayland {
# cursor section for Hyprland v0.41.0 or newer
#cursor {
# enable_hyprcursor = true
#}
#}

96
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

1
config/hypr/configs/Keybinds.conf

@ -34,6 +34,7 @@ bind = $mainMod SHIFT, N, exec, swaync-client -t -sw # swayNC panel
bind = $mainMod, E, exec, $UserScripts/QuickEdit.sh # Quick Edit Hyprland Settings
bind = $mainMod SHIFT, M, exec, $UserScripts/RofiBeats.sh # online music
bind = $mainMod, W, exec, $UserScripts/WallpaperSelect.sh # Select wallpaper to apply
bind = $mainMod SHIFT, W, exec, $UserScripts/WallpaperEffects.sh # Wallpaper Effects by imagemagickWW
bind = CTRL ALT, W, exec, $UserScripts/WallpaperRandom.sh # Random wallpapers
# Waybar / Bar related

12
config/hypr/hyprlock.conf

@ -12,13 +12,13 @@ general {
background {
monitor =
path = screenshot # screenshot of your desktop
# path = $HOME/.config/rofi/.current_wallpaper # NOTE only png supported for now
color = $color7
#path = screenshot # screenshot of your desktop
path = $HOME/.config/hypr/wallpaper_effects/.wallpaper_modified # NOTE only png supported for now
#color = $color7
# all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations
blur_size = 6
blur_passes = 2 # 0 disables blurring
blur_size = 5
blur_passes = 1 # 0 disables blurring
noise = 0.0117
contrast = 1.3000 # Vibrant!!!
brightness = 0.8000
@ -124,7 +124,7 @@ label {
# Put a picture of choice here. Default is the current wallpaper
image {
monitor =
path = $HOME/.config/rofi/.current_wallpaper
path = $HOME/.config/hypr/wallpaper_effects/.wallpaper_current
size = 230
rounding = -1
border_size = 2

4
config/hypr/scripts/WallustSwww.sh

@ -22,10 +22,12 @@ if [ -f "$cache_file" ]; then
# Get the wallpaper path from the cache file
wallpaper_path=$(cat "$cache_file")
echo $wallpaper_path
# Copy the wallpaper to the location Rofi can access
# symlink the wallpaper to the location Rofi can access
if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then
ln_success=true # Set the flag to true upon successful execution
fi
# copy the wallpaper for wallpaper effects
cp -r "$wallpaper_path" "$HOME/.config/hypr/wallpaper_effects/.wallpaper_current"
fi
# Check the flag before executing further commands

BIN
config/hypr/wallpaper_effects/.wallpaper_current

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 MiB

BIN
config/hypr/wallpaper_effects/.wallpaper_modified

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 MiB

27
config/rofi/config-wallpaper-effect.rasi

@ -0,0 +1,27 @@
/* ---- 💫 https://github.com/JaKooLit 💫 ---- */
/* Wallpaper Effects */
@import "~/.config/rofi/config-compact.rasi"
/* ---- Entry ---- */
entry {
width: 20%;
placeholder: "🏙 Choose desired wallpaper effect";
}
/* ---- Window ---- */
window {
width: 24%;
}
/* ---- Listview ---- */
listview {
fixed-columns: false;
colums: 1;
lines: 5;
}
/* ---- Inputbar ---- */
inputbar {
background-image: url("~/.config/hypr/wallpaper_effects/.wallpaper_modified", width);
}
Loading…
Cancel
Save