Cava module

This commit is contained in:
Daniel Napora 2023-05-09 14:14:23 +02:00
parent 19b950ea05
commit 876c236e88
12 changed files with 610 additions and 106 deletions

90
bin/cavactl Executable file
View File

@ -0,0 +1,90 @@
#!/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
}
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";;
*):;;
esac

View File

@ -64,6 +64,7 @@ case "$LANG" in
MODULES="Moduły"
OBTHEME="Motyw Openbox"
MENUPANELS="Menu i Panele"
CAVA="Cava - wizualizacja dźwięku"
TERMINALTHEME="Motyw terminala"
WALLCOLORS="Kolory z tapety"
ACCENTINFO="<i>ustaw kolor akcentu...</i>"
@ -158,6 +159,7 @@ case "$LANG" in
MODULES="Modules"
OBTHEME="Openbox Theme"
MENUPANELS="Menus/Panels"
CAVA="Cava - Audio Visualizer"
TERMINALTHEME="Terminal color scheme"
WALLCOLORS="Wallpaper Colors"
ACCENTINFO="<i>click to set accent color</i>"
@ -306,6 +308,12 @@ if pgrep -f pyradio >/dev/null ;then
out+=("PyRadio,^pipe(colorizer-pyradio)")
fi
if pgrep -f cava >/dev/null ;then
out+=("^sep()")
out+=("$CAVA,^pipe(colorizer-cava)")
fi
out+=("^sep($WALLCOLORS)")
out+=("北 $REGENERATE,^checkout(regen)")
out2+=("^tag(regen)")

221
bin/colorizer-cava Executable file
View File

@ -0,0 +1,221 @@
#!/bin/bash
#
# colorizer - set of tools for Mabox (auto)theming
# Copyright (C) 2022-2023 Daniel Napora <napcok@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
me="colorizer-cava -s"
CFGFILE=~/.config/cava/config
# get wallpaper color palette
WALLPALDIR="$HOME/.cache/colorizer/palettes"
mkdir -p "$WALLPALDIR"
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
NAME=${WALLPATH////_}
if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi
if [ ! -f "$WALLPALDIR/$NAME.clr" ]; then
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$NAME.clr"
fi
mapfile -t w < "$WALLPALDIR/$NAME.clr"
if [[ "${#w[@]}" -lt 8 ]]; then
w+=("#2e3440" "#4c566a" "#5e81ac" "#bf616b" "#b48ead" "#a3be8c" "#ebcb8b" "#d8dee9" "#eceff4")
fi
case "$LANG" in
pl*)
COLORIZE_CAVA="Pokoloruj Cava"
COLOR="Jednolity kolor"
REVERSE_GRADIENT="Odwróć kolory gradientu"
START_CAVA="Uruchom Cava"
GENERATEFROMWP="Generuj z kolorów tapety..."
LIGHTBG="Jasne do ciemnego"
DARKBG="Ciemne do jesnego"
BARS="Słupki"
BAR_WIDTH="Szerokość słupków"
BAR_SPACING="Odstęp między słupkami"
COLOR_MODE="Tryb kolorowania"
SOLID_COLOR="Jednolity kolor"
GRADIENT="Gradient"
MODGRAD_FROM="Gradient kolor 1"
MODGRAD_TO="Gradient kolor 2"
EDITCONF="Edytuj plik konfiguracyjny"
RELOAD="Przeładuj konfigurację"
RELOAD_COLORS="Przeładuj kolory"
;;
*)
COLORIZE_CAVA="Colorize Cava"
COLOR="Solid Color"
REVERSE_GRADIENT="Reverse gradient's colors"
START_CAVA="Start Cava"
GENERATEFROMWP="Generate from wallpaper colors..."
LIGHTBG="Light to Dark"
DARKBG="Dark to Light"
BARS="Bars"
BAR_WIDTH="Bar width"
BAR_SPACING="Bar spacing"
COLOR_MODE="Color mode"
SOLID_COLOR="Solid color"
GRADIENT="Gradient"
MODGRAD_FROM="Modify Gradient From"
MODGRAD_TO="Modify Gradient To"
EDITCONF="Edit config file"
RELOAD="Reload config"
RELOAD_COLORS="Reload colors only"
;;
esac
getvalues () {
read FG <<< "$(grep '.*foreground ' ${CFGFILE} | cut -d"'" -f2)"
read BW <<< "$(grep '.*bar_width ' ${CFGFILE} | cut -d"=" -f2)"
read BS <<< "$(grep '.*bar_spacing ' ${CFGFILE} | cut -d"=" -f2)"
read GR <<< "$(grep '.*gradient ' ${CFGFILE} | cut -d"=" -f2)"
read GR_FROM <<< "$(grep '.*gradient_color_1 ' ${CFGFILE} | cut -d"'" -f2)"
read GR_TO <<< "$(grep '.*gradient_color_8 ' ${CFGFILE} | cut -d"'" -f2)"
FGC=$(pastel textcolor ${FG}|pastel format hex)
}
getvalues
out+=("^sep($COLORIZE_CAVA)")
out+=("<tt><span bgcolor='$FG' fgcolor='$FGC'> ${FG} </span></tt> $COLOR,^pipe(mbclr '$FG' cavactl foreground Cava_Bar_Color '$me')")
out+=("^sep($GRADIENT)")
out+=("<span bgcolor='$GR_FROM'> </span><span bgcolor='$GR_TO'> </span> Gradient,^pipe(mbgrad cava)")
out+=("<span bgcolor='$GR_TO'> </span><span bgcolor='$GR_FROM'> </span> $REVERSE_GRADIENT,cavactl gradient '${GR_TO}' '${GR_FROM}';$me")
out+=("^sep()")
out+=("<tt><span bgcolor='$GR_FROM'> </span></tt> $MODGRAD_FROM,^pipe(mbclr '$GR_FROM' cavactl grad_from Cava_Grad_From_Color '$me')")
out+=("<tt><span bgcolor='$GR_TO'> </span></tt> $MODGRAD_TO,^pipe(mbclr '$GR_TO' cavactl grad_to Cava_Grad_To_Color '$me')")
out+=("^sep($COLOR_MODE)")
[[ "$GR" == "0" ]] && out+=("<big>綠</big> $SOLID_COLOR,cavactl mode solid;$me" "<big>󰝦</big> $GRADIENT,cavactl mode gradient;$me") || out+=("<big>󰝦</big> $SOLID_COLOR,cavactl mode solid;$me" "<big>綠</big> $GRADIENT,cavactl mode gradient;$me")
out+=("^sep($BARS)")
out+=("$BAR_WIDTH [ <b>$BW</b> ],^checkout(barwidth)")
out2+=("^tag(barwidth)")
out2+=("^sep($BAR_WIDTH)")
for i in 1 2 3 4 5 6 8 10
do
out2+=("$i,cavactl bar_width $i;$me")
done
out+=("$BAR_SPACING [ <b>$BS</b> ],^checkout(barspacing)")
out2+=("^tag(barspacing)")
out2+=("^sep($BAR_SPACING)")
for i in 0 1 2 3 4
do
out2+=("$i,cavactl bar_spacing $i;$me")
done
out+=("^sep()")
out+=(" $EDITCONF,xdg-open ~/.config/cava/config")
out+=("󰑓 $RELOAD,cavactl reload;$me")
out+=("󰑓 $RELOAD_COLORS,cavactl reload_colors;$me")
out+=("^sep(<i>$GENERATEFROMWP</i>)")
out+=("<span bgcolor='${w[-3]}'> </span><span bgcolor='${w[3]}'> </span> $LIGHTBG,w2theme cava light;$me")
out+=("<span bgcolor='${w[3]}'> </span><span bgcolor='${w[-3]}'> </span> $DARKBG,w2theme cava dark;$me")
### RUN
if [[ "$1" == "-s" ]]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
CNF_DIR="$HOME/.config/colorizer"
CNF_FILE="$CNF_DIR/colorizer.conf"
source "$CNF_FILE"
out+=("^sep()")
out+=(" ⮜⮜⮜ Colorizer,colorizer -s")
if [[ "$colorizer_size" == "full" ]];then
eval $(xdotool getdisplaygeometry --shell)
MENU_HEIGHT_MIN="$HEIGHT"
MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN
jgtools_radius=0
menu_margin_x="0"
else
MENU_VALIGN="center"
menu_margin_x=${submenu_spacing:-0}
fi
MENU_HALIGN="left"
jgmenu_icon_size=0
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
JGWIDTH=$((jgtools_padding + 270 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 158))
#WALLPAPER
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
THUMBDIR="$HOME/.cache/colorizer/thumbs"
mkdir -p ${THUMBDIR}
NAME=${WALLPATH////_}
if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi
THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]]
then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi
mkconfigfile
[[ "$GR" == "1" ]] && clr=${GR_FROM} || clr=${FG}
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding)),$((jgtools_padding)),270,150,4,left,top,,,${THUMB}
#@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,/usr/share/mabox-colorizer/img/colorizer-conky.png
@rect,,$((jgtools_padding)),$((jgtools_padding+100)),12,50,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+20)),$((jgtools_padding+115)),12,35,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+40)),$((jgtools_padding+124)),12,26,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+60)),$((jgtools_padding+114)),12,36,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+80)),$((jgtools_padding+100)),12,50,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+100)),$((jgtools_padding+96)),12,54,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+120)),$((jgtools_padding+74)),12,76,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+140)),$((jgtools_padding+64)),12,86,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+160)),$((jgtools_padding+76)),12,74,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+180)),$((jgtools_padding+94)),12,56,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+200)),$((jgtools_padding+114)),12,36,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+220)),$((jgtools_padding+129)),12,21,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+240)),$((jgtools_padding+119)),12,31,0,left,top,,${clr} 100,
@rect,,$((jgtools_padding+260)),$((jgtools_padding+110)),10,40,0,left,top,,${clr} 100,
@rect,,${jgtools_padding},$((jgtools_padding + 120)),270,28,0,left,top,#222222 20,#222222 70,
@text,,$((jgtools_padding + 108)),$((jgtools_padding + 120)),120,28,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'><b>Colorizer</b> Cava</span>
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"

