diff options
| -rwxr-xr-x | install/scripts.fish | 2 | ||||
| -rwxr-xr-x | scheme/gen-scheme.fish | 16 | ||||
| -rwxr-xr-x | scheme/score.py | 2 | ||||
| -rwxr-xr-x | wallpaper.fish | 10 |
4 files changed, 17 insertions, 13 deletions
diff --git a/install/scripts.fish b/install/scripts.fish index 8da6221..5041ff3 100755 --- a/install/scripts.fish +++ b/install/scripts.fish @@ -2,7 +2,7 @@ . (dirname (status filename))/util.fish -install-deps git hyprland-git hyprpaper-git imagemagick wl-clipboard fuzzel-git socat foot jq python xdg-user-dirs python-materialyoucolor-git app2unit-git +install-deps git hyprland-git hyprpaper-git imagemagick wl-clipboard fuzzel-git socat foot jq python xdg-user-dirs python-materialyoucolor-git app2unit-git parallel install-optional-deps 'equibop-bin (discord client)' 'btop (system monitor)' 'wf-recorder (screen recorder)' 'grim (screenshot tool)' 'zen-browser (web browser)' 'spotify-adblock (music player)' set -l dist $C_DATA/scripts diff --git a/scheme/gen-scheme.fish b/scheme/gen-scheme.fish index ab19c81..c034980 100755 --- a/scheme/gen-scheme.fish +++ b/scheme/gen-scheme.fish @@ -12,13 +12,19 @@ set -l hash (sha1sum $img | cut -d ' ' -f 1) # Cache schemes mkdir -p $C_CACHE/schemes -if ! test -d $C_CACHE/schemes/$hash - # Generate colours - set -l colours ($src/score.py $img) +set -l dirty_variants +if test -d $C_CACHE/schemes/$hash for variant in $variants - mkdir -p $C_CACHE/schemes/$hash/$variant - $src/autoadjust.py $theme $variant $colours | head -c -1 > $C_CACHE/schemes/$hash/$variant/$theme.txt + test -f $C_CACHE/schemes/$hash/$variant/$theme.txt || set -a dirty_variants $variant end +else + set dirty_variants $variants +end + +if test -n "$dirty_variants" + # Generate schemes for variants that need it + set -l colours ($src/score.py $img) + parallel "mkdir -p $C_CACHE/schemes/$hash/{} && $src/autoadjust.py $theme {} '$colours' | head -c -1 > $C_CACHE/schemes/$hash/{}/$theme.txt" ::: $dirty_variants end # Copy schemes from cache diff --git a/scheme/score.py b/scheme/score.py index 00a6d53..49464a2 100755 --- a/scheme/score.py +++ b/scheme/score.py @@ -22,7 +22,7 @@ class Score: @staticmethod def score(colors_to_population: dict) -> list[int]: desired = 14 - filter_enabled = True + filter_enabled = False dislike_filter = True colors_hct = [] diff --git a/wallpaper.fish b/wallpaper.fish index 1acb7ff..86fcb5c 100755 --- a/wallpaper.fish +++ b/wallpaper.fish @@ -107,13 +107,11 @@ else hyprctl hyprpaper unload unused > /dev/null # Thumbnail wallpaper for colour gen - set -l thumb_path $C_CACHE/thumbnails/(string replace -a '/' '-' (dirname $chosen_wallpaper | string sub -s 2))-(path change-extension '.jpg' (basename $chosen_wallpaper)) - if test -f $thumb_path - # Use thumbnail from shell - cp $thumb_path $state_dir/thumbnail.jpg - else - magick -define jpeg:size=256x256 $chosen_wallpaper -thumbnail 128x128 $state_dir/thumbnail.jpg + set -l thumb_path $C_CACHE/thumbnails/(sha1sum $chosen_wallpaper | cut -d ' ' -f 1).jpg + if ! test -f $thumb_path + magick -define jpeg:size=256x256 $chosen_wallpaper -thumbnail 128x128 $thumb_path end + cp $thumb_path $state_dir/thumbnail.jpg # Generate colour scheme for wallpaper set -l src (dirname (status filename)) |