Files
mabox-tools/bin/mb-volmenu
2026-02-23 11:20:45 +01:00

119 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# mb-volmenu
. ~/.config/mabox/mabox.conf
me="mb-volmenu ipc"
case $LANG in
pl*)
TITLE="Menu dźwięku"
VOLCONTROL="Kontrola Głośności"
MUSIC_PLAYERS="Odtwarzacze dżwięku"
MUSIC_MENU="Menu Muzyka"
PYRTERM="PyRadio <small>w terminalu</small>"
PYRQUAKE="PyRadio <small>pokaż-ukryj</small>"
VIS="Wizualizacja"
KILLCAVA="Zabij Cava"
COLORIZE="Pokoloruj..."
COL_CAVA="Pokoloruj Cava"
COL_PYRADIO="Pokoloruj PyRadio"
;;
es*)
TITLE="Audio Menu"
VOLCONTROL="Volume Control"
MUSIC_PLAYERS="Music Players"
MUSIC_MENU="Music Menu"
PYRTERM="PyRadio <small>in terminal</small>"
PYRQUAKE="PyRadio <small>show-hide</small>"
VIS="Visualization"
KILLCAVA="Zabij Cava"
COLORIZE="Colorize..."
COL_CAVA="Colorize Cava"
COL_PYRADIO="Colorize PyRadio"
;;
*)
TITLE="Audio Menu"
VOLCONTROL="Volume Control"
MUSIC_PLAYERS="Music Players"
MUSIC_MENU="Music Menu"
PYRTERM="PyRadio <small>in terminal</small>"
PYRQUAKE="PyRadio <small>show-hide</small>"
VIS="Visualization"
KILLCAVA="Kill Cava"
COLORIZE="Colorize..."
COL_CAVA="Colorize Cava"
COL_PYRADIO="Colorize PyRadio"
;;
esac
colorizer=0
out+=("^sep($TITLE)")
out+=("$VOLCONTROL [W-r],jumpapp -m pavucontrol")
out+=("^sep($MUSIC_PLAYERS)")
hash audacious 2>/dev/null && out+=("Audacious,jumpapp audacious")
hash qmmp 2>/dev/null && out+=("Qmmp,jumpapp -c Qmmp qmmp")
hash spotify 2>/dev/null && out+=("Spotify,jumpapp spotify")
hash strawberry 2>/dev/null && out+=("Strawberry,jumpapp strawberry")
out+=("$MUSIC_MENU [W-m],mb-music -s")
if pgrep -f "/usr/bin/python /usr/bin/pyradio" >/dev/null ;then
outC+=("$COL_PYRADIO,colorizer-pyradio -s")
colorizer=1
else
#out+=("$START_PYRADIO <span bgcolor='#333333' color='#d3d3d3'> <small>W + r</small> </span>,xdotool key super+r;$me")
out+=("^sep(Radio)")
out+=("$PYRTERM,terminator --icon=/usr/share/icons/pyradio.png --geometry=564x440-20-20 -x pyradio -lt")
out+=("$PYRQUAKE [W-r],quake-radio")
fi
out+=("^sep($VIS)")
if pgrep -f cavatransparent >/dev/null ;then
out+=("<big>󰺢</big> $KILLCAVA,cavactl stop")
colorizer=1
outC+=("$COL_CAVA,colorizer-cava -s")
else
out+=("<big>󰺢</big> Cava,cavactl start && ${me}")
fi
if [[ "${colorizer}" == "1" ]] ;then
out+=("^sep($COLORIZE)")
out+=("${outC[@]}")
fi
### RUN
if [[ "$1" == "-s" || "$1" == "ipc" ]]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
MENU_PADDING_TOP=${jgtools_padding:-0}
MENU_HALIGN="left"
JGWIDTH=270
TABS=200
if [[ "$1" == "ipc" ]]; then
POSITION_MODE="ipc"
else
POSITION_MODE="fixed"
fi
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
# DEBUG
#printf '%s\n' "${out[@]}"
#printf '%s\n' "${out2[@]}"