View File

@ -224,7 +224,7 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then
out+=("^sep()")
out+=("$STARTALL (${#notstarted[@]}),conkyctl startall;$me")
fi
else # too many conkies - not started go to submenu
else # too many conkies not started -> show them in submenu
out+=("$CLICKTOSTART (${#notstarted[@]}),^checkout(nstarted)")
out2+=("^tag(nstarted)")
for c in ${notstarted[@]};do
@ -256,6 +256,27 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then
#GLOBAL START
out+=("^sep($GLOBALSETTINGS)")
if [ "$WINTRANS" == false ];then
out+=("<small><span bgcolor='$WINCLR'> </span><span weight='bold' ${BG} fgcolor='$WINCLR'> AbCd </span></small> $BACKGROUND,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor_all '${BACKGROUND}' '$me')")
else
out+=("<small><span bgcolor='$WINCLR'> transparent </span></small> $BACKGROUND,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor_all '${BACKGROUND}' '$me')")
fi
out+=("$TRANSPARENT [ <b>$WINTRANS</b> ],^checkout(trans)")
out+=("^sep()")
out+=("<small><span bgcolor='$CLR'> </span><span weight='bold' ${BG} fgcolor='$CLR'> AbCd </span></small> $DEFCOLOR,^pipe(mbclr '$CLR' conkyctl default_color_all '${DEFCOLOR}' '$me')")
out+=("<small><span bgcolor='$CLR0'> </span><span weight='bold' ${BG} fgcolor='$CLR0'> AbCd </span></small> $COLOR_0,^pipe(mbclr '$CLR0' conkyctl color0_all '${COLOR_0}' '$me')")
out+=("<small><span bgcolor='$CLR1'> </span><span weight='bold' ${BG} fgcolor='$CLR1'> AbCd </span></small> $COLOR_1,^pipe(mbclr '$CLR1' conkyctl color1_all '${COLOR_1}' '$me')")
out+=("<small><span bgcolor='$CLR2'> </span><span weight='bold' ${BG} fgcolor='$CLR2'> AbCd </span></small> $COLOR_2,^pipe(mbclr '$CLR2' conkyctl color2_all '${COLOR_2}' '$me')")
#out+=("^sep()")
out2+=("^tag(trans)")
out2+=("^sep($TRANSPARENT)")
out2+=("$YES,conkyctl transparent_all true;$me")
out2+=("$NO,conkyctl transparent_all false;$me")
out+=("^sep()")
out+=("<span bgcolor='#282828'> <span fgcolor='#ebdbb2'></span> <span fgcolor='#98971a'></span> <span fgcolor='#d79921'></span> <span fgcolor='#cc241d'></span> </span> $REGENERATE,^checkout(regenconky)")
out2+=("^tag(regenconky)")
out2+=("^sep($REGENERATE)")
@ -272,25 +293,9 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then
done
out2+=("^sep()")
out2+=(" $OPENTHEMEDIR,xdg-open ${COLORIZERDIR}/conky/themes/")
out+=("^sep()")
if [ "$WINTRANS" == false ];then
out+=("<small><span bgcolor='$WINCLR'> </span><span weight='bold' ${BG} fgcolor='$WINCLR'> AbCd </span></small> $BACKGROUND,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor_all '${BACKGROUND}' '$me')")
else
out+=("<small><span bgcolor='$WINCLR'> transparent </span></small> $BACKGROUND,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor_all '${BACKGROUND}' '$me')")
fi
out+=("$TRANSPARENT [ <b>$WINTRANS</b> ],^checkout(trans)")
out+=("^sep()")
out+=("<small><span bgcolor='$CLR'> </span><span weight='bold' ${BG} fgcolor='$CLR'> AbCd </span></small> $DEFCOLOR,^pipe(mbclr '$CLR' conkyctl default_color_all '${DEFCOLOR}' '$me')")
out+=("<small><span bgcolor='$CLR0'> </span><span weight='bold' ${BG} fgcolor='$CLR0'> AbCd </span></small> $COLOR_0,^pipe(mbclr '$CLR0' conkyctl color0_all '${COLOR_0}' '$me')")
out+=("<small><span bgcolor='$CLR1'> </span><span weight='bold' ${BG} fgcolor='$CLR1'> AbCd </span></small> $COLOR_1,^pipe(mbclr '$CLR1' conkyctl color1_all '${COLOR_1}' '$me')")
out+=("<small><span bgcolor='$CLR2'> </span><span weight='bold' ${BG} fgcolor='$CLR2'> AbCd </span></small> $COLOR_2,^pipe(mbclr '$CLR2' conkyctl color2_all '${COLOR_2}' '$me')")
#out+=("^sep()")
out2+=("^tag(trans)")
out2+=("^sep($TRANSPARENT)")
out2+=("$YES,conkyctl transparent_all true;$me")
out2+=("$NO,conkyctl transparent_all false;$me")
out+=("^sep()")
out+=("$FONTS [ <b>$FONT $FONTSIZE</b> ],^checkout(font)")
out2+=("^tag(font)")
out2+=("^sep($FONTS)")

