diff --git a/.install/before_restore.sh b/.install/before_restore.sh new file mode 100644 index 0000000..492bcb3 --- /dev/null +++ b/.install/before_restore.sh @@ -0,0 +1,7 @@ +# ------------------------------------------------------ +# Modify existing files before restore starts +# ------------------------------------------------------ + +if [ -d ~/dotfiles ] ;then + echo ":: Modify existing files" +fi \ No newline at end of file diff --git a/.install/confirm-start.sh b/.install/confirm_start.sh similarity index 100% rename from .install/confirm-start.sh rename to .install/confirm_start.sh diff --git a/.install/hyprland-dotfiles.sh b/.install/hyprland_dotfiles.sh similarity index 100% rename from .install/hyprland-dotfiles.sh rename to .install/hyprland_dotfiles.sh diff --git a/.install/install-packages.sh b/.install/install_packages.sh similarity index 100% rename from .install/install-packages.sh rename to .install/install_packages.sh diff --git a/.install/qtile-dotfiles.sh b/.install/qtile_dotfiles.sh similarity index 100% rename from .install/qtile-dotfiles.sh rename to .install/qtile_dotfiles.sh diff --git a/.settings/wallpaper_cache b/.settings/wallpaper_cache new file mode 100644 index 0000000..e69de29 diff --git a/.version/name b/.version/name index 8ac3ac6..7031d2f 100644 --- a/.version/name +++ b/.version/name @@ -1 +1 @@ -2.9.1.2 \ No newline at end of file +2.9.1.3 \ No newline at end of file diff --git a/.version/version b/.version/version index c43cfd3..045e745 100644 --- a/.version/version +++ b/.version/version @@ -1 +1 @@ -2912 \ No newline at end of file +2913 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e68330..4888342 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ +Version 2.9.1.3 +https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.9.1.3 +-------------------------------------------------------- +- Wallpaper cache to cache generated images. Will speed up the change between wallpapers if cached files exists. https://gitlab.com/stephan-raabe/dotfiles/-/wikis/Home/Wallpapers#wallpaper-cache + + Version 2.9.1.2 -https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.9.1.1 +https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.9.1.2 -------------------------------------------------------- - Workspaces module in waybar updated to enable scroll to change the workspace https://gitlab.com/stephan-raabe/dotfiles/-/merge_requests/114 - More functions deactivated in Game Mode (SUPER+ALT+G) diff --git a/README.md b/README.md index 2f50c53..8fa40be 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ML4W Dotfiles 2.9.1.2 +# ML4W Dotfiles 2.9.1.3 BETA An advanced configuration of Hyprland for Arch Linux based distributions. This package includes an installation script to install and setup the required components. diff --git a/hypr/scripts/wallpaper.sh b/hypr/scripts/wallpaper.sh index 9226e9e..9040605 100755 --- a/hypr/scripts/wallpaper.sh +++ b/hypr/scripts/wallpaper.sh @@ -9,15 +9,39 @@ # by Stephan Raabe (2024) # ----------------------------------------------------- -# Cache file for holding the current wallpaper +# ----------------------------------------------------- +# Get wallpaper folder +# ----------------------------------------------------- wallpaper_folder="$HOME/wallpaper" if [ -f ~/dotfiles/.settings/wallpaper-folder.sh ] ;then source ~/dotfiles/.settings/wallpaper-folder.sh fi -used_wallpaper="$HOME/.cache/used_wallpaper" + +# ----------------------------------------------------- +# Check to use wallpaper cache +# ----------------------------------------------------- +use_cache=0 +if [ -f $HOME/dotfiles/.settings/wallpaper_cache ] ;then + use_cache=1 +fi + +if [ "$use_cache" == "1" ] ;then + echo ":: Using Wallpaper Cache" +else + echo ":: Wallpaper Cache disabled" +fi + +# ----------------------------------------------------- +# File and folder names +# ----------------------------------------------------- +force_generate=0 + +generated_versions="$HOME/.cache/ml4w-wallpaper-generated" cache_file="$HOME/.cache/current_wallpaper" -blurred="$HOME/.cache/blurred_wallpaper.png" -square="$HOME/.cache/square_wallpaper.png" +used_wallpaper="$HOME/.cache/used_wallpaper" +blurred_wallpaper="$HOME/.cache/blurred_wallpaper.png" +square_wallpaper="$HOME/.cache/square_wallpaper.png" + rasi_file="$HOME/.cache/current_wallpaper.rasi" blur_file="$HOME/dotfiles/.settings/blur.sh" @@ -36,10 +60,38 @@ if [ ! -f $rasi_file ] ;then echo "* { current-image: url(\"$wallpaper_folder/default.jpg\", height); }" > "$rasi_file" fi -current_wallpaper=$(cat "$cache_file") +# Create folder with generated versions of wallpaper if not exists +if [ ! -d $generated_versions ] ;then + mkdir $generated_versions +fi +# ----------------------------------------------------- +# Current wallpaper +# ----------------------------------------------------- +current_wallpaper=$(cat "$cache_file") +current_wallpaper_filename=$(echo $current_wallpaper | sed "s|$wallpaper_folder/||g") + +# ----------------------------------------------------- +# Select Wallpaper +# ----------------------------------------------------- case $1 in + # Remove current wallpaper cached files for regeneration + "regenerate") + sleep 1 + force_generate=1 + echo ":: Cached files for current wallpaper $current_wallpaper_filename will be regenerated" + notify-send "Cached files for current wallpaper $current_wallpaper_filename will be regenerated" + ;; + + # Empty the cache folder completely + "clearcache") + sleep 1 + rm $generated_versions/* + echo ":: Wallpaper cache cleared" + notify-send "Wallpaper cache cleared" + ;; + # Load wallpaper from .cache of last session "init") sleep 1 @@ -55,7 +107,11 @@ case $1 in sleep 0.2 selected=$( find "$wallpaper_folder" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -exec basename {} \; | sort -R | while read rfile do - echo -en "$rfile\x00icon\x1f$wallpaper_folder/${rfile}\n" + if [ -f $generated_versions/square-${rfile}.png ] ;then + echo -en "$rfile\x00icon\x1f$generated_versions/square-${rfile}.png\n" + else + echo -en "$rfile\x00icon\x1f$wallpaper_folder/${rfile}\n" + fi done | rofi -dmenu -i -replace -config ~/dotfiles/rofi/config-wallpaper.rasi) if [ ! "$selected" ]; then echo "No wallpaper selected" @@ -72,43 +128,72 @@ case $1 in esac # ----------------------------------------------------- -# Load current pywal color scheme +# Execute pywal # ----------------------------------------------------- + source "$HOME/.cache/wal/colors.sh" # ----------------------------------------------------- -# get wallpaper image name +# Selected Wallpaper # ----------------------------------------------------- + +echo ":: Setting up wallpaper with $wallpaper" + +# ----------------------------------------------------- +# Get selected wallpaper image name +# ----------------------------------------------------- + newwall=$(echo $wallpaper | sed "s|$wallpaper_folder/||g") +# ----------------------------------------------------- +# Copy selected wallpaper to .cache +# ----------------------------------------------------- + +echo ":: Copy $wallpaper to .cache" +cp $wallpaper $HOME/.cache/ +mv $HOME/.cache/$newwall $used_wallpaper + # ----------------------------------------------------- # Reload waybar with new colors # ----------------------------------------------------- ~/dotfiles/waybar/launch.sh # ----------------------------------------------------- -# Set the new wallpaper +# swww transition type # ----------------------------------------------------- transition_type="wipe" # transition_type="outer" # transition_type="random" -cp $wallpaper $HOME/.cache/ -mv $HOME/.cache/$newwall $used_wallpaper +# ----------------------------------------------------- +# Wallpaper Effects +# ----------------------------------------------------- -# Load Wallpaper Effect if [ -f $HOME/dotfiles/.settings/wallpaper-effect.sh ] ;then effect=$(cat $HOME/dotfiles/.settings/wallpaper-effect.sh) if [ ! "$effect" == "off" ] ;then - if [ "$1" == "init" ] ;then - echo ":: Init" + if [ -f $generated_versions/$effect-$newwall ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ] ;then + echo ":: Use cached wallpaper $effect_$newwall" else - dunstify "Using wallpaper effect $effect..." "with image $newwall" -h int:value:10 -h string:x-dunst-stack-tag:wallpaper + echo ":: Generate new cached wallpaper $effect-$newwall with effect $effect" + if [ "$1" == "init" ] ;then + echo ":: Init" + else + dunstify "Using wallpaper effect $effect..." "with image $newwall" -h int:value:10 -h string:x-dunst-stack-tag:wallpaper + fi + source $HOME/dotfiles/hypr/effects/wallpaper/$effect + cp $used_wallpaper $generated_versions/$effect-$newwall fi - source $HOME/dotfiles/hypr/effects/wallpaper/$effect + cp $generated_versions/$effect-$newwall $used_wallpaper + else + echo ":: Wallpaper effect is set to off" fi fi +# ----------------------------------------------------- +# Set new wallpaper with defined wallpaper engine +# ----------------------------------------------------- + wallpaper_engine=$(cat $HOME/dotfiles/.settings/wallpaper-engine.sh) if [ "$wallpaper_engine" == "swww" ] ;then # swww @@ -126,11 +211,12 @@ elif [ "$wallpaper_engine" == "hyprpaper" ] ;then wal_tpl=$(cat $HOME/dotfiles/.settings/hyprpaper.tpl) output=${wal_tpl//WALLPAPER/$used_wallpaper} echo "$output" > $HOME/dotfiles/hypr/hyprpaper.conf - hyprpaper & + hyprpaper & > /dev/null 2>&1 else echo ":: Wallpaper Engine disabled" fi +# Notify that the wallpaper will changed if [ "$1" == "init" ] ;then echo ":: Init" else @@ -146,38 +232,54 @@ fi # ----------------------------------------------------- # Created blurred wallpaper # ----------------------------------------------------- -if [ "$1" == "init" ] ;then - echo ":: Init" -else - dunstify "Creating blurred version ..." "with image $newwall" -h int:value:50 -h string:x-dunst-stack-tag:wallpaper -fi -magick $used_wallpaper -resize 75% $blurred -echo ":: Resized to 75%" -if [ ! "$blur" == "0x0" ] ;then - magick $blurred -blur $blur $blurred - echo ":: Blurred" +if [ -f $generated_versions/blur-$blur-$newwall.png ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ] ;then + echo ":: Use cached wallpaper blur-$blur-$newwall.png" +else + echo ":: Generate new cached wallpaper blur-$blur-$newwall with blur $blur" + if [ "$1" == "init" ] ;then + echo ":: Init" + else + dunstify "Creating blurred version ..." "with image $newwall" -h int:value:50 -h string:x-dunst-stack-tag:wallpaper + fi + magick $used_wallpaper -resize 75% $blurred_wallpaper + echo ":: Resized to 75%" + if [ ! "$blur" == "0x0" ] ;then + magick $blurred_wallpaper -blur $blur $blurred_wallpaper + cp $blurred_wallpaper $generated_versions/blur-$blur-$newwall.png + echo ":: Blurred" + fi + cp $generated_versions/blur-$blur-$newwall.png $blurred_wallpaper fi +cp $generated_versions/blur-$blur-$newwall.png $blurred_wallpaper # ----------------------------------------------------- -# Created quare wallpaper +# Created square wallpaper # ----------------------------------------------------- -if [ "$1" == "init" ] ;then - echo ":: Init" + +if [ -f $generated_versions/square-$newwall.png ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ] ;then + echo ":: Use cached wallpaper square-$newwall.png" else - dunstify "Creating square version ..." "with image $newwall" -h int:value:75 -h string:x-dunst-stack-tag:wallpaper + echo ":: Generate new cached wallpaper square-$newwall" + if [ "$1" == "init" ] ;then + echo ":: Init" + else + dunstify "Creating square version ..." "with image $newwall" -h int:value:75 -h string:x-dunst-stack-tag:wallpaper + fi + magick $wallpaper -gravity Center -extent 1:1 $square_wallpaper + cp $square_wallpaper $generated_versions/square-$newwall.png fi -magick $wallpaper -gravity Center -extent 1:1 $square -echo ":: Square version created" +cp $generated_versions/square-$newwall.png $square_wallpaper # ----------------------------------------------------- # Write selected wallpaper into .cache files # ----------------------------------------------------- + echo "$wallpaper" > "$cache_file" -echo "* { current-image: url(\"$blurred\", height); }" > "$rasi_file" +echo "* { current-image: url(\"$blurred_wallpaper\", height); }" > "$rasi_file" # ----------------------------------------------------- -# Send notification +# Send complete notification # ----------------------------------------------------- if [ "$1" == "init" ] ;then @@ -186,4 +288,4 @@ else dunstify "Wallpaper procedure complete!" "with image $newwall" -h int:value:100 -h string:x-dunst-stack-tag:wallpaper fi -echo "DONE!" +echo "DONE!" \ No newline at end of file diff --git a/install.sh b/install.sh index d5a3f79..6030173 100755 --- a/install.sh +++ b/install.sh @@ -34,7 +34,7 @@ else fi echo "" source .install/required.sh -source .install/confirm-start.sh +source .install/confirm_start.sh source .install/paralleldownloads.sh source .install/yay.sh source .install/updatesystem.sh @@ -44,37 +44,45 @@ source .install/installer.sh source .install/remove.sh source .install/general.sh source .install/packages/general-packages.sh -source .install/install-packages.sh +source .install/install_packages.sh source .install/profile.sh if [[ $profile == *"Hyprland"* ]]; then echo -e "${GREEN}" figlet "Hyprland" echo -e "${NONE}" source .install/packages/hyprland-packages.sh - source .install/install-packages.sh + source .install/install_packages.sh fi if [[ $profile == *"Qtile"* ]]; then echo -e "${GREEN}" figlet "Qtile" echo -e "${NONE}" source .install/packages/qtile-packages.sh - source .install/install-packages.sh + source .install/install_packages.sh fi source .install/wallpaper.sh source .install/displaymanager.sh source .install/issue.sh + +# Modify existing files before restore starts +source .install/before_restore.sh + +# Restore configuration and settings source .install/restore.sh + +# Setup the input devices source .install/keyboard.sh + source .install/neovim.sh source .install/hook.sh source .install/vm.sh source .install/copy.sh source .install/init-pywal.sh if [[ $profile == *"Hyprland"* ]]; then - source .install/hyprland-dotfiles.sh + source .install/hyprland_dotfiles.sh fi if [[ $profile == *"Qtile"* ]]; then - source .install/qtile-dotfiles.sh + source .install/qtile_dotfiles.sh fi source .install/settings.sh source .install/apps.sh diff --git a/waybar/launch.sh b/waybar/launch.sh index 2cf44ae..55dce19 100755 --- a/waybar/launch.sh +++ b/waybar/launch.sh @@ -38,7 +38,7 @@ else fi IFS=';' read -ra arrThemes <<< "$themestyle" -echo "Theme: ${arrThemes[0]}" +echo ":: Theme: ${arrThemes[0]}" if [ ! -f ~/dotfiles/waybar/themes${arrThemes[1]}/style.css ]; then themestyle="/ml4w;/ml4w/light"