From bda03d2939383db1d3d6cefd10143590d56ce679 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 23 Feb 2025 21:47:16 +1100 Subject: scheme: optionally specify colour theme Allow specifying colour theme (light/dark) for dynamic scheme when changing wallpaper --- wallpaper.fish | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'wallpaper.fish') diff --git a/wallpaper.fish b/wallpaper.fish index 4eb8769..4efc1c7 100755 --- a/wallpaper.fish +++ b/wallpaper.fish @@ -15,6 +15,7 @@ argparse -n 'caelestia-wallpaper' -X 0 -x 'h,f,d' -x 'F,t' \ 'd/directory=' \ 'F/no-filter' \ 't/threshold=!_validate_int --min 0' \ + 'T/theme=!test $_flag_value = light -o $_flag_value = dark' \ -- $argv or exit @@ -24,16 +25,17 @@ if set -q _flag_h echo 'Usage:' echo ' caelestia wallpaper' echo ' caelestia wallpaper [ -h | --help ]' - echo ' caelestia wallpaper [ -f | --file ]' - echo ' caelestia wallpaper [ -d | --directory ] [ -F | --no-filter ]' - echo ' caelestia wallpaper [ -d | --directory ] [ -t | --threshold ]' + echo ' caelestia wallpaper [ -f | --file ] [ -T | --theme ]' + echo ' caelestia wallpaper [ -d | --directory ] [ -F | --no-filter ] [ -T | --theme ]' + echo ' caelestia wallpaper [ -d | --directory ] [ -t | --threshold ] [ -T | --theme ]' echo echo 'Options:' - echo ' -h, --help Print this help message and exit' - echo ' -f, --file The file to change wallpaper to' - echo ' -d, --directory The folder to select a random wallpaper from (default '$wallpapers_dir')' - echo ' -F, --no-filter Do not filter by size' - echo ' -t, --threshold The minimum percentage of the size the image must be greater than to be selected (default '$threshold')' + echo ' -h, --help Print this help message and exit' + echo ' -f, --file The file to change wallpaper to' + echo ' -d, --directory The folder to select a random wallpaper from (default '$wallpapers_dir')' + echo ' -F, --no-filter Do not filter by size' + echo ' -t, --threshold The minimum percentage of the size the image must be greater than to be selected (default '$threshold')' + echo ' -T, --theme <"light" | "dark"> Set light/dark theme for dynamic scheme' else set state_dir $C_STATE/wallpaper @@ -112,7 +114,8 @@ else # Generate colour scheme for wallpaper set -l src (dirname (status filename)) - $src/scheme/gen-scheme.fish $chosen_wallpaper > $src/data/schemes/dynamic.txt + set -q _flag_T && set -l theme --theme $_flag_T + $src/scheme/gen-scheme.fish $theme $chosen_wallpaper > $src/data/schemes/dynamic.txt if test -f $C_STATE/scheme/current.txt -a "$(cat $C_STATE/scheme/current-name.txt)" = 'dynamic' caelestia scheme dynamic end -- cgit v1.2.3-freya