mabox-tools/bin/transparent-cava

46 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
#: Usage: transparent-cava (height in pixels) (width full or half)
#: example transparent-cava 100 full
#: default is 200px height and half width
CONFIG_DIR="$HOME/.config/terminator"
CONFIG_FILE="$CONFIG_DIR/cava-transparent"
if [ ! -f $CONFIG_FILE ]; then
cat <<EOF > ${CONFIG_FILE}
[global_config]
dbus = False
[keybindings]
[profiles]
[[default]]
allow_bold = False
background_darkness = 0.0
background_type = transparent
cursor_blink = False
cursor_color = "#aaaaaa"
font = Sans 2
show_titlebar = False
scrollbar_position = hidden
scroll_on_keystroke = False
use_custom_command = True
custom_command = cava
use_system_font = False
[layouts]
[plugins]
EOF
fi
CAVA_HEIGHT=${1:-200}
CAVA_WIDTH=${2:-half}
WIDTH=$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f1)
HEIGHT=$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f2)
TOP=$((HEIGHT-CAVA_HEIGHT))
LEFT=0
if [ "$CAVA_WIDTH" != "full" ];then
LEFT=$((WIDTH/4))
WIDTH=$((WIDTH/2))
else
:
fi
terminator -b -g "${CONFIG_FILE}" -T cavatransparent --geometry "${WIDTH}x${CAVA_HEIGHT}+${LEFT}+${TOP}" -i amarok_playcount