cava colorizer upd

This commit is contained in:
2026-02-23 11:32:11 +01:00
parent f9d85d90d6
commit 29ff0b2097
4 changed files with 48 additions and 16 deletions

View File

@@ -82,6 +82,21 @@ resetcfg () {
cat /usr/share/mabox/common/cava/config > ${CFGFILE}
reload_config
}
start () {
case "$1" in
full|half|third)
mb-setvar cava_width=${1}
;;
200|100|50)
mb-setvar cava_height=${1}
;;
esac
stop
transparent-cava &2>/dev/null
}
stop () {
pkill -f cavatransparent
}
info () {
case "$LANG" in
@@ -120,6 +135,8 @@ case "$1" in
framerate)framerate "$2";;
noise_reduction)noise_reduction "$2";;
resetcfg)resetcfg;;
start) start "$2";;
stop) stop;;
info) info;;
*):;;
esac

View File

@@ -1,7 +1,7 @@
#!/bin/bash
#
# colorizer - set of tools for Mabox (auto)theming
# Copyright (C) 2022-2026 Daniel Napora <napcok@gmail.com>
# Copyright (C) 2022-2026 Daniel Napora <danieln@maboxlinux.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $HOME/.config/mabox/mabox.conf
wmctrl -R cavatransparent
me="colorizer-cava -s"
@@ -49,6 +51,9 @@ case "$LANG" in
REVERSE_GRADIENT="Odwróć kolory gradientu"
START_CAVA="Uruchom Cava"
STOP_CAVA="Zakończ Cava"
CAVA_SIZE="Cava wymiary (okna)"
CWIDTH="Szerokość"
CHEIGHT="Wysokość (px)"
GENERATEFROMWP="Generuj z kolorów tapety..."
LIGHTBG="Jasne do ciemnego"
DARKBG="Ciemne do jesnego"
@@ -77,6 +82,9 @@ case "$LANG" in
REVERSE_GRADIENT="Reverse gradient's colors"
START_CAVA="Start Cava"
STOP_CAVA="Stop Cava"
CAVA_SIZE="Cava (window) size"
CWIDTH="Width"
CHEIGHT="Height (px)"
GENERATEFROMWP="Generate from wallpaper colors..."
LIGHTBG="Light to Dark"
DARKBG="Dark to Light"
@@ -121,8 +129,24 @@ FGT=$(pastel textcolor ${FGC}|pastel format hex)
}
getvalues
pgrep -f cavatransparent > /dev/null && out+=("<big>󰺢</big> $STOP_CAVA,mb-music cavakill;$me") || out+=("<big>󰺢</big> $START_CAVA,mb-music cavastart;$me")
out+=("^sep($COLOR_MODE)")
[[ "$GR" == "0" ]] && out+=("<big>綠</big> $SOLID_COLOR,cavactl mode solid;$me" "<big>󰝦</big> $GRADIENT,cavactl mode gradient;$me") || out+=("<big>󰝦</big> $SOLID_COLOR,cavactl mode solid;$me" "<big>綠</big> $GRADIENT,cavactl mode gradient;$me")
out+=("^sep()")
cwidth=${cava_width:-half}
cheight=${cava_height:-200}
out+=("$CAVA_SIZE,^checkout(size)")
out2+=("^tag(size)")
out2+=("^sep($CWIDTH)")
for i in full half third
do
[[ "${cava_width}" == "${i}" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl start $i;$me") || out2+=("<big>祿</big> $i,cavactl start $i;$me")
done
out2+=("^sep($CHEIGHT)")
for i in 200 100 50
do
[[ "${cava_height}" == "${i}" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl start $i;$me") || out2+=("<big>祿</big> $i,cavactl start $i;$me")
done
out+=("^sep($COLOR_MODE)")
[[ "$GR" == "0" ]] && out+=("<big>綠</big> $SOLID_COLOR,cavactl mode solid;$me" "<big>󰝦</big> $GRADIENT,cavactl mode gradient;$me") || out+=("<big>󰝦</big> $SOLID_COLOR,cavactl mode solid;$me" "<big>綠</big> $GRADIENT,cavactl mode gradient;$me")
out+=("^sep($COLORIZE_CAVA)")
out+=("<tt><span bgcolor='$FGC' fgcolor='$FGT'> ${FGC} </span></tt> $COLOR,^pipe(mbclr '$FGC' cavactl foreground Cava_Bar_Color '$me')")
out+=("^sep($GRADIENT)")
@@ -168,8 +192,7 @@ FGT=$(pastel textcolor ${FGC}|pastel format hex)
[[ "$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+=("^sep()")
out+=("<big></big> $EDITCONF,xdg-open ~/.config/cava/config")
out+=("<big>󰑓</big> $_RESETCFG,cavactl resetcfg;$me")
@@ -185,7 +208,7 @@ FGT=$(pastel textcolor ${FGC}|pastel format hex)
### RUN
if [[ "$1" == "-s" ]]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
CNF_DIR="$HOME/.config/colorizer"
CNF_FILE="$CNF_DIR/colorizer.conf"