cava colorizer

This commit is contained in:
2026-02-18 15:03:07 +01:00
parent a2fad850fb
commit 8e3c4e4383
2 changed files with 16 additions and 35 deletions

View File

@@ -12,20 +12,20 @@ pkill -USR2 cava > /dev/null 2>&1
}
mode() {
case "$1" in
solid) sd ".*gradient .*" "gradient = 0" ${CFGFILE};;
gradient) sd ".*gradient .*" "gradient = 1" ${CFGFILE};;
solid) sd "^gradient .*" "gradient = 0" ${CFGFILE};;
gradient) sd "^gradient .*" "gradient = 1" ${CFGFILE};;
esac
#reload_colors
reload_config
}
foregroundcolor(){
sd ".*foreground .*" "foreground = '${1}'" ${CFGFILE}
sd "^foreground .*" "foreground = '${1}'" ${CFGFILE}
}
foreground() {
sd ".*foreground .*" "foreground = '${1}'" ${CFGFILE}
sd ".*gradient .*" "gradient = 0" ${CFGFILE}
sd "^foreground .*" "foreground = '${1}'" ${CFGFILE}
sd "^gradient .*" "gradient = 0" ${CFGFILE}
reload_config
}
gradientcolors() {
@@ -73,13 +73,8 @@ sd "^framerate .*" "framerate = ${1}" ${CFGFILE}
reload_config
}
sensitivity () {
sd "^sensitivity .*" "sensitivity = ${1}" ${CFGFILE}
reload_config
}
gravity () {
sd "^gravity .*" "gravity = ${1}" ${CFGFILE}
noise_reduction () {
sd "^noise_reduction .*" "noise_reduction = ${1}" ${CFGFILE}
reload_config
}
@@ -123,8 +118,7 @@ case "$1" in
bar_width)bar_width "$2";;
bar_spacing)bar_spacing "$2";;
framerate)framerate "$2";;
sensitivity)sensitivity "$2";;
gravity)gravity "$2";;
noise_reduction)noise_reduction "$2";;
resetcfg)resetcfg;;
info) info;;
*):;;

View File

@@ -63,9 +63,7 @@ case "$LANG" in
MODGRAD_TO="Gradient kolor 2"
_GENERAL="Ogólne"
_FRAMERATE="Ramki (fps)"
_SENSITIVITY="Czułość"
_SENSDESC="wpływa na wysokość"
_GRAVITY="Grawitacja"
_NOISE_RED="Redukcja szumów"
_RESETCFG="Resetuj konfigurację"
EDITCONF="Edytuj plik konfiguracyjny"
RELOAD="Przeładuj konfigurację"
@@ -93,9 +91,7 @@ case "$LANG" in
MODGRAD_TO="Modify Gradient To"
_GENERAL="General"
_FRAMERATE="Framerate"
_SENSITIVITY="Sensitivity"
_SENSDESC="affects bar height"
_GRAVITY="Gravity"
_NOISE_RED="Noise reduction"
_RESETCFG="Reset config to default"
EDITCONF="Edit config file"
RELOAD="Reload config"
@@ -105,8 +101,7 @@ case "$LANG" in
esac
getvalues () {
read SENS <<< "$(grep '^sensitivity ' ${CFGFILE} | cut -d"=" -f2)"
read GRAV <<< "$(grep '^gravity ' ${CFGFILE} | cut -d"=" -f2)"
read NOISE_RED <<< "$(grep '^noise_reduction ' ${CFGFILE} | cut -d"=" -f2)"
read FPS <<< "$(grep '.*framerate ' ${CFGFILE} | cut -d"=" -f2)"
read FG <<< "$(grep '.*foreground ' ${CFGFILE} | cut -d"'" -f2)"
@@ -165,22 +160,14 @@ FGT=$(pastel textcolor ${FGC}|pastel format hex)
[[ "$FPS" == "$i" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl framerate $i;$me") || out2+=("<big>祿</big> $i,cavactl framerate $i;$me")
done
out+=("$_SENSITIVITY [ <b>$SENS</b> ],^checkout(sens)")
out+=("$_NOISE_RED [ <b>$NOISE_RED</b> ],^checkout(sens)")
out2+=("^tag(sens)")
out2+=("^sep($_SENSITIVITY)")
out2+=("^sep(<small>$_SENSDESC</small>)")
for i in 100 50 25
out2+=("^sep($_NOISE_RED)")
for i in 90 77 50 25
do
[[ "$SENS" == "$i" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl sensitivity $i;$me") || out2+=("<big>祿</big> $i,cavactl sensitivity $i;$me")
[[ "$NOISE_RED" == "$i" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl noise_reduction $i;$me") || out2+=("<big>祿</big> $i,cavactl noise_reduction $i;$me")
done
out+=("$_GRAVITY [ <b>$GRAV</b> ],^checkout(grav)")
out2+=("^tag(grav)")
out2+=("^sep($_GRAVITY)")
for i in 999 400 200 100 50
do
[[ "$GRAV" == "$i" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl gravity $i;$me") || out2+=("<big>祿</big> $i,cavactl gravity $i;$me")
done
out+=("^sep()")