forked from Shinonome/caelestia-cli
scheme: dynamic scheme
This commit is contained in:
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/bin/fish
|
||||
|
||||
function gen-hypr
|
||||
for colour in $argv
|
||||
set -l split (string split ' ' $colour)
|
||||
echo "\$$split[1] = $split[2]"
|
||||
end
|
||||
end
|
||||
|
||||
function gen-scss
|
||||
for colour in $argv
|
||||
set -l split (string split ' ' $colour)
|
||||
echo "\$$split[1]: #$split[2];"
|
||||
end
|
||||
end
|
||||
|
||||
function gen-foot
|
||||
cp (dirname (status filename))/../data/foot.template $CONFIG/../foot/schemes/dynamic.ini
|
||||
for colour in $argv
|
||||
set -l split (string split ' ' $colour)
|
||||
sed -i "s/\$$split[1]/$split[2]/g" $CONFIG/../foot/schemes/dynamic.ini
|
||||
end
|
||||
end
|
||||
|
||||
. (dirname (status filename))/../util.fish
|
||||
|
||||
set -l src (dirname (status filename))
|
||||
set -l colours ($src/gen-scheme.fish $argv[1])
|
||||
|
||||
if test -d $CONFIG/hypr/scheme
|
||||
log 'Generating hypr scheme'
|
||||
gen-hypr $colours > $CONFIG/hypr/scheme/dynamic.conf
|
||||
end
|
||||
|
||||
if test -d $CONFIG/shell/scss/scheme
|
||||
log 'Generating shell scheme'
|
||||
gen-scss $colours > $CONFIG/shell/scss/scheme/_dynamic.scss
|
||||
end
|
||||
|
||||
if test -d $CONFIG/safeeyes/scheme
|
||||
log 'Generating SafeEyes scheme'
|
||||
gen-scss $colours > $CONFIG/safeeyes/scheme/_dynamic.scss
|
||||
end
|
||||
|
||||
if test -d $CONFIG/../foot/schemes
|
||||
log 'Generating foot scheme'
|
||||
gen-foot $colours
|
||||
end
|
||||
|
||||
# Reload programs if dynamic scheme
|
||||
if test -f $CACHE/scheme/current.txt -a "$(cat $CACHE/scheme/current.txt)" = 'dynamic'
|
||||
caelestia scheme dynamic
|
||||
end
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/fish
|
||||
|
||||
function nl-echo
|
||||
# Echo with newlines
|
||||
for a in $argv
|
||||
echo $a
|
||||
end
|
||||
end
|
||||
|
||||
. (dirname (status filename))/../util.fish
|
||||
|
||||
set -l colour_names rosewater flamingo pink mauve red maroon peach yellow green teal sky sapphire blue lavender
|
||||
set -l layer_names text subtext1 subtext0 overlay2 overlay1 overlay0 surface2 surface1 surface0 base mantle crust
|
||||
|
||||
test -f "$argv[1]" && set -l img "$argv[1]" || set -l img $CACHE/wallpaper/current
|
||||
set -l colours_raw (okolors (realpath $img) -k 15 -w 0 -l 70,90,75,65,40,35,30,25,20,15,10,8,6)
|
||||
set -l colours (string split ' ' $colours_raw[2])[2..]
|
||||
set -l layers (nl-echo $colours_raw | cut -f 1 -d ' ')[3..]
|
||||
|
||||
for i in (seq 1 (count $colour_names))
|
||||
echo "$colour_names[$i] $colours[$i]"
|
||||
end
|
||||
|
||||
for i in (seq 1 (count $layer_names))
|
||||
echo "$layer_names[$i] $layers[$i]"
|
||||
end
|
||||
Reference in New Issue
Block a user