upload
This commit is contained in:
106
bin/cavactl
Executable file
106
bin/cavactl
Executable file
@@ -0,0 +1,106 @@
|
||||
#!/bin/bash
|
||||
|
||||
# cavactl - cava script for Mabox
|
||||
CFGFILE=~/.config/cava/config
|
||||
|
||||
reload_config() {
|
||||
pkill -USR1 cava
|
||||
}
|
||||
|
||||
reload_colors() {
|
||||
pkill -USR2 cava > /dev/null 2>&1
|
||||
}
|
||||
mode() {
|
||||
case "$1" in
|
||||
solid) sd ".*gradient .*" "gradient = 0" ${CFGFILE};;
|
||||
gradient) sd ".*gradient .*" "gradient = 1" ${CFGFILE};;
|
||||
esac
|
||||
reload_colors
|
||||
}
|
||||
|
||||
foregroundcolor(){
|
||||
sd ".*foreground .*" "foreground = '${1}'" ${CFGFILE}
|
||||
}
|
||||
|
||||
foreground() {
|
||||
sd ".*foreground .*" "foreground = '${1}'" ${CFGFILE}
|
||||
sd ".*gradient .*" "gradient = 0" ${CFGFILE}
|
||||
reload_colors
|
||||
}
|
||||
gradientcolors() {
|
||||
n=1
|
||||
for i in $(pastel gradient -n 8 ${1} ${2}|pastel format hex)
|
||||
do
|
||||
sd ".*gradient_color_${n}.*" "gradient_color_${n} = '${i}'" ${CFGFILE}
|
||||
((n++))
|
||||
done
|
||||
}
|
||||
gradient() {
|
||||
n=1
|
||||
for i in $(pastel gradient -n 8 ${1} ${2}|pastel format hex)
|
||||
do
|
||||
sd ".*gradient_color_${n}.*" "gradient_color_${n} = '${i}'" ${CFGFILE}
|
||||
((n++))
|
||||
done
|
||||
|
||||
sd ".*gradient .*" "gradient = 1" ${CFGFILE}
|
||||
sd ".*gradient_count .*" "gradient_count = 8" ${CFGFILE}
|
||||
reload_colors
|
||||
}
|
||||
grad_from() {
|
||||
read GR_TO <<< "$(grep '.*gradient_color_8 ' ${CFGFILE} | cut -d"'" -f2)"
|
||||
gradient "$1" "${GR_TO}"
|
||||
}
|
||||
grad_to() {
|
||||
read GR_FROM <<< "$(grep '.*gradient_color_1 ' ${CFGFILE} | cut -d"'" -f2)"
|
||||
gradient "${GR_FROM}" "$1"
|
||||
}
|
||||
|
||||
bar_width () {
|
||||
sd ".*bar_width .*" "bar_width = ${1}" ${CFGFILE}
|
||||
reload_config
|
||||
}
|
||||
|
||||
|
||||
bar_spacing() {
|
||||
sd ".*bar_spacing .*" "bar_spacing = ${1}" ${CFGFILE}
|
||||
reload_config
|
||||
}
|
||||
|
||||
info () {
|
||||
case "$LANG" in
|
||||
pl*)
|
||||
INFO_HEAD="Porady dla Cava"
|
||||
INFO_TXT="\nCava 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 \
|
||||
Użyj strzałek <b> </b>, aby zmienić szerokość słupków"
|
||||
;;
|
||||
*)
|
||||
INFO_HEAD="Cava tips & tricks"
|
||||
INFO_TXT="\nCava 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 \
|
||||
Use arrows <b> </b> to change bar width"
|
||||
;;
|
||||
esac
|
||||
notify-send.sh -i amarok_playcount -u critical "$INFO_HEAD" "$INFO_TXT"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
mode) mode "$2";;
|
||||
foregroundcolor) foregroundcolor "$2";;
|
||||
foreground) foreground "$2";;
|
||||
gradientcolors) gradientcolors "$2" "$3";;
|
||||
gradient) gradient "$2" "$3";;
|
||||
grad_from) grad_from "$2";;
|
||||
grad_to) grad_to "$2";;
|
||||
reload) reload_config;;
|
||||
reload_colors)reload_colors;;
|
||||
bar_width)bar_width "$2";;
|
||||
bar_spacing)bar_spacing "$2";;
|
||||
info) info;;
|
||||
*):;;
|
||||
esac
|
||||
Reference in New Issue
Block a user