forked from Shinonome/caelestia-cli
wallpaper: auto light/dark mode switching
If using dynamic scheme, auto switch light/dark mode depending on wallpaper
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user