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() { mode() {
case "$1" in case "$1" in
solid) sd ".*gradient .*" "gradient = 0" ${CFGFILE};; solid) sd "^gradient .*" "gradient = 0" ${CFGFILE};;
gradient) sd ".*gradient .*" "gradient = 1" ${CFGFILE};; gradient) sd "^gradient .*" "gradient = 1" ${CFGFILE};;
esac esac
#reload_colors #reload_colors
reload_config reload_config
} }
foregroundcolor(){ foregroundcolor(){
sd ".*foreground .*" "foreground = '${1}'" ${CFGFILE} sd "^foreground .*" "foreground = '${1}'" ${CFGFILE}
} }
foreground() { foreground() {
sd ".*foreground .*" "foreground = '${1}'" ${CFGFILE} sd "^foreground .*" "foreground = '${1}'" ${CFGFILE}
sd ".*gradient .*" "gradient = 0" ${CFGFILE} sd "^gradient .*" "gradient = 0" ${CFGFILE}
reload_config reload_config
} }
gradientcolors() { gradientcolors() {
@@ -73,13 +73,8 @@ sd "^framerate .*" "framerate = ${1}" ${CFGFILE}
reload_config reload_config
} }
sensitivity () { noise_reduction () {
sd "^sensitivity .*" "sensitivity = ${1}" ${CFGFILE} sd "^noise_reduction .*" "noise_reduction = ${1}" ${CFGFILE}
reload_config
}
gravity () {
sd "^gravity .*" "gravity = ${1}" ${CFGFILE}
reload_config reload_config
} }
@@ -123,8 +118,7 @@ case "$1" in
bar_width)bar_width "$2";; bar_width)bar_width "$2";;
bar_spacing)bar_spacing "$2";; bar_spacing)bar_spacing "$2";;
framerate)framerate "$2";; framerate)framerate "$2";;
sensitivity)sensitivity "$2";; noise_reduction)noise_reduction "$2";;
gravity)gravity "$2";;
resetcfg)resetcfg;; resetcfg)resetcfg;;
info) info;; info) info;;
*):;; *):;;

View File

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