Update Cli-visualizer tweaker : from yad to jgmenu.
Thanks @napcok for the amazing scripts to use as template, slowly learning from it.
The best place to learn jgmenu = mabox
Posting code for archive/view/inspiration/etc. In development.
colorizer-vis
(a fork of colorizer-cava
) : with uses of some scripts from vismanager yad version.
Update edit: 23-10-24
#!/bin/bash
# Adapted by @musqz for cli-visualizer. 2024
# Copyright (C) 2022-2023 Daniel Napora <napcok@gmail.com>
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
wmctrl -R vistransparent
me="colorizer-vis -s"
CONFIG_DIR="$HOME/.config/vis"
VIS_CNFG="$CONFIG_DIR/mb-vis-config"
CNFG_AMOUNT="$CONFIG_DIR/.amount"
COLORS_FILE="$CONFIG_DIR/colors/mb-vis-colors"
SCHEME_DIR="$CONFIG_DIR/colors"
source <(grep = "$VIS_CNFG")
source <(grep = "$CNFG_AMOUNT")
source <(grep = "$COLORS_FILE")
files=$(find "$SCHEME_DIR" -type f -name "*" -printf "%f\n" | sort)
for scheme in "$SCHEME_DIR"/*; do
if [[ -f "$scheme" ]]; then
# Source each file
source <(grep = "$scheme")
# notify-send -t 50 "scheme files sourced"
else
notify-send -t 50000 "Error creating source scheme's"
fi
done
case "$LANG" in
pl*)
INFO="Vis porady"
INFO_HEAD="Porady dla Vis"
INFO_TXT="\n1. Vis jest uruchomiona w przezroczystym oknie...\n \
Możesz je więc <b>przesuwać</b> lub <b>zmieniać rozmiar</b> tak jak każde inne okno\n \
<i>Przesuwanie</i>: przytrzymaj <b>Alt</b> i przeciągnij\n \
<i>Zmiana rozmiaru</i>: przytrzymaj <b>Alt</b> i przeciągnij prawym przyciskiem myszy\n\n \
2. Użyj strzałek <b> </b>, aby zmienić szerokość słupków"
START_VIS="Uruchom Vis"
STOP_VIS="Zakończ Vis"
_COLORIZER_ROOT="<b>Colorizer</b> - menu główne"
;;
*)
INFO="Vis tips & tricks"
INFO_HEAD="Vis tips & tricks"
INFO_TXT="\n1. Vis runs inside transparent window...\n \
So you can <b>move</b> or <b>resize</b> it like any other window\n \
<i>Move</i>: hold <b>Alt</b> and drag\n \
<i>Resize</i>: hold <b>Alt</b> and drag with right mouse button\n\n \
2. Use <b>Ctrl+wheel</b> bar size\n \
3. Use <b>S</b> toggle stereo / mono"
START_VIS="Start Vis"
STOP_VIS="Stop Vis"
EDITCONF="Edit config file"
_COLORIZER_ROOT="<b>Colorizer</b> rootmenu"
;;
esac
visualizer_spectrum_reversed=$(awk -F'=' '/visualizer\.spectrum\.reversed=/ {print $2}' "$VIS_CNFG")
colors_scheme=$(awk -F'=' '/colors\.scheme=/ {print $2}' "$VIS_CNFG" )
bar_width="$(awk -F'=' '/visualizer\.spectrum\.bar\.width=/ {print $2}' "$VIS_CNFG" )"
bar_spacing=$(awk -F'=' '/visualizer\.spectrum\.bar\.spacing=/ {print $2}' "$VIS_CNFG" )
smoothing_mode=$(awk -F'=' '/visualizer\.spectrum\.smoothing\.mode=/ {print $2}' "$VIS_CNFG" )
falloff_mode=$(awk -F'=' '/visualizer\.spectrum\.falloff\.mode=/ {print $2}' "$VIS_CNFG" )
falloff_weight=$(awk -F'=' '/visualizer\.spectrum\.falloff\.weight=/ {print $2}' "$VIS_CNFG" )
stereo_mode=$(awk -F'=' '/audio\.stereo\.enabled=/ {print $2}' "$VIS_CNFG" )
fps=$(awk -F'=' '/visualizer\.fps=/ {print $2}' "$VIS_CNFG" )
amount_colors=$(awk -F'=' '/amount_colors=/ {print $2}' "$HOME/.config/vis/.amount" )
visualizers=$(awk -F'=' '/visualizers=/ {print $2}' "$VIS_CNFG" )
selected_char_spectrum=$(awk -F'=' '/visualizer\.spectrum\.character=/ {print $2}' "$VIS_CNFG" )
selected_char_lorenz=$(awk -F'=' '/visualizer\.lorenz\.character=/ {print $2}' "$VIS_CNFG" )
selected_char_ellipse=$(awk -F'=' '/visualizer\.ellipse\.character=/ {print $2}' "$VIS_CNFG" )
pgrep -f vistransparent > /dev/null && out+=("<big></big> $STOP_VIS ,mb-music viskill;$me") || out+=("<big></big> $START_VIS ,mb-music visstart;$me")
out+=("^sep(Basic settings)")
out+=("Bar width [<b>${bar_width}</b>],^checkout(barwidth)")
out2+=("^tag(barwidth)")
for i in 1 2 3 4 5 6 8 10 ; do out2+=("$i,mb-setvar visualizer.spectrum.bar.width=$i $VIS_CNFG;mb-music visstart;$me") ;done
out+=("Bar spacing [<b>$bar_spacing</b>],^checkout(barspacing)")
out2+=("^tag(barspacing)")
for i in 0 1 2 3 4 5 6 8 10 ; do out2+=("$i,mb-setvar visualizer.spectrum.bar.spacing=$i $VIS_CNFG ; mb-music visstart;$me") ;done
out+=("Random colors [<b>$amount_colors</b>],^checkout(randomclr)")
out2+=("^tag(randomclr)")
out2+=("<span fgcolor='#131926' bgcolor='#A2C5CD' > <b>Repeat</b> </span> ,mb-setvar colors.scheme=mb-vis-colors $VIS_CNFG ; mb-setvar amount_colors=$amount_colors ~/.config/vis/.amount ; ~/bin/vis-random-colors.sh ; mb-music visstart;$me")
out2+=("^sep()")
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do out2+=("$i,mb-setvar colors.scheme=mb-vis-colors $VIS_CNFG ; mb-setvar amount_colors=$i ~/.config/vis/.amount ; ~/bin/vis-random-colors.sh ; mb-music visstart;$me") ;done
out2+=("^tag(gradient)")
out+=("Gradient [toggle], vis_toggle-gradient.sh; mb-music visstart;$me")
out+=("^sep()")
out+=("<span bgcolor='#44475a'> Save this colors </span>,rename-vis-colors.sh;mb-music visstart;$me")
out+=("^sep()")
out+=(" Colorscheme [<b>$colors_scheme</b>],^checkout(scheme)>")
out2+=("^tag(scheme)")
for i in ${files} ; do out2+=("$i,mb-setvar colors.scheme=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out+=("^sep()")
out+=("Falloff [<b>$falloff_mode</b>],^checkout(falloff)")
out2+=("^tag(falloff)")
for i in fill top none ; do out2+=("$i,mb-setvar visualizer.spectrum.falloff.mode=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out+=("Fallweight [<b>$falloff_weight</b>],^checkout(fallweight)")
out2+=("^tag(fallweight")
for i in 0.90 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 ; do out2+=("$i,mb-setvar visualizer.spectrum.falloff.weight=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out+=("Smooth [<b>$smoothing_mode</b>],^checkout(smooth)")
out2+=("^tag(smooth)")
for i in sgs monstercat none ; do out2+=("$i,mb-setvar visualizer.spectrum.smoothing.mode=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out+=("Fps [<b>$fps</b>],^checkout(fps)")
out2+=("^tag(fps)")
for i in 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ; do out2+=("$i,mb-setvar visualizer.fps=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out+=("Visuals [<b>$visualizers</b>],^checkout(visuals)")
out2+=("^tag(visuals)")
for i in spectrum lorenz ellipse ; do out2+=("$i,mb-setvar visualizers=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out+=("Character,^checkout(charspec)")
out2+=("^tag(charspec)")
out2+=("^sep(Spectrum [ <b>$selected_char_spectrum</b> ])")
for i in █ ▀ ⬜ ▓ ▒ ░ ▨ ; do out2+=("$i,mb-setvar visualizer.spectrum.character=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out1+=("^tag(charlrnz)")
out2+=("^sep(Lorenz [ <b>$selected_char_lorenz</b> ])")
for i in █ ▀ ⬜ ▓ ▒ ░ ▨ ; do out2+=("$i,mb-setvar visualizer.lorenz.character=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out1+=("^tag(charellps)")
out2+=("^sep(Ellipse [ <b>$selected_char_ellipse</b> ])")
for i in █ ▀ ⬜ ▓ ▒ ░ ▨ ; do out2+=("$i,mb-setvar visualizer.ellipse.character=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out+=("Reversed ,^checkout(reversed)")
out2+=("^tag(reversed)")
for i in false true ; do
case $i in
false) label1="no" ;;
true) label1="yes" ;;
esac
out2+=("$label1,mb-setvar visualizer.spectrum.reversed=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out+=("Stereo ,^checkout(stereo)")
out2+=("^tag(stereo)")
for i in false true ; do
case $i in
false) label="no" ;;
true) label="yes" ;;
esac
out2+=("$label,mb-setvar audio.stereo.enabled=$i $VIS_CNFG ;mb-music visstart;$me") ;done
out+=("^sep()")
out+=(" Scheme -create (gtk),vis-yad-colors.sh;mb-music visstart;$me")
out+=(" Scheme -edit,xdg-open $HOME/.config/vis/colors;$me")
out+=(" $EDITCONF,xdg-open $HOME/.config/vis/mb-vis-config")
out+=("^sep()")
out+=(" $INFO,notify-send.sh -i carla -u critical '$INFO_HEAD' '$INFO_TXT'")
### 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"
source "$CNF_FILE"
out+=("^sep()")
out+=(" ${arrow_string_left} $_COLORIZER_ROOT,colorizer -s")
if [[ "$colorizer_size" == "full" ]];then
eval $(xdotool getdisplaygeometry --shell)
MENU_HEIGHT_MIN="$HEIGHT"
MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN
jgtools_radius=0
menu_margin_x="0"
else
MENU_VALIGN="center"
menu_margin_x=${submenu_spacing:-0}
fi
MENU_HALIGN="left"
jgmenu_icon_size=0
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
JGWIDTH=$((jgtools_padding + 270 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 150))
#WALLPAPER
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
THUMBDIR="$HOME/.cache/colorizer/thumbs"
mkdir -p ${THUMBDIR}
NAME=${WALLPATH////_}
if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi
THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]]
then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi
mkconfigfile
# jumpers
clr2=#FF0000
# bars
clr=#82c2bf
clr3=#00ffff
clr4=#76eec6
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding)),$((jgtools_padding)),270,150,4,left,top,,,${THUMB}
@rect,,$((jgtools_padding)),$((jgtools_padding+80)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding)),$((jgtools_padding+100)),12,50,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+20)),$((jgtools_padding+75)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+20)),$((jgtools_padding+115)),12,35,0,left,top,,${clr3} 100,
@rect,,$((jgtools_padding+40)),$((jgtools_padding+90)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+40)),$((jgtools_padding+124)),12,26,0,left,top,,${clr4} 100,
@rect,,$((jgtools_padding+60)),$((jgtools_padding+85)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+60)),$((jgtools_padding+114)),12,36,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+80)),$((jgtools_padding+55)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+80)),$((jgtools_padding+100)),12,50,0,left,top,,${clr4} 100,
@rect,,$((jgtools_padding+100)),$((jgtools_padding+35)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+100)),$((jgtools_padding+96)),12,54,0,left,top,,${clr3} 100,
@rect,,$((jgtools_padding+120)),$((jgtools_padding+15)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+120)),$((jgtools_padding+74)),12,76,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+140)),$((jgtools_padding+35)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+140)),$((jgtools_padding+64)),12,86,0,left,top,,${clr3} 100,
@rect,,$((jgtools_padding+160)),$((jgtools_padding+23)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+160)),$((jgtools_padding+76)),12,74,0,left,top,,${clr4} 100,
@rect,,$((jgtools_padding+180)),$((jgtools_padding+75)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+180)),$((jgtools_padding+94)),12,56,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+200)),$((jgtools_padding+60)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+200)),$((jgtools_padding+114)),12,36,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+220)),$((jgtools_padding+99)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+220)),$((jgtools_padding+129)),12,21,0,left,top,,${clr4} 100,
@rect,,$((jgtools_padding+240)),$((jgtools_padding+66)),12,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+240)),$((jgtools_padding+119)),12,31,0,left,top,,${clr3} 100,
@rect,,$((jgtools_padding+260)),$((jgtools_padding+28)),10,10,0,left,top,,${clr2} 100,
@rect,,$((jgtools_padding+260)),$((jgtools_padding+110)),10,40,0,left,top,,${clr} 100,
@rect,,${jgtools_padding},$((jgtools_padding + 120)),270,28,0,left,top,#222222 20,#222222 70,
@text,,$((jgtools_padding + 4)),$((jgtools_padding + 120)),120,28,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'><b>Tweak</b> Cli-visualizer</span>
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out1[@]}")
$(printf '%s\n' "${out2[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
printf '%s\n' "${out1[@]}"
printf '%s\n' "${out2[@]}"