forked from Shinonome/caelestia-cli
scheme: light/dark mode
This commit is contained in:
@@ -31,15 +31,7 @@ if test "$argv[1]" = workspace-action
|
|||||||
end
|
end
|
||||||
|
|
||||||
if test "$argv[1]" = scheme
|
if test "$argv[1]" = scheme
|
||||||
set -l valid_schemes (path change-extension '' $src/data/schemes/* | sed 's!.*/!!')
|
$src/scheme/main.fish $argv[2..]
|
||||||
if contains -- "$argv[2]" $valid_schemes
|
|
||||||
mkdir -p $C_STATE/scheme
|
|
||||||
cp $src/data/schemes/$argv[2].txt $C_STATE/scheme/current.txt
|
|
||||||
echo -n $argv[2] > $C_STATE/scheme/current-name.txt
|
|
||||||
log "Changed scheme to $argv[2]"
|
|
||||||
else
|
|
||||||
error "Invalid scheme: $argv[2]"
|
|
||||||
end
|
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ else
|
|||||||
set colour_scheme dark
|
set colour_scheme dark
|
||||||
end
|
end
|
||||||
|
|
||||||
test "$(cat $C_STATE/scheme/current-name.txt)" = dynamic && gsettings set org.gnome.desktop.interface color-scheme \'prefer-$colour_scheme\'
|
echo -n $colour_scheme > $C_STATE/scheme/dynamic-mode.txt
|
||||||
|
|
||||||
# 2nd line except first element is the palette
|
# 2nd line except first element is the palette
|
||||||
# The first element in lines 3+ are the layers
|
# The first element in lines 3+ are the layers
|
||||||
|
|||||||
Executable
+30
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/fish
|
||||||
|
|
||||||
|
set -l src (dirname (status filename))/..
|
||||||
|
|
||||||
|
. $src/util.fish
|
||||||
|
|
||||||
|
set -l valid_schemes (path change-extension '' $src/data/schemes/* | sed 's!.*/!!')
|
||||||
|
set -l light_schemes latte
|
||||||
|
|
||||||
|
if contains -- "$argv[1]" $valid_schemes
|
||||||
|
mkdir -p $C_STATE/scheme
|
||||||
|
|
||||||
|
# Update scheme colours
|
||||||
|
cp $src/data/schemes/$argv[1].txt $C_STATE/scheme/current.txt
|
||||||
|
|
||||||
|
# Update scheme name
|
||||||
|
echo -n $argv[1] > $C_STATE/scheme/current-name.txt
|
||||||
|
|
||||||
|
# Update scheme mode
|
||||||
|
if test $argv[1] = dynamic
|
||||||
|
set colour_scheme (cat $C_STATE/scheme/dynamic-mode.txt)
|
||||||
|
else
|
||||||
|
contains -- "$argv[1]" $light_schemes && set colour_scheme light || set colour_scheme dark
|
||||||
|
end
|
||||||
|
echo -n $colour_scheme > $C_STATE/scheme/current-mode.txt
|
||||||
|
|
||||||
|
log "Changed scheme to $argv[1]"
|
||||||
|
else
|
||||||
|
error "Invalid scheme: $argv[1]"
|
||||||
|
end
|
||||||
+1
-1
@@ -114,7 +114,7 @@ else
|
|||||||
set -l src (dirname (status filename))
|
set -l src (dirname (status filename))
|
||||||
$src/scheme/gen-scheme.fish $chosen_wallpaper > $src/data/schemes/dynamic.txt
|
$src/scheme/gen-scheme.fish $chosen_wallpaper > $src/data/schemes/dynamic.txt
|
||||||
if test -f $C_STATE/scheme/current.txt -a "$(cat $C_STATE/scheme/current-name.txt)" = 'dynamic'
|
if test -f $C_STATE/scheme/current.txt -a "$(cat $C_STATE/scheme/current-name.txt)" = 'dynamic'
|
||||||
cp $src/data/schemes/dynamic.txt $C_STATE/scheme/current.txt
|
caelestia scheme dynamic
|
||||||
end
|
end
|
||||||
|
|
||||||
# Store the wallpaper chosen
|
# Store the wallpaper chosen
|
||||||
|
|||||||
Reference in New Issue
Block a user