View File

@ -107,7 +107,7 @@ case "$LANG" in
BOTTOM_LEFT="bottom_left"
BOTTOM_RIGHT="bottom_right"
PRE_GRADIENTS="Predefined gradients"
GRADIENT_REVERSE="Reverse Gradient"
GRADIENT_REVERSE="Reverse gradient colors"
ITEM="item"
COLOR_NORM_FG="Text Color"
COLOR_SEL_BG="Selected Item Background"
@ -161,6 +161,25 @@ getvalues
out+=("^sep($MENU_THEME: <i>${jgmenu_theme}</i>)")
out+=("Quick Menu tweaks,^checkout(tweaks)")
out2+=("^tag(tweaks)")
out2+=("^sep(Overall style)")
out2+=("Solid Color,jgctl tweak solid;$me")
out2+=("Gradient,jgctl tweak gradient;$me")
out2+=("^sep(Opacity)")
out2+=("100% Opaque,jgctl tweak opacity 100;$me")
out2+=("80%,jgctl tweak opacity 80;$me")
out2+=("60%,jgctl tweak opacity 60;$me")
out2+=("40%,jgctl tweak opacity 40;$me")
out2+=("30%,jgctl tweak opacity 30;$me")
out2+=("20%,jgctl tweak opacity 20;$me")
out2+=("10%,jgctl tweak opacity 10;$me")
out2+=("0% Fully transparent,jgctl tweak opacity 0;$me")
out2+=("^sep(MENU_PADDING)")
out2+=("wide,jgctl tweak padding wide;$me")
out2+=("normal,jgctl tweak padding normal;$me")
out2+=("tight,jgctl tweak padding tight;$me")
out+=("^sep($GENERATEFROMWP)")
out+=("$LIGHTBG,w2theme menu light;$me")
out+=("$DARKBG,w2theme menu dark;$me")
@ -169,32 +188,65 @@ out+=("<tt><small>$(printf '%3s' "$MBGA")</small> <span bgcolor='$MBG' bgalpha='
out+=("<tt><small>$(printf '%3s' "$MBGTA")</small> <span bgcolor='$MBGT' bgalpha='${MBGTA/#[0]/1}%'> </span><span bgcolor='$MBGT'> </span></tt> $COLOR_MENU_BG_TO,^pipe(mbclr '$MBGT' jgctl color_menu_bg_to '${COLOR_MENU_BG_TO}' '$me')")
out+=("<tt><small>$(printf '%3s' "$MBORDERA")</small> <span bgcolor='$MBORDER' bgalpha='${MBORDERA/#[0]/1}%'> </span><span bgcolor='$MBORDER'> </span></tt> $COLOR_MENU_BORDER,^pipe(mbclr '$MBORDER' jgctl color_menu_border '${COLOR_MENU_BORDER}' '$me')")
out+=("^sep()")
out+=("$GRADIENT_POS [ <b>$GRADIENT</b> ],^checkout(gradientpos)")
case "$GRADIENT" in
none)icon="";;
top)icon="";;
right)icon="";;
bottom)icon="";;
left)icon="";;
top_left)icon="";;
top_right)icon="";;
bottom_left)icon="";;
bottom_right)icon="";;
esac
out+=("$icon $GRADIENT_POS [ <b>$GRADIENT</b> ],^checkout(gradientpos)")
#for i in $(pastel gradient "$MBGT" "$MBG" -n 13|pastel format hex)
#do
#gradrev+=("<span bgcolor='$i'> </span>")
#done
#out+=("<tt>$(printf '%s' "${gradrev[@]}")</tt> 凌 $GRADIENT_REVERSE,jgctl gradient '${MBGT}' '${MBG}';$me")
out+=(" 凌 $GRADIENT_REVERSE,jgctl gradient '${MBGT}' '${MBG}';$me")
#for i in $(pastel gradient "$MBG" "$MBGT" -n 13|pastel format hex)
#do
#grad+=("<span bgcolor='$i'> </span>")
#done
#out+=("<tt>$(printf '%s' "${grad[@]}")</tt> $PRE_GRADIENTS,^pipe(mbgrad menu)")
out+=("<tt><span bgcolor='#16a084'> </span><span bgcolor='#43a480'> </span><span bgcolor='#5da97b'> </span><span bgcolor='#72ad77'> </span><span bgcolor='#84b171'> </span><span bgcolor='#95b66c'> </span><span bgcolor='#a5ba66'> </span><span bgcolor='#b5be61'> </span><span bgcolor='#c3c15a'> </span><span bgcolor='#d1c753'> </span><span bgcolor='#dfc94c'> </span><span bgcolor='#edce44'> </span><span bgcolor='#f4d03f'> </span></tt> $PRE_GRADIENTS,^pipe(mbgrad menu)")
out+=("凌 $GRADIENT_REVERSE,jgctl gradient '${MBGT}' '${MBG}';$me")
out+=("^sep($ITEM)")
out+=("<tt><small>$(printf '%3s' "$NFGA")</small> <span weight='bold' fgcolor='$NFG' fgalpha='${NFGA/#[0]/1}%'> AbCd </span></tt> $COLOR_NORM_FG,^pipe(mbclr '$NFG' jgctl color_norm_fg '${COLOR_NORM_FG}' '$me')")
out+=("$ITEM_BORDER [ <b>$IBORDER</b> ],^checkout(itemborder)")
out+=("$ITEM_RADIUS [ <b>$IRADIUS</b> ],^checkout(itemradius)")
out+=("<tt><small>$(printf '%3s' "$SBGA")</small> <span bgcolor='$SBG' bgalpha='${SBGA/#[0]/1}%'> </span><span bgcolor='$SBG'> </span></tt> $COLOR_SEL_BG,^pipe(mbclr '$SBG' jgctl color_sel_bg '${COLOR_SEL_BG}' '$me')")
out+=("<tt><small>$(printf '%3s' "$SFGA")</small> <span weight='bold' bgcolor='$SBG' bgalpha='${SBGA/#[0]/1}%' fgcolor='$SFG' fgalpha='${SFGA/#[0]/1}%'> AbCd </span></tt> $COLOR_SEL_FG,^pipe(mbclr '$SFG' jgctl color_sel_fg '${COLOR_SEL_FG}' '$me')")
out+=("<tt><small>$(printf '%3s' "$SBORDERA")</small> <span bgcolor='$SBORDER' bgalpha='${SBORDERA/#[0]/1}%'> </span><span bgcolor='$SBORDER'> </span></tt> $COLOR_SEL_BORDER,^pipe(mbclr '$SBORDER' jgctl color_sel_border '${COLOR_SEL_BORDER}' '$me')")
out+=("^sep()")
[[ ! -z "$NORMBG" ]] && out+=("<tt><small>$(printf '%3s' "$NORMBGA")</small> <span bgcolor='${NORMBG}' bgalpha='${NORMBGA/#[0]/1}%'> </span><span bgcolor='${NORMBG}'> </span></tt> $COLOR_NORM_BG,^pipe(mbclr '$NORMBG' jgctl color_norm_bg '${COLOR_NORM_BG}' '$me')")
[[ ! -z "$NORMBG" ]] && out+=("<tt><small>$(printf '%3s' "$NORMBGA")</small> <span bgcolor='${NORMBG}' bgalpha='${NORMBGA/#[0]/1}%'> </span><span bgcolor='${NORMBG}'> </span></tt> $COLOR_NORM_BG,^pipe(mbclr '$NORMBG' jgctl color_norm_bg '${COLOR_NORM_BG}' '$me')" "^sep()")
out+=("$ITEM_BORDER [ <b>$IBORDER</b> ],^checkout(itemborder)")
out+=("$ITEM_RADIUS [ <b>$IRADIUS</b> ],^checkout(itemradius)")
out+=("^sep($SEPARATOR_TITLE)")
out+=("<tt><small>$(printf '%3s' "$TBGA")</small> <span bgcolor='$TBG' bgalpha='${TBGA}%'> </span><span bgcolor='$TBG'> </span></tt> $COLOR_TITLE_BG,^pipe(mbclr '$TBG' jgctl color_title_bg '${COLOR_TITLE_BG}' '$me')")
out+=("<tt><small>$(printf '%3s' "$TFGA")</small> <span weight='bold' bgcolor='$TBG' bgalpha='${TBGA/#[0]/1}%' fgcolor='$TFG' fgalpha='${TFGA}%'> AbCd </span></tt> $COLOR_TITLE_FG,^pipe(mbclr '$TFG' jgctl color_title_fg '${COLOR_TITLE_FG}' '$me')")
out+=("<tt><small>$(printf '%3s' "$TBORDERA")</small> <span bgcolor='$TBORDER' bgalpha='${TBORDERA/#[0]/1}%'> </span><span bgcolor='$TBORDER'> </span></tt> $COLOR_TITLE_BORDER,^pipe(mbclr '$TBORDER' jgctl color_title_border '${COLOR_TITLE_BORDER}' '$me')")
out+=("^sep()")
out+=("$SEP_HALIGN [ <b>$SEPHALIGN</b> ],^checkout(sephalign)")
case "$SEPHALIGN" in
left) icon="";;
center) icon="";;
right) icon="";;
esac
out+=("$icon $SEP_HALIGN [ <b>$SEPHALIGN</b> ],^checkout(sephalign)")
out+=("^sep()")
out+=("<tt><small>$(printf '%3s' "$SEPFGA")</small> <span fgcolor='$SEPFG' fgalpha='${SEPFGA/#[0]/1}%'>------</span></tt> ${COLOR_SEP_FG},^pipe(mbclr '$SEPFG' jgctl color_sep_fg '${COLOR_SEP_FG}' '$me')")
out2+=("^tag(gradientpos)")
out2+=("^sep($GRADIENT_POS <small>$GRADIENT</small>)")
out2+=("$NONE,jgctl menu_gradient_pos none;$me")
out2+=("$NONE,jgctl menu_gradient_pos none;$me")
out2+=("^sep()")
out2+=(" $TOP,jgctl menu_gradient_pos top;$me")
out2+=(" $RIGHT,jgctl menu_gradient_pos right;$me")
@ -293,8 +345,11 @@ JGWIDTH=$((jgtools_padding + 278 + jgtools_padding))
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,${THUMB}
@rect,,$((jgtools_padding + 4)),$((jgtools_padding + 120)),270,34,0,left,top,#222222 20,#222222 70,
@text,,$((jgtools_padding + 158)),$((jgtools_padding + 124)),120,30,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'><b>Colorizer</b> Menus</span>
@rect,,$((jgtools_padding + 4)),$((jgtools_padding + 120)),270,30,0,left,top,#222222 20,#222222 70,
@text,,$((jgtools_padding + 158)),$((jgtools_padding + 120)),120,30,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'><b>Colorizer</b> Menus</span>
@rect,,$((jgtools_padding + 14)),$((jgtools_padding + 22)),35,80,2,left,top,${MBORDER} ${MBORDERA},${MBG} ${MBGA},
@rect,,$((jgtools_padding + 50)),$((jgtools_padding + 72)),35,60,2,left,top,${MBORDER} ${MBORDERA},${MBG} ${MBGA},
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# conkyctl - script to handle various Conky operations in Mabox
CONKYDIR="$HOME/.config/conky"
CONKYDIR="$HOME"/.config/conky
BASECONKY="$CONKYDIR/sysinfo_mbcolor.conkyrc"
SESSIONFILE="$CONKYDIR/conky-sessionfile"
COLORIZERDIR="$HOME/.config/colorizer"
@ -394,7 +394,7 @@ languages () {
SHADOW="Cień"
DRAW="Rysuj"
BORDERS="Obramowanie"
EDIT="Edytuj plik"
EDIT="Edytuj plik Conky"
RELOAD="Przeładuj"
KILL="Zabij"
LOGOSIZE="Rozmiar logo"
@ -454,7 +454,7 @@ languages () {
SHADOW="Shadow"
DRAW="Draw"
BORDERS="Borders"
EDIT="Edit file"
EDIT="Edit Conky file"
RELOAD="Reload"
KILL="Kill"
LOGOSIZE="Logo size"
@ -514,7 +514,7 @@ languages () {
SHADOW="Shadow"
DRAW="Draw"
BORDERS="Borders"
EDIT="Edit file"
EDIT="Edit Conky file"
RELOAD="Reload"
KILL="Kill"
LOGOSIZE="Logo size"
@ -598,18 +598,18 @@ if [[ "$OLD_SYNTAX" = "true" ]];then
#out+=("^sep($POSITION)")
out2+=("^tag(position)")
out2+=("^sep($POSITION)")
out2+=(" $MARKNEWPOS,conkyctl setpos ${1};$me")
out2+=("<big></big> $MARKNEWPOS,conkyctl setpos ${1};$me")
#out2+=("^sep()")
out2+=("^sep($ALIGNMENT)")
out2+=(" $TOPLEFT,conkyctl pos top_left ${1};$me")
out2+=(" $TOP,conkyctl pos top_middle ${1};$me")
out2+=(" $TOPRIGHT,conkyctl pos top_right ${1};$me")
out2+=(" $LEFT,conkyctl pos middle_left ${1};$me")
out2+=("<big></big> $TOPLEFT,conkyctl pos top_left ${1};$me")
out2+=("<big></big> $TOP,conkyctl pos top_middle ${1};$me")
out2+=("<big></big> $TOPRIGHT,conkyctl pos top_right ${1};$me")
out2+=("<big></big> $LEFT,conkyctl pos middle_left ${1};$me")
out2+=("$CENTER,conkyctl pos middle_middle ${1};$me")
out2+=(" $RIGHT,conkyctl pos middle_right ${1};$me")
out2+=(" $BOTTOMLEFT,conkyctl pos bottom_left ${1};$me")
out2+=(" $BOTTOM,conkyctl pos bottom_middle ${1};$me")
out2+=(" $BOTTOMRIGHT,conkyctl pos bottom_right ${1};$me")
out2+=("<big></big> $RIGHT,conkyctl pos middle_right ${1};$me")
out2+=("<big></big> $BOTTOMLEFT,conkyctl pos bottom_left ${1};$me")
out2+=("<big></big> $BOTTOM,conkyctl pos bottom_middle ${1};$me")
out2+=("<big></big> $BOTTOMRIGHT,conkyctl pos bottom_right ${1};$me")
#out2+=("$ALIGNMENT [ <b>$POS</b> ],^checkout(posi)")
@ -696,43 +696,7 @@ if [[ "$OLD_SYNTAX" = "true" ]];then
fi
out+=("^sep($COLORS)")
if [ "$WINTRANS" == false ];then
out+=("<span bgcolor='#282828'> <span fgcolor='#ebdbb2'></span> <span fgcolor='#98971a'></span> <span fgcolor='#d79921'></span> <span fgcolor='#cc241d'></span> </span> $COLORSCHEME,^checkout(regensingle)")
out2+=("^tag(regensingle)")
out2+=("^sep($COLORSCHEME)")
out2+=("$RESETCOLORS,conkyctl resetcolorsone ${1}")
out2+=("^sep($GENFROMWP)")
out2+=("$LIGHTBG,w2theme conkyone light ${1}")
out2+=("$DARKBG,w2theme conkyone dark ${1}")
out2+=("^sep($APPLY_THEME)")
out3+=("^tag(applytoall)")
out3+=("^sep($APPLY_TO_ALL)")
for i in "${COLORIZERDIR}"/conky/themes/*.colors
do
source "${i}"
themefilename=${i##*/}
themename=${themefilename%%.colors}
ltitle=${themename//-/ }
arr=( $ltitle )
schemetitle=${arr[@]^}
out2+=("<span bgcolor='$own_window_colour'> <span fgcolor='$default_color'></span> <span fgcolor='$color0'></span> <span fgcolor='$color1'></span> <span fgcolor='$color2'></span> </span> $schemetitle,conkyctl settheme $themefilename $1")
out3+=("<span bgcolor='$own_window_colour'> <span fgcolor='$default_color'></span> <span fgcolor='$color0'></span> <span fgcolor='$color1'></span> <span fgcolor='$color2'></span> </span> $schemetitle,conkyctl settheme_all $themefilename")
done
out2+=("^sep()")
out2+=(" $OPENTHEMEDIR,xdg-open ${COLORIZERDIR}/conky/themes/")
out2+=("^sep()")
out2+=("$APPLY_TO_ALL,^checkout(applytoall)")
if [[ "$1" =~ "sysinfo_" ]]; then
out2+=("^sep($NEWTHEME)")
out2+=("$SAVENEWTHEME,conkyctl newcolorscheme ${1}")
fi
out+=("^sep()")
fi
out+=("$TRANSPARENT [ <b>$WINTRANS</b> ],^checkout(transsingle)")
if [[ "$WINCLR" != "#" ]];then
@ -759,6 +723,41 @@ if [[ "$OLD_SYNTAX" = "true" ]];then
out2+=("$YES,conkyctl transparent true ${1};$me")
out2+=("$NO,conkyctl transparent false ${1};$me")
if [ "$WINTRANS" == false ];then
out+=("<span bgcolor='#282828'> <span fgcolor='#ebdbb2'></span> <span fgcolor='#98971a'></span> <span fgcolor='#d79921'></span> <span fgcolor='#cc241d'></span> </span> $COLORSCHEME,^checkout(regensingle)")
out2+=("^tag(regensingle)")
out2+=("^sep($COLORSCHEME)")
out2+=("$RESETCOLORS,conkyctl resetcolorsone ${1}")
out2+=("^sep($GENFROMWP)")
out2+=("$LIGHTBG,w2theme conkyone light ${1}")
out2+=("$DARKBG,w2theme conkyone dark ${1}")
out2+=("^sep($APPLY_THEME)")
out3+=("^tag(applytoall)")
out3+=("^sep($APPLY_TO_ALL)")
for i in "${COLORIZERDIR}"/conky/themes/*.colors
do
source "${i}"
themefilename=${i##*/}
themename=${themefilename%%.colors}
ltitle=${themename//-/ }
arr=( $ltitle )
schemetitle=${arr[@]^}
out2+=("<span bgcolor='$own_window_colour'> <span fgcolor='$default_color'></span> <span fgcolor='$color0'></span> <span fgcolor='$color1'></span> <span fgcolor='$color2'></span> </span> $schemetitle,conkyctl settheme $themefilename $1")
out3+=("<span bgcolor='$own_window_colour'> <span fgcolor='$default_color'></span> <span fgcolor='$color0'></span> <span fgcolor='$color1'></span> <span fgcolor='$color2'></span> </span> $schemetitle,conkyctl settheme_all $themefilename")
done
out2+=("^sep()")
out2+=(" $OPENTHEMEDIR,xdg-open ${COLORIZERDIR}/conky/themes/")
out2+=("^sep()")
out2+=("$APPLY_TO_ALL,^checkout(applytoall)")
if [[ "$1" =~ "sysinfo_" ]]; then
out2+=("^sep($NEWTHEME)")
out2+=("$SAVENEWTHEME,conkyctl newcolorscheme ${1}")
fi
out+=("^sep()")
fi
if [[ "$1" != *"logo_mbcolor"* ]]; then
if [[ "$1" != *"quoter_mbcolor"* ]]; then
out+=("$FONTS [ <b>$FONT $FONTSIZE</b> ],^checkout(fontsingle)")
@ -871,12 +870,12 @@ contextmenu () {
single "${CONKYCFG}" "s"
case "$LANG" in
pl*)EDIT_CUSTOMCOMMANDS=" Edytuj menu komend (lewy klik menu)";;
es*)EDIT_CUSTOMCOMMANDS=" Edit cmd menu (left clik menu)";;
*) EDIT_CUSTOMCOMMANDS=" Edit cmd menu (left clik menu)";;
pl*)EDIT_CUSTOMCOMMANDS=" Edytuj menu komend (lewy klik) dla ${name^}";;
es*)EDIT_CUSTOMCOMMANDS=" Edit cmd menu (left clik) for ${name^}";;
*) EDIT_CUSTOMCOMMANDS=" Edit cmd menu (left clik) for ${name^}";;
esac
out+=("^sep()")
out+=("<small>$EDIT_CUSTOMCOMMANDS</small>,touch ${CONKYDIR}/menuscripts/${name}.csv;sleep 1;xdg-open ${CONKYDIR}/menuscripts/${name}.csv")
out+=("<small>$EDIT_CUSTOMCOMMANDS</small>,conkyctl cmdmenu_edit ${name}")
out+=("^sep()")
out+=(" ⮜⮜⮜ Conky Manager (Colorizer),colorizer-conky -s")
@ -961,11 +960,22 @@ cmdmenu () {
if [ -f ${CONKYDIR}/menuscripts/${name}.csv ]; then
LINES=$(grep -Ev "^#|^$" ${CONKYDIR}/menuscripts/${name}.csv|wc -l)
#notify-send.sh "$LINES"
if [ ${LINES} != 0 ]; then
CUSTOMCOMMANDS=". ${CONKYDIR}/menuscripts/${name}.csv"
else
if [ ${LINES} == 0 ]; then
contextmenu
fi
if [ ${LINES} == 1 ]; then
# 1 line - execute command (one line menu make no sense)
while IFS=$'\r\n' read -r line
do
cmd=${line#*,}
label=${line%,*}
done <<< $(grep -v '^\s*$\|^#\|^\s*#' ${CONKYDIR}/menuscripts/${name}.csv)
#notify-send.sh "${label}" "${cmd[@]}"
${cmd[@]}
else
# more than 1 lines - show menu
CUSTOMCOMMANDS=". ${CONKYDIR}/menuscripts/${name}.csv"
fi
else
contextmenu
fi
@ -996,7 +1006,7 @@ cmdmenu () {
jgtools_padding=4
MENU_PADDING_TOP=${jgtools_padding:-0}
JGWIDTH=270
TABS="90"
TABS="300"
jgmenu_icon_size=0
mkconfigfile
@ -1035,6 +1045,7 @@ cmdmenu () {
#echo "menu_margin_x=3" >> ${CONFIG_FILE}
#echo "menu_margin_y=3" >> ${CONFIG_FILE}
#notify-send.sh "CFG" "$(cat $CONFIG_FILE)"
echo "tabs = 170" >>${CONFIG_FILE}
case "$LANG" in
pl*)
CUSTOM_COMMANDS_SEP="Własne polecenia"
@ -1055,6 +1066,26 @@ EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
cmdmenu_edit() {
if [[ -f "${CONKYDIR}/menuscripts/${1}.csv" ]];then
geany "${CONKYDIR}/menuscripts/${1}.csv"
else
cat <<EOF > "${CONKYDIR}/menuscripts/${1}.csv"
# Add your commands here
# Syntax is simple: Label,command
# examples:
#The Gimp,gimp
#Firefox,firefox --new-window https://maboxlinux.org
#Btop,terminator -T Btop -e btop
# If only one command is uncommented it will run, if more commands available menu will be shown
# to see how it works play with uncomenting examples above and clicking Conky
EOF
geany "${CONKYDIR}/menuscripts/${1}.csv"
fi
}
netdevice () {
CFGFILE="$HOME/.config/conky/Network_mbcolor.conkyrc"
@ -1287,6 +1318,7 @@ case "$1" in
restartone) restartone "$2";;
contextmenu) contextmenu;;
cmdmenu) cmdmenu;;
cmdmenu_edit) cmdmenu_edit "$2";;
makemoveableall) makemoveableall;;
saveposall) saveposall;;
resetcolorsall) resetcolorsall ;;

