wallpaper: auto light/dark mode switching

If using dynamic scheme, auto switch light/dark mode depending on wallpaper
This commit is contained in:
2 * r + 2 * t
2025-03-30 12:21:39 +11:00
parent 7fab95d5c9
commit 801d9602f1
+7
View File
@@ -122,7 +122,14 @@ else
if test -f $C_STATE/scheme/current-name.txt
set -l variant (string match -gr 'dynamic-(.*)' (cat $C_STATE/scheme/current-name.txt))
if test -n "$variant"
# Light/dark mode detection if not specified
if ! set -q _flag_T
set -l lightness (magick $state_dir/thumbnail.jpg -format '%[fx:int(mean*100)]' info:)
test $lightness -ge 60 && set _flag_T light || set _flag_T dark
end
# Wait for async scheme gen to finish
wait
# Apply scheme
caelestia scheme dynamic $variant $_flag_T > /dev/null
end
end