mabox-colorizer/bin/randomizer
2022-12-19 22:22:23 +01:00

105 lines
2.6 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
menu colorizer-menus
}
resetall () {
conkyctl resetcolorsall
obtctl resetMBcolors
jgctl resetMBcolors show
}
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"
RESET_TO_DEFAULT="Resetuj do ustawień domyślnych..."
HELP="Okno Główne i Pomoc"
;;
es*)
SETRANDOM="Set random colorscheme for..."
MENUS="Menus n Panels"
OBWD="OpenBox Window Decoration"
ALL="All"
RESET_TO_DEFAULT="Reset to default settings..."
HELP="Main Window and Help"
;;
en*)
SETRANDOM="Set random colorscheme for..."
MENUS="Menus n Panels"
OBWD="OpenBox Window Decoration"
ALL="All"
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+=("$ALL,randomizer resetall;$me")
out+=("^sep(Colorizer)")
out+=("Colorizer - $HELP,ycolorizer")
printf '%s\n' "${out[@]}"
}
case "$1" in
ob) ob;;
menu) menu "${2}";;
conky) conky;;
wp) wp;;
all) all;;
resetall)resetall;;
l|c|*) pipemenu "$1";;
esac