mabox-colorizer/bin/randomizer
2023-05-10 23:50:21 +02:00

118 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# randomizer
ob () {
obtctl randomizer
}
menu () {
mb-setvar jgmenu_theme=$(basename -s .colorrc $(ls ~/.config/mabox/jgobthemes/*.colorrc | shuf -n 1))
case "$1" in
show) colorizer-menus -s;;
*):;;
esac
}
conky () {
#set random saved colorscheme
COLORIZERDIR="$HOME/.config/colorizer"
CONKYTHEMEDIR="$COLORIZERDIR/conky/themes"
if [ ! -d "$CONKYTHEMEDIR" ];then
mkdir -p "$CONKYTHEMEDIR"
rsync -a /usr/share/mabox-colorizer/themes/conky/* ${CONKYTHEMEDIR}/
fi
RAND_FILENAME=$(ls ~/.config/colorizer/conky/themes/*.colors|shuf -n 1)
RAND_THEME=${RAND_FILENAME##*/}
#notify-send.sh "$RAND_THEME"
conkyctl settheme_all ${RAND_THEME}
}
wp () {
: # Może niepotrzebne tu
}
all () {
ob
conky
[[ "$1" == "show" ]] && menu show || menu
}
resetall () {
conkyctl resetcolorsall
obtctl resetMBcolors
[[ "$1" == "show" ]] && jgctl resetMBcolors show || jgctl resetMBcolors
}
pipemenu () {
me=""
[[ "$1" == "l" ]] && me="mb-jgtools places"
[[ "$1" == "c" ]] && me="colorizer -s"
#notify-send.sh "Me $me"
case "$LANG" in
pl*)
SETRANDOM="Ustaw losowy motyw dla..."
MENUS="Menu i Panele boczne"
OBWD="Dekoracja okien Openbox"
ALL="Wszystko"
ALLRESET="Resetuj wszystko"
RESET_TO_DEFAULT="Resetuj do ustawień domyślnych..."
HELP="Okno Główne i Pomoc"
;;
es*)
SETRANDOM="Set random colorscheme for..."
MENUS="Menus and Panels"
OBWD="OpenBox Window Decoration"
ALL="All above"
ALLRESET="Reset All above"
RESET_TO_DEFAULT="Reset to default settings..."
HELP="Main Window and Help"
;;
en*)
SETRANDOM="Set random colorscheme for..."
MENUS="Menus and Panels"
OBWD="OpenBox Window Decoration"
ALL="All above"
ALLRESET="Reset All above"
RESET_TO_DEFAULT="Reset to default settings..."
HELP="Main Window and Help"
;;
esac
out+=("^sep($SETRANDOM)")
out+=("$MENUS,randomizer menu;$me")
out+=("$OBWD,randomizer ob;$me")
out+=("Conky,randomizer conky;$me")
out+=("^sep()")
out+=("$ALL,randomizer all;$me")
out+=("^sep($RESET_TO_DEFAULT)")
out+=("$MENUS,jgctl resetMBcolors;$me")
out+=("$OBWD,obtctl resetMBcolors;$me")
out+=("Conky,conkyctl resetcolorsall;$me")
out+=("^sep()")
out+=("<big>󰁯</big> $ALLRESET,randomizer resetall;$me")
if [[ "$1" != "c" ]];then
out+=("^sep(Colorizer)")
out+=(" Colorizer - $HELP,ycolorizer")
out+=("Colorizer - Rootmenu,colorizer -s")
out+=("^sep(Colorizer modules)")
out+=("OpenBox,colorizer-ob -s")
out+=("Menus,colorizer-menus -s")
out+=("Conky,colorizer-conky -s")
out+=("^sep()")
out+=("Cava,colorizer-cava -s")
out+=("PyRadio,colorizer-pyradio -s")
fi
printf '%s\n' "${out[@]}"
}
case "$1" in
ob) ob;;
menu) menu "${2}";;
conky) conky;;
wp) wp;;
all) all "$2";;
resetall)resetall "$2";;
l|c|*) pipemenu "$1";;
esac