mabox-colorizer/bin/randomizer

110 lines
2.8 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 () {
LINES=$(tail -n +2 /usr/share/mabox-colorizer/colorschemes/conky.csv|wc -l)
N=$(( ( RANDOM % $LINES ) + 2 ))
#notify-send.sh "$LINES" "$N"
conkyctl applyscheme_all sys $N
}
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"
;;
*)
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