colorizer-cava update
This commit is contained in:
37
bin/cavactl
37
bin/cavactl
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# cavactl - cava script for Mabox
|
# cavactl - cava colorizer script for Mabox
|
||||||
CFGFILE=~/.config/cava/config
|
CFGFILE=~/.config/cava/config
|
||||||
|
|
||||||
reload_config() {
|
reload_config() {
|
||||||
@@ -15,7 +15,8 @@ mode() {
|
|||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
foregroundcolor(){
|
foregroundcolor(){
|
||||||
@@ -29,7 +30,7 @@ reload_colors
|
|||||||
}
|
}
|
||||||
gradientcolors() {
|
gradientcolors() {
|
||||||
n=1
|
n=1
|
||||||
for i in $(pastel gradient -n 8 ${1} ${2}|pastel format hex)
|
for i in $(pastel gradient -n 3 ${1} ${2}|pastel format hex)
|
||||||
do
|
do
|
||||||
sd ".*gradient_color_${n}.*" "gradient_color_${n} = '${i}'" ${CFGFILE}
|
sd ".*gradient_color_${n}.*" "gradient_color_${n} = '${i}'" ${CFGFILE}
|
||||||
((n++))
|
((n++))
|
||||||
@@ -37,18 +38,18 @@ for i in $(pastel gradient -n 8 ${1} ${2}|pastel format hex)
|
|||||||
}
|
}
|
||||||
gradient() {
|
gradient() {
|
||||||
n=1
|
n=1
|
||||||
for i in $(pastel gradient -n 8 ${1} ${2}|pastel format hex)
|
for i in $(pastel gradient -n 3 ${1} ${2}|pastel format hex)
|
||||||
do
|
do
|
||||||
sd ".*gradient_color_${n}.*" "gradient_color_${n} = '${i}'" ${CFGFILE}
|
sd ".*gradient_color_${n}.*" "gradient_color_${n} = '${i}'" ${CFGFILE}
|
||||||
((n++))
|
((n++))
|
||||||
done
|
done
|
||||||
|
|
||||||
sd ".*gradient .*" "gradient = 1" ${CFGFILE}
|
sd ".*gradient .*" "gradient = 1" ${CFGFILE}
|
||||||
sd ".*gradient_count .*" "gradient_count = 8" ${CFGFILE}
|
sd ".*gradient_count .*" "gradient_count = 3" ${CFGFILE}
|
||||||
reload_colors
|
reload_colors
|
||||||
}
|
}
|
||||||
grad_from() {
|
grad_from() {
|
||||||
read GR_TO <<< "$(grep '.*gradient_color_8 ' ${CFGFILE} | cut -d"'" -f2)"
|
read GR_TO <<< "$(grep '.*gradient_color_3 ' ${CFGFILE} | cut -d"'" -f2)"
|
||||||
gradient "$1" "${GR_TO}"
|
gradient "$1" "${GR_TO}"
|
||||||
}
|
}
|
||||||
grad_to() {
|
grad_to() {
|
||||||
@@ -67,6 +68,26 @@ sd ".*bar_spacing .*" "bar_spacing = ${1}" ${CFGFILE}
|
|||||||
reload_config
|
reload_config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
framerate () {
|
||||||
|
sd "^framerate .*" "framerate = ${1}" ${CFGFILE}
|
||||||
|
reload_config
|
||||||
|
}
|
||||||
|
|
||||||
|
sensitivity () {
|
||||||
|
sd "^sensitivity .*" "sensitivity = ${1}" ${CFGFILE}
|
||||||
|
reload_config
|
||||||
|
}
|
||||||
|
|
||||||
|
gravity () {
|
||||||
|
sd "^gravity .*" "gravity = ${1}" ${CFGFILE}
|
||||||
|
reload_config
|
||||||
|
}
|
||||||
|
|
||||||
|
resetcfg () {
|
||||||
|
cat /usr/share/mabox/common/cava/config > ${CFGFILE}
|
||||||
|
reload_config
|
||||||
|
}
|
||||||
|
|
||||||
info () {
|
info () {
|
||||||
case "$LANG" in
|
case "$LANG" in
|
||||||
pl*)
|
pl*)
|
||||||
@@ -101,6 +122,10 @@ case "$1" in
|
|||||||
reload_colors)reload_colors;;
|
reload_colors)reload_colors;;
|
||||||
bar_width)bar_width "$2";;
|
bar_width)bar_width "$2";;
|
||||||
bar_spacing)bar_spacing "$2";;
|
bar_spacing)bar_spacing "$2";;
|
||||||
|
framerate)framerate "$2";;
|
||||||
|
sensitivity)sensitivity "$2";;
|
||||||
|
gravity)gravity "$2";;
|
||||||
|
resetcfg)resetcfg;;
|
||||||
info) info;;
|
info) info;;
|
||||||
*):;;
|
*):;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -61,8 +61,14 @@ case "$LANG" in
|
|||||||
PREGRADIENT="Zastosuj gotowy gradient"
|
PREGRADIENT="Zastosuj gotowy gradient"
|
||||||
MODGRAD_FROM="Gradient kolor 1"
|
MODGRAD_FROM="Gradient kolor 1"
|
||||||
MODGRAD_TO="Gradient kolor 2"
|
MODGRAD_TO="Gradient kolor 2"
|
||||||
|
_GENERAL="Ogólne"
|
||||||
|
_FRAMERATE="Ramki (fps)"
|
||||||
|
_SENSITIVITY="Czułość"
|
||||||
|
_SENSDESC="wpływa na wysokość"
|
||||||
|
_GRAVITY="Grawitacja"
|
||||||
|
_RESETCFG="Resetuj konfigurację"
|
||||||
EDITCONF="Edytuj plik konfiguracyjny"
|
EDITCONF="Edytuj plik konfiguracyjny"
|
||||||
RELOAD="Przeładuj konfigurację"
|
RELOAD="Przeładuj konfigurację"
|
||||||
RELOAD_COLORS="Przeładuj kolory"
|
RELOAD_COLORS="Przeładuj kolory"
|
||||||
_COLORIZER_ROOT="<b>Colorizer</b> - menu główne"
|
_COLORIZER_ROOT="<b>Colorizer</b> - menu główne"
|
||||||
;;
|
;;
|
||||||
@@ -85,20 +91,30 @@ case "$LANG" in
|
|||||||
PREGRADIENT="Apply predefined gradient"
|
PREGRADIENT="Apply predefined gradient"
|
||||||
MODGRAD_FROM="Modify Gradient From"
|
MODGRAD_FROM="Modify Gradient From"
|
||||||
MODGRAD_TO="Modify Gradient To"
|
MODGRAD_TO="Modify Gradient To"
|
||||||
|
_GENERAL="General"
|
||||||
|
_FRAMERATE="Framerate"
|
||||||
|
_SENSITIVITY="Sensitivity"
|
||||||
|
_SENSDESC="affects bar height"
|
||||||
|
_GRAVITY="Gravity"
|
||||||
|
_RESETCFG="Reset config to default"
|
||||||
EDITCONF="Edit config file"
|
EDITCONF="Edit config file"
|
||||||
RELOAD="Reload config"
|
RELOAD="Reload config"
|
||||||
RELOAD_COLORS="Reload colors only"
|
RELOAD_COLORS="Reload colors only"
|
||||||
_COLORIZER_ROOT="<b>Colorizer</b> rootmenu"
|
_COLORIZER_ROOT="<b>Colorizer</b> rootmenu"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
getvalues () {
|
getvalues () {
|
||||||
|
read SENS <<< "$(grep '^sensitivity ' ${CFGFILE} | cut -d"=" -f2)"
|
||||||
|
read GRAV <<< "$(grep '^gravity ' ${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)"
|
||||||
read BW <<< "$(grep '.*bar_width ' ${CFGFILE} | cut -d"=" -f2)"
|
read BW <<< "$(grep '.*bar_width ' ${CFGFILE} | cut -d"=" -f2)"
|
||||||
read BS <<< "$(grep '.*bar_spacing ' ${CFGFILE} | cut -d"=" -f2)"
|
read BS <<< "$(grep '.*bar_spacing ' ${CFGFILE} | cut -d"=" -f2)"
|
||||||
read GR <<< "$(grep '.*gradient ' ${CFGFILE} | cut -d"=" -f2)"
|
read GR <<< "$(grep '.*gradient ' ${CFGFILE} | cut -d"=" -f2)"
|
||||||
read GR_FROM <<< "$(grep '.*gradient_color_1 ' ${CFGFILE} | cut -d"'" -f2)"
|
read GR_FROM <<< "$(grep '.*gradient_color_1 ' ${CFGFILE} | cut -d"'" -f2)"
|
||||||
read GR_TO <<< "$(grep '.*gradient_color_8 ' ${CFGFILE} | cut -d"'" -f2)"
|
read GR_TO <<< "$(grep '.*gradient_color_3 ' ${CFGFILE} | cut -d"'" -f2)"
|
||||||
|
|
||||||
|
|
||||||
if [ ${#FG} != 7 ];then
|
if [ ${#FG} != 7 ];then
|
||||||
@@ -128,7 +144,7 @@ FGT=$(pastel textcolor ${FGC}|pastel format hex)
|
|||||||
out+=("$BAR_WIDTH [ <b>$BW</b> ],^checkout(barwidth)")
|
out+=("$BAR_WIDTH [ <b>$BW</b> ],^checkout(barwidth)")
|
||||||
out2+=("^tag(barwidth)")
|
out2+=("^tag(barwidth)")
|
||||||
out2+=("^sep($BAR_WIDTH)")
|
out2+=("^sep($BAR_WIDTH)")
|
||||||
for i in 1 2 3 4 5 6 8 10
|
for i in 1 2 3 4 5 6 8 10 20
|
||||||
do
|
do
|
||||||
[[ "$BW" == "$i" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl bar_width $i;$me") || out2+=("<big>祿</big> $i,cavactl bar_width $i;$me")
|
[[ "$BW" == "$i" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl bar_width $i;$me") || out2+=("<big>祿</big> $i,cavactl bar_width $i;$me")
|
||||||
done
|
done
|
||||||
@@ -140,12 +156,43 @@ FGT=$(pastel textcolor ${FGC}|pastel format hex)
|
|||||||
do
|
do
|
||||||
[[ "$BS" == "$i" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl bar_spacing $i;$me") || out2+=("<big>祿</big> $i,cavactl bar_spacing $i;$me")
|
[[ "$BS" == "$i" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl bar_spacing $i;$me") || out2+=("<big>祿</big> $i,cavactl bar_spacing $i;$me")
|
||||||
done
|
done
|
||||||
|
out+=("^sep($_GENERAL)")
|
||||||
|
out+=("$_FRAMERATE [ <b>$FPS</b> ],^checkout(fps)")
|
||||||
|
out2+=("^tag(fps)")
|
||||||
|
out2+=("^sep($_FRAMERATE)")
|
||||||
|
for i in 144 120 60
|
||||||
|
do
|
||||||
|
[[ "$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)")
|
||||||
|
out2+=("^tag(sens)")
|
||||||
|
out2+=("^sep($_SENSITIVITY)")
|
||||||
|
out2+=("^sep(<small>$_SENSDESC</small>)")
|
||||||
|
for i in 100 50 25
|
||||||
|
do
|
||||||
|
[[ "$SENS" == "$i" ]] && out2+=("<big>綠</big> <b>$i</b>,cavactl sensitivity $i;$me") || out2+=("<big>祿</big> $i,cavactl sensitivity $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()")
|
out+=("^sep()")
|
||||||
out+=(" $EDITCONF,xdg-open ~/.config/cava/config")
|
out+=("<big></big> $EDITCONF,xdg-open ~/.config/cava/config")
|
||||||
out+=(" $RELOAD,cavactl reload;$me")
|
out+=("<big></big> $_RESETCFG,cavactl resetcfg;$me")
|
||||||
out+=(" $RELOAD_COLORS,cavactl reload_colors;$me")
|
|
||||||
|
#out+=("^sep()")
|
||||||
|
#out+=(" $RELOAD_COLORS,cavactl reload_colors;$me")
|
||||||
|
#out+=(" $RELOAD,cavactl reload;$me")
|
||||||
|
|
||||||
out+=("^sep()")
|
out+=("^sep()")
|
||||||
out+=(" $INFO,cavactl info")
|
out+=("<big></big> $INFO,cavactl info")
|
||||||
|
|
||||||
|
|
||||||
### RUN
|
### RUN
|
||||||
@@ -173,6 +220,7 @@ if [[ "$1" == "-s" ]]; then
|
|||||||
|
|
||||||
|
|
||||||
MENU_HALIGN="left"
|
MENU_HALIGN="left"
|
||||||
|
TABS=200
|
||||||
jgmenu_icon_size=0
|
jgmenu_icon_size=0
|
||||||
|
|
||||||
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
|
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
|
||||||
@@ -202,24 +250,11 @@ if [[ "$1" == "-s" ]]; then
|
|||||||
|
|
||||||
cat <<EOF > ${MENU_ITEMS}
|
cat <<EOF > ${MENU_ITEMS}
|
||||||
@icon,,$((jgtools_padding)),$((jgtools_padding)),270,150,4,left,top,,,${THUMB}
|
@icon,,$((jgtools_padding)),$((jgtools_padding)),270,150,4,left,top,,,${THUMB}
|
||||||
|
@icon,,$((jgtools_padding+2)),$((jgtools_padding+2)),266,146,4,left,top,,,/usr/share/mabox/img/colorizer-cava.png
|
||||||
|
|
||||||
#@rect,,$((jgtools_padding)),$((jgtools_padding+100)),12,50,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+20)),$((jgtools_padding+111)),12,35,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+40)),$((jgtools_padding+120)),12,26,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+60)),$((jgtools_padding+110)),12,36,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+80)),$((jgtools_padding+96)),12,50,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+100)),$((jgtools_padding+92)),12,54,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+120)),$((jgtools_padding+70)),12,76,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+140)),$((jgtools_padding+60)),12,86,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+160)),$((jgtools_padding+72)),12,74,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+180)),$((jgtools_padding+90)),12,56,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+200)),$((jgtools_padding+110)),12,36,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+220)),$((jgtools_padding+125)),12,21,0,left,top,,${clr} 100,
|
|
||||||
@rect,,$((jgtools_padding+240)),$((jgtools_padding+115)),12,31,0,left,top,,${clr} 100,
|
|
||||||
#@rect,,$((jgtools_padding+260)),$((jgtools_padding+106)),10,40,0,left,top,,${clr} 100,
|
|
||||||
|
|
||||||
@rect,,$((jgtools_padding+4)),$((jgtools_padding + 116)),262,28,0,left,top,#222222 20,#222222 70,
|
@rect,,$((jgtools_padding+4)),$((jgtools_padding + 118)),262,28,0,left,top,#222222 20,#222222 70,
|
||||||
@text,,$((jgtools_padding + 128)),$((jgtools_padding + 116)),120,28,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'><b>Cava</b> Colorizer</span>
|
@text,,$((jgtools_padding + 128)),$((jgtools_padding + 118)),120,28,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'><b>Cava</b> Colorizer</span>
|
||||||
|
|
||||||
|
|
||||||
$(printf '%s\n' "${out[@]}")
|
$(printf '%s\n' "${out[@]}")
|
||||||
|
|||||||
Reference in New Issue
Block a user