View File

@ -73,32 +73,50 @@ gradient () {
read MBGT MBGTA<<< "$(grep 'color_menu_bg_to ' ${THEMERC} | cut -d'=' -f2)"
sd "color_menu_bg .*$" "color_menu_bg = $1 $MBGA" ${THEMERC}
sd "color_menu_bg_to.*$" "color_menu_bg_to = $2 $MBGTA" ${THEMERC}
# Item
ITEM_FG=$(pastel textcolor ${2}|pastel format hex)
read NFG NFGA<<< "$(grep 'color_norm_fg' ${THEMERC} | cut -d'=' -f2)"
sd "color_norm_fg.*$" "color_norm_fg = $ITEM_FG $NFGA" ${THEMERC}
# Title
read TBG TBGA<<< "$(grep 'color_title_bg' ${THEMERC} | cut -d'=' -f2)"
sd "color_title_bg.*$" "color_title_bg = $1 $TBGA" ${THEMERC}
# calculate readable FG color
TITLE_FG=$(pastel textcolor ${1}|pastel format hex)
read TFG TFGA<<< "$(grep 'color_title_fg' ${THEMERC} | cut -d'=' -f2)"
if [[ "${TITLE_FG}" == *"ffffff"* ]];then
TITLE_FGCOLOR=$(pastel mix -f 0.6 '#ffffff' "${2}"|pastel format hex)
if [[ "${ITEM_FG}" == *"ffffff"* ]];then
ITEM_FGCOLOR="#c0c0c0"
else
TITLE_FGCOLOR=$(pastel mix -f 0.6 '#000000' "${2}"|pastel format hex)
ITEM_FGCOLOR="#222222"
fi
read NFG NFGA<<< "$(grep 'color_norm_fg' ${THEMERC} | cut -d'=' -f2)"
sd "color_norm_fg.*$" "color_norm_fg = $ITEM_FGCOLOR $NFGA" ${THEMERC}
read NBG NBGA<<< "$(grep 'color_norm_bg' ${THEMERC} | cut -d'=' -f2)"
sd "color_norm_bg.*$" "color_norm_bg = $2 $NBGA" ${THEMERC}
# Title (Separator with text)
read TBG TBGA<<< "$(grep 'color_title_bg' ${THEMERC} | cut -d'=' -f2)"
sd "color_title_bg.*$" "color_title_bg = $2 $TBGA" ${THEMERC}
# calculate readable FG color
TITLE_FG=$(pastel textcolor ${2}|pastel format hex)
read TFG TFGA<<< "$(grep 'color_title_fg' ${THEMERC} | cut -d'=' -f2)"
###TITLE_FGCOLOR=$(pastel complement ${2}|pastel format hex)
if [[ "${TITLE_FG}" == *"ffffff"* ]];then
TITLE_FGCOLOR=$(pastel mix -f 0.7 '#ffffff' "${2}"|pastel format hex)
else
TITLE_FGCOLOR=$(pastel mix -f 0.7 '#000000' "${2}"|pastel format hex)
fi
sd "color_title_fg.*$" "color_title_fg = ${TITLE_FGCOLOR} $TFGA" ${THEMERC}
###sd "color_title_fg.*$" "color_title_fg = ${1} $TFGA" ${THEMERC}
read TBORDER TBORDERA<<< "$(grep 'color_title_border' ${THEMERC} | cut -d'=' -f2)"
TITLE_BORDER=$(pastel darken 0.05 ${1}|pastel format hex)
sd "color_title_border.*$" "color_title_border = $TITLE_BORDER $TBORDERA" ${THEMERC}
# Active item
# Selected (Active) item
read SBG SBGA<<< "$(grep 'color_sel_bg' ${THEMERC} | cut -d'=' -f2)"
alpha=${SBGA:-100}
sd "color_sel_bg.*$" "color_sel_bg = $2 $alpha" ${THEMERC}
ACTIVE_FG=$(pastel textcolor ${2}|pastel format hex)
read SFG SFGA<<< "$(grep 'color_sel_fg' ${THEMERC} | cut -d'=' -f2)"
sd "color_sel_fg.*$" "color_sel_fg = $ACTIVE_FG $SFGA" ${THEMERC}
# Sep
read SBORDER SBORDERA<<< "$(grep 'color_sel_border' ${THEMERC} | cut -d'=' -f2)"
alpha=${SBORDERA:-100}
sd "color_sel_border.*$" "color_sel_border = $1 $alpha" ${THEMERC}
# Separator line
read SFG SFGA<<< "$(grep 'color_sep_fg' ${THEMERC} | cut -d'=' -f2)"
SEP_FG=$(pastel mix -f 0.5 "${1}" "${2}"|pastel format hex)
sd "color_sep_fg.*$" "color_sep_fg = $SEP_FG $SFGA" ${THEMERC}
@ -215,6 +233,53 @@ color_sel_border () {
sd "color_sel_border.*$" "color_sel_border = $SBORDER $1" ${THEMERC}
;;
esac
read IBOR<<< "$(grep 'item_border' ${THEMERC} | cut -d'=' -f2)"
[[ ${IBOR} == "0" ]] && item_border 1
}
tweak () {
case "$1" in
solid)
menu_gradient_pos none
tweak opacity 100
opacity color_norm_bg 0
opacity color_sep_fg 30
item_radius 0
item_border 0
;;
gradient)
menu_gradient_pos right
opacity color_norm_bg 10
opacity color_sep_fg 0
item_radius 3
item_border 0
;;
opacity)
opacity color_menu_bg "$2"
opacity color_menu_bg_to "$2"
;;
padding)
case "$2" in
tight)
mb-setvar jgtools_padding=0
;;
normal)
mb-setvar jgtools_padding=8
;;
wide)
mb-setvar jgtools_padding=20
;;
esac
;;
*):;;
esac
}
opacity () {
# jgctl opacity element value
read FUNC B COLOR OPACITY REST<<< "$(grep ${1} ${THEMERC})"
#echo "$FUNC $B $COLOR $OPACITY $REST"
sd "$1.*= $COLOR.*$" "$FUNC = $COLOR $2 $REST" ${THEMERC}
}
case "$1" in
theme) theme "$2";;
@ -237,5 +302,7 @@ case "$1" in
color_sel_bg) color_sel_bg "$2";;
color_sel_fg) color_sel_fg "$2";;
color_sel_border) color_sel_border "$2";;
tweak) tweak "$2" "$3";;
opacity) opacity "$2" "$3";;
*) : ;;
esac

