mb-volmenu: audio menu

This commit is contained in:
2026-02-23 11:20:45 +01:00
parent 36572c159b
commit 0e71711f29
2 changed files with 129 additions and 6 deletions

118
bin/mb-volmenu Executable file
View File

@@ -0,0 +1,118 @@
#!/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[@]}"

View File

@@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
#: Usage: transparent-cava (height in pixels) (width full or half) #: transparent-cava (height in pixels) (width full, half or third)
#: example transparent-cava 100 full
#: default is 200px height and half width
. ~/.config/mabox/mabox.conf
CONFIG_DIR="$HOME/.config/terminator" CONFIG_DIR="$HOME/.config/terminator"
CONFIG_FILE="$CONFIG_DIR/cava-transparent" CONFIG_FILE="$CONFIG_DIR/cava-transparent"
@@ -29,15 +30,19 @@ cat <<EOF > ${CONFIG_FILE}
EOF EOF
fi fi
CAVA_HEIGHT=${1:-200}
CAVA_WIDTH=${2:-half} CAVA_HEIGHT=${cava_height:-200}
CAVA_WIDTH=${cava_width:-half}
WIDTH=$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f1) WIDTH=$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f1)
HEIGHT=$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f2) HEIGHT=$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f2)
TOP=$((HEIGHT-CAVA_HEIGHT)) TOP=$((HEIGHT-CAVA_HEIGHT))
LEFT=0 LEFT=0
if [ "$CAVA_WIDTH" != "full" ];then if [ "$CAVA_WIDTH" == "half" ];then
LEFT=$((WIDTH/4)) LEFT=$((WIDTH/4))
WIDTH=$((WIDTH/2)) WIDTH=$((WIDTH/2))
elif [ "$CAVA_WIDTH" == "third" ];then
LEFT=$((WIDTH/3))
WIDTH=$((WIDTH/3))
else else
: :
fi fi