View File

@ -16,6 +16,11 @@ case "$1" in
COMMAND="jgctl gradient"
me="colorizer-menus -s"
;;
cava)
CACHEFILE="$HOME"/.config/colorizer/grad_cava.csv
COMMAND="cavactl gradient"
me="colorizer-cava -s"
;;
*)
CACHEFILE="$HOME"/.config/colorizer/grad_root.csv
COMMAND="w2theme gradient"

View File

@ -419,7 +419,7 @@ fontslanttoggle (){
}
randomizer () {
# TODO: - maybe put all options to cnf file and let users cistomize oprions???
# TODO: - maybe put all options to cnf file and let users cistomize options???
### ensure we use MBColors at the moment
theme MBcolors
@ -482,8 +482,8 @@ randomizer () {
textjustify "${ALIGN}"
### FONT FAMILY
FAMILIES=(Ubuntu Sans Serif "Roboto Condensed" "GE Inspira")
rand=$((RANDOM%5))
FAMILIES=(Ubuntu Sans "Roboto Condensed" "GE Inspira")
rand=$((RANDOM%4))
FAMILY="${FAMILIES[$rand]}"
fontfamily "${FAMILY}"

View File

@ -153,6 +153,21 @@ pyradio_theme() {
;;
esac
}
cava () {
case "$1" in
light) #light bottom
cavactl gradientcolors "${w[-3]}" "${w[3]}"
cavactl foregroundcolor "${w[-3]}"
cavactl reload_colors
;;
*) #dark bottom
cavactl gradientcolors "${w[3]}" "${w[-3]}"
cavactl foregroundcolor "${w[3]}"
cavactl reload_colors
;;
esac
}
accent () {
#obtctl clractivebg ${1}
#colorTo=$(pastel darken 0.2 "${1}"|pastel format hex)
@ -389,6 +404,7 @@ case "$1" in
conky) conky_colors "$2";;
conkyone) conky_colorsone "$2" "$3";;
pyradio) pyradio_theme "$2";;
cava) cava "$2";;
accent) accent "$2";;
gradient) gradient "$2" "$3";;
colorize) colorize;;

View File

@ -49,11 +49,13 @@ kbd {
padding: 2px 4px;
white-space: nowrap;
}
nav button.w3-bar-item {padding:4px 12px !important;}
</style>
<body>
<div class="w3-sidebar w3-bar-block w3-dark-grey w3-card" style="width:160px">
<div class="w3-center w3-margin"><img src="./img/colorizer.png" class="link" title="Colorizer" onclick="openTab(event, 'Colorizer')"></div>
<nav>
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Colorizer')">Colorizer</button>
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Openbox')">Openbox Theme</button>
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Jgmenu')">Menu/Sidepanels</button>
@ -62,7 +64,8 @@ kbd {
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Tint2')">Tint2 Panel</button>
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Terminal')">Terminal theme</button>
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Save')">Save and Restore</button>
<div class="w3-center" style="margin: 30px 10px 0 10px;">
</nav>
<div class="w3-center" style="margin: 80px 10px 0 10px;">
<a class="w3-button w3-bar-item w3-tiny w3-tooltip w3-lime" style="margin-top:1px;" href="run://pcmanwp"><span class="w3-right w3-large"></span>Choose wallpaper<span class="w3-text w3-tag w3-medium w3-round" style="position:fixed;left:144px;bottom:178px">Choose wallpaper from image context menu</span></a>
<a class="w3-button w3-bar-item w3-tiny w3-tooltip w3-khaki" style="margin-top:4px;" href="run://colorizer -s"><span class="w3-right w3-large"></span>Colorizer Rootmenu<span class="w3-text w3-tag w3-medium w3-round" style="position:fixed;left:144px;bottom:148px">Colorizer Menu (advanced)</span></a>
<a class="w3-button w3-bar-item w3-tiny w3-tooltip w3-amber" style="margin-top:1px;" href="run://colorizer-ob -s"><span class="w3-right w3-large"></span>Openbox module<span class="w3-text w3-tag w3-medium w3-round" style="position:fixed;left:144px;bottom:118px">Openbox Window Decoration module</span></a>

View File

@ -49,13 +49,14 @@ kbd {
padding: 2px 4px;
white-space: nowrap;
}
nav button.w3-bar-item {padding:4px 12px !important;}
</style>
<body>
<div class="w3-sidebar w3-bar-block w3-dark-grey w3-card" style="width:160px">
<div class="w3-center w3-margin"><img src="./img/colorizer.png" class="link" title="Colorizer" onclick="openTab(event, 'Colorizer')"></div>
<nav>
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Colorizer')">Colorizer</button>
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Openbox')">Motyw Openbox</button>
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Jgmenu')">Menu/Panele Boczne</button>
@ -64,7 +65,8 @@ kbd {
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Tint2')">Panel Tint2</button>
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Terminal')">Kolory Terminala</button>
<button class="w3-bar-item w3-button w3-small tablink" onclick="openTab(event, 'Save')">Zapisywanie</button>
<div class="w3-center" style="margin: 30px 10px 0 10px;">
</nav>
<div class="w3-center" style="margin: 80px 10px 0 10px;">
<a class="w3-button w3-bar-item w3-tiny w3-tooltip w3-lime" style="margin-top:1px;" href="run://pcmanwp"><span class="w3-right w3-large"></span>Wybierz tapetę<span class="w3-text w3-tag w3-medium w3-round" style="position:fixed;left:144px;bottom:178px">Wybierz i ustaw tapetę za pomocą menu kontekstowego</span></a>
<a class="w3-button w3-bar-item w3-tiny w3-tooltip w3-khaki" style="margin-top:4px;" href="run://colorizer -s"><span class="w3-right w3-large"></span>Colorizer Menu<span class="w3-text w3-tag w3-medium w3-round" style="position:fixed;left:144px;bottom:148px">Colorizer Menu główne (zaawansowane)</span></a>
<a class="w3-button w3-bar-item w3-tiny w3-tooltip w3-amber" style="margin-top:1px;" href="run://colorizer-ob -s"><span class="w3-right w3-large"></span>Moduł Openbox<span class="w3-text w3-tag w3-medium w3-round" style="position:fixed;left:144px;bottom:118px">Konfiguracja Dekoracji Okien Openbox</span></a>