polising conky module

This commit is contained in:
Daniel Napora 2023-09-08 12:34:28 +02:00
parent 0640f531a0
commit 835004602a
8 changed files with 176 additions and 190 deletions

View File

@ -16,6 +16,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
SYSSCHEMES="/usr/share/mabox-colorizer/colorschemes/conky.csv"
USERSCHEMES="$HOME/.config/colorizer/conky/userschemes.csv"
me="colorizer-conky -s" me="colorizer-conky -s"
CONKYDIR="$HOME/.config/conky" CONKYDIR="$HOME/.config/conky"
@ -73,13 +76,21 @@ case "$LANG" in
NOT_FULLY_SUPPORTED="Częściowo wspierane..." NOT_FULLY_SUPPORTED="Częściowo wspierane..."
UNSUPPORTED="Conky - częściowo wspierane" UNSUPPORTED="Conky - częściowo wspierane"
UNSUPPORTED_START="kliknij aby uruchomić" UNSUPPORTED_START="kliknij aby uruchomić"
SCHEMES="Motywy kolorystycznie"
SYSTEM_SCHEMES="Systemowe"
YOUR_SCHEMES="Moje motywy"
SAVE_CURRSCHEME="Zapisz aktualną kolorystykę jako..."
OPEN_SCHEMEFILE="Odwórz plik ze schematami w edytorze"
COLORSCHEME="Schemat kolorów"
APPLY_SCHEME="Zastosuj"
DELETE="Usuń"
DELETE_SCHEME="Usuń schemat kolorów"
GENERATEFROMWP="Generuj z kolorów tapety" GENERATEFROMWP="Generuj z kolorów tapety"
LIGHTBG="Jasne tło" LIGHTBG="Jasne tło"
DARKBG="Ciemne tło" DARKBG="Ciemne tło"
GLOBALSETTINGS="Ustawienia globalne <small>(dla wszystkich)</small>" GLOBALSETTINGS="Ustawienia globalne <small>(dla wszystkich)</small>"
REGENERATE="Motywy kolorów" REGENERATE="Motywy kolorów"
OPENTHEMEDIR="Otwórz katalog motywów" OPENTHEMEDIR="Otwórz katalog motywów"
APPLY_THEME="Zastosuj motyw"
DEFCOLOR="Domyślny kolor <small>(tekst i ramka)</small>" DEFCOLOR="Domyślny kolor <small>(tekst i ramka)</small>"
COLOR_0="Kolor 0 <small>(tekst2)</small>" COLOR_0="Kolor 0 <small>(tekst2)</small>"
COLOR_1="Kolor 1 <small>(większy tekst)</small>" COLOR_1="Kolor 1 <small>(większy tekst)</small>"
@ -120,13 +131,21 @@ case "$LANG" in
NOT_FULLY_SUPPORTED="Partially supported" NOT_FULLY_SUPPORTED="Partially supported"
UNSUPPORTED="partially supported Conkies" UNSUPPORTED="partially supported Conkies"
UNSUPPORTED_START="click to start" UNSUPPORTED_START="click to start"
SCHEMES="Color Schemes"
SYSTEM_SCHEMES="System colorschemes"
YOUR_SCHEMES="My colorschemes"
SAVE_CURRSCHEME="Save current colors as..."
OPEN_SCHEMEFILE="Open schemes file in editor"
COLORSCHEME="Color Scheme"
APPLY_SCHEME="Apply colorscheme"
DELETE="Delete"
DELETE_SCHEME="Delete colorscheme"
GENERATEFROMWP="Generate from wallpaper colors" GENERATEFROMWP="Generate from wallpaper colors"
LIGHTBG="Light Background" LIGHTBG="Light Background"
DARKBG="Dark Background" DARKBG="Dark Background"
GLOBALSETTINGS="Global settings <small>(apply to all)</small>" GLOBALSETTINGS="Global settings <small>(apply to all)</small>"
REGENERATE="Color schemes" REGENERATE="Color schemes"
OPENTHEMEDIR="Open schemes dir" OPENTHEMEDIR="Open schemes dir"
APPLY_THEME="Apply colorscheme"
DEFCOLOR="Default color <small>(text and border)</small>" DEFCOLOR="Default color <small>(text and border)</small>"
COLOR_0="Color 0 <small>(text2)</small>" COLOR_0="Color 0 <small>(text2)</small>"
COLOR_1="Color 1 <small>(bigger text)</small>" COLOR_1="Color 1 <small>(bigger text)</small>"
@ -185,11 +204,21 @@ getvalues () {
read BORD <<< "$(grep draw_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)" read BORD <<< "$(grep draw_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)"
read STIP <<< "$(grep stippled_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)" read STIP <<< "$(grep stippled_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)"
currcolors="${WINCLR}|${CLR}|${CLR0}|${CLR1}|${CLR2}|"
} }
if pgrep -u $USER -af "conky.*mbcolor" >/dev/null; then if pgrep -u $USER -af "conky.*mbcolor" >/dev/null; then
getvalues getvalues
if [ ! -f "$USERSCHEMES" ]; then
mkdir -p "$HOME/.config/colorizer/conky/"
echo "WINCLR | CLR | CLR0 | CLR1 | CLR2 |scheme_name" > "$USERSCHEMES"
fi
[[ "$WINTRANS" == false ]] && BG="bgcolor='$WINCLR'" || BG="" [[ "$WINTRANS" == false ]] && BG="bgcolor='$WINCLR'" || BG=""
#out+=("^sep($COLORIZECONKY)") #out+=("^sep($COLORIZECONKY)")
@ -288,17 +317,35 @@ if pgrep -u $USER -af "conky.*mbcolor" >/dev/null; then
out+=("<big><span bgcolor='$WINCLR'> <span fgcolor='$CLR'></span> <span fgcolor='$CLR0'></span> <span fgcolor='$CLR1'></span> <span fgcolor='$CLR2'></span> </span></big> $REGENERATE,^checkout(regenconky)") out+=("<big><span bgcolor='$WINCLR'> <span fgcolor='$CLR'></span> <span fgcolor='$CLR0'></span> <span fgcolor='$CLR1'></span> <span fgcolor='$CLR2'></span> </span></big> $REGENERATE,^checkout(regenconky)")
out2+=("^tag(regenconky)") out2+=("^tag(regenconky)")
out2+=("^sep($REGENERATE)") out2+=("^sep($REGENERATE)")
out2+=("^sep($SYSTEM_SCHEMES)")
n=1
while IFS="|" read -r winclr clr clr0 clr1 clr2 scheme_name
do
((n=n+1))
out2+=("<tt>$(printf '%-20s' "${scheme_name}")</tt><big><span bgcolor='$winclr'> <span fgcolor='$clr'>󰯲</span> <span fgcolor='$clr0'>󰝥</span> <span fgcolor='$clr1'>󰲠</span> <span fgcolor='$clr2'>󰲢</span> </span></big>,conkyctl applyscheme_all sys ${n};$me")
done < <(tail -n +2 "$SYSSCHEMES")
out2+=("^sep($YOUR_SCHEMES)")
out2+=("<big></big> $SAVE_CURRSCHEME,conkyctl savescheme '${currcolors}';$me")
out2+=("<big></big> $OPEN_SCHEMEFILE,xdg-open $USERSCHEMES")
out2+=("^sep()")
n=1
while IFS="|" read -r winclr clr clr0 clr1 clr2 scheme_name
do
((n=n+1))
out2+=("<tt>$(printf '%-20s' "${scheme_name}")</tt><big><span bgcolor='$winclr'> <span fgcolor='$clr'>󰯲</span> <span fgcolor='$clr0'>󰝥</span> <span fgcolor='$clr1'>󰲠</span> <span fgcolor='$clr2'>󰲢</span> </span></big>,^checkout(sch${n})")
#echo "${own_window_colour}|${default_color}|${color0}|${color1}|${color2}|${themename}" >> "$USERSCHEMES"
out3+=("^tag(sch${n}")
out3+=("^sep($COLORSCHEME: ${scheme_name})")
out3+=("<big></big> $APPLY_SCHEME <big><span bgcolor='$winclr'> <span fgcolor='$clr'>󰯲</span> <span fgcolor='$clr0'>󰝥</span> <span fgcolor='$clr1'>󰲠</span> <span fgcolor='$clr2'>󰲢</span> </span></big>,conkyctl applyscheme_all usr ${n};$me")
out3+=("^sep($DELETE)")
out3+=("<big>󰗨</big> $DELETE_SCHEME ${scheme_name},conkyctl delscheme ${n};$me")
done < <(tail -n +2 "$USERSCHEMES")
out2+=("^sep($APPLY_THEME)")
for i in "${COLORIZERDIR}"/conky/themes/*.colors
do
source "${i}"
themefilename=${i##*/}
themename=${themefilename%%.col*}
out2+=("<tt>$(printf '%-20s' "${themename}")</tt><big><span bgcolor='$own_window_colour'> <span fgcolor='$default_color'>󰯲</span> <span fgcolor='$color0'>󰝥</span> <span fgcolor='$color1'>󰲠</span> <span fgcolor='$color2'>󰲢</span> </span></big>,conkyctl settheme_all $themefilename;$me")
done
out2+=("^sep()")
out2+=(" $OPENTHEMEDIR,xdg-open ${COLORIZERDIR}/conky/themes/")
out2+=("^sep($GENERATEFROMWP)") out2+=("^sep($GENERATEFROMWP)")
out2+=("<big><span bgcolor='${w[-1]}' fgcolor='${w[0]}'> $LIGHTBG <span fgcolor='${w[4]}'></span> <span fgcolor='${w[5]}'></span> </span></big>,w2theme conky light;$me") out2+=("<big><span bgcolor='${w[-1]}' fgcolor='${w[0]}'> $LIGHTBG <span fgcolor='${w[4]}'></span> <span fgcolor='${w[5]}'></span> </span></big>,w2theme conky light;$me")
out2+=("<big><span bgcolor='${w[0]}' fgcolor='${w[-1]}'> $DARKBG <span fgcolor='${w[-4]}'></span> <span fgcolor='${w[-5]}'></span> </span></big>,w2theme conky dark;$me") out2+=("<big><span bgcolor='${w[0]}' fgcolor='${w[-1]}'> $DARKBG <span fgcolor='${w[-4]}'></span> <span fgcolor='${w[-5]}'></span> </span></big>,w2theme conky dark;$me")
@ -464,6 +511,7 @@ cat <<EOF > ${MENU_ITEMS}
@rect,,$((jgtools_padding + 34)),$((jgtools_padding + 108)),29,40,0,left,top,#FFFFFF 30,${WINCLR} 60, @rect,,$((jgtools_padding + 34)),$((jgtools_padding + 108)),29,40,0,left,top,#FFFFFF 30,${WINCLR} 60,
$(printf '%s\n' "${out[@]}") $(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}") $(printf '%s\n' "${out2[@]}")
$(printf '%s\n' "${out3[@]}")
EOF EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
@ -472,4 +520,5 @@ fi
printf '%s\n' "${out[@]}" printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}" printf '%s\n' "${out2[@]}"
printf '%s\n' "${out3[@]}"

View File

@ -252,7 +252,7 @@ getvalues () {
} }
getvalues getvalues
# Current colors to file # Current colors
currcolors="${MBG}|${MBGT}|${MBORDER}|${TBG}|${TFG}|${TBORDER}|${NORMBG}|${NFG}|${SBG}|${SFG}|${SBORDER}|${SEPFG}|${GRADIENT}|" currcolors="${MBG}|${MBGT}|${MBORDER}|${TBG}|${TFG}|${TBORDER}|${NORMBG}|${NFG}|${SBG}|${SFG}|${SBORDER}|${SEPFG}|${GRADIENT}|"
#echo "${currcolors}" > ~/.config/mabox/.menu_colors #echo "${currcolors}" > ~/.config/mabox/.menu_colors
if [ ! -f "$USERSCHEMES" ]; then if [ ! -f "$USERSCHEMES" ]; then
@ -334,7 +334,7 @@ out2+=("$TIGHT,jgctl tweak sizing tight;$me")
#### COLOR SCHEMES #### COLOR SCHEMES
out+=("$SCHEMES,^checkout(schemes)") out+=("<big><span bgcolor='${MBG}'> <span fgcolor='${TBG}'></span> <span fgcolor='${SFG}'></span> <span fgcolor='${SBG}'></span> </span></big> $SCHEMES,^checkout(schemes)")
out2+=("^tag(schemes)") out2+=("^tag(schemes)")
out2+=("^sep($SCHEMES)") out2+=("^sep($SCHEMES)")
out2+=("^sep($SYSTEM_SCHEMES)") out2+=("^sep($SYSTEM_SCHEMES)")

View File

@ -397,6 +397,8 @@ languages () {
COLOR_2="Kolor 2 <small>(pasek/graf)</small>" COLOR_2="Kolor 2 <small>(pasek/graf)</small>"
BACKGROUND="Kolor tła" BACKGROUND="Kolor tła"
COLORSCHEME="Motywy kolorów" COLORSCHEME="Motywy kolorów"
SYSTEM_SCHEMES="Systemowe"
YOUR_SCHEMES="Moje motywy"
OPENTHEMEDIR="Otwórz katalog motywów" OPENTHEMEDIR="Otwórz katalog motywów"
APPLY_THEME="Zastosuj motyw" APPLY_THEME="Zastosuj motyw"
APPLY_TO_ONE="Zastosuj do " APPLY_TO_ONE="Zastosuj do "
@ -460,6 +462,8 @@ languages () {
COLOR_2="Color 2 <small>(bars/graphs)</small>" COLOR_2="Color 2 <small>(bars/graphs)</small>"
BACKGROUND="Background color" BACKGROUND="Background color"
COLORSCHEME="Color schemes" COLORSCHEME="Color schemes"
SYSTEM_SCHEMES="System colorschemes"
YOUR_SCHEMES="My colorschemes"
OPENTHEMEDIR="Open schemes dir" OPENTHEMEDIR="Open schemes dir"
APPLY_THEME="Apply scheme..." APPLY_THEME="Apply scheme..."
APPLY_TO_ONE="Apply to " APPLY_TO_ONE="Apply to "
@ -523,6 +527,8 @@ languages () {
COLOR_2="Color 2 <small>(bars/graphs)</small>" COLOR_2="Color 2 <small>(bars/graphs)</small>"
BACKGROUND="Background color" BACKGROUND="Background color"
COLORSCHEME="Color schemes" COLORSCHEME="Color schemes"
SYSTEM_SCHEMES="System colorschemes"
YOUR_SCHEMES="My colorschemes"
OPENTHEMEDIR="Open schemes dir" OPENTHEMEDIR="Open schemes dir"
APPLY_THEME="Apply scheme..." APPLY_THEME="Apply scheme..."
APPLY_TO_ONE="Apply to " APPLY_TO_ONE="Apply to "
@ -565,6 +571,13 @@ languages () {
single () { single () {
unset NOT_SUPPORTED OLD_SYNTAX unset NOT_SUPPORTED OLD_SYNTAX
SYSSCHEMES="/usr/share/mabox-colorizer/colorschemes/conky.csv"
USERSCHEMES="$HOME/.config/colorizer/conky/userschemes.csv"
if [ ! -f "$USERSCHEMES" ]; then
mkdir -p "$HOME/.config/colorizer/conky/"
echo "WINCLR | CLR | CLR0 | CLR1 | CLR2 |scheme_name" > "$USERSCHEMES"
fi
### Wallpaper colors ### Wallpaper colors
WALLPALDIR="$HOME/.cache/colorizer/palettes" WALLPALDIR="$HOME/.cache/colorizer/palettes"
mkdir -p "$WALLPALDIR" mkdir -p "$WALLPALDIR"
@ -747,37 +760,35 @@ if [[ "$OLD_SYNTAX" = "true" ]];then
if [ "$WINTRANS" == false ];then 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)") 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+=("^tag(regensingle)")
out2+=("^sep($COLORSCHEME)")
out2+=("$RESETCOLORS,conkyctl resetcolorsone ${1}")
out2+=("^sep($APPLY_THEME)") out2+=("^sep($APPLY_THEME)")
out2+=("^sep($SYSTEM_SCHEMES)")
out3+=("^tag(applytoall)") n=1
out3+=("^sep($APPLY_TO_ALL)") while IFS="|" read -r winclr clr clr0 clr1 clr2 scheme_name
for i in "${COLORIZERDIR}"/conky/themes/*.colors do
do ((n=n+1))
source "${i}" out2+=("<tt>$(printf '%-20s' "${scheme_name}")</tt><big><span bgcolor='$winclr'> <span fgcolor='${clr}'></span> <span fgcolor='${clr0}'></span> <span fgcolor='${clr1}'></span> <span fgcolor='${clr2}'></span> </span></big>,conkyctl applyscheme usr $n ${1}")
themefilename=${i##*/}
themename=${themefilename%%.colors}
ltitle=${themename//-/ }
arr=( $ltitle )
schemetitle=${arr[@]^}
out2+=("<tt>$(printf '%-20s' "${schemetitle}")</tt><big><span bgcolor='$own_window_colour'> <span fgcolor='$default_color'></span> <span fgcolor='$color0'></span> <span fgcolor='$color1'></span> <span fgcolor='$color2'></span> </span></big>,conkyctl settheme $themefilename $1")
#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") #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+=("<tt>$(printf '%-20s' "${schemetitle}")</tt><big><span bgcolor='$own_window_colour'> <span fgcolor='$default_color'></span> <span fgcolor='$color0'></span> <span fgcolor='$color1'></span> <span fgcolor='$color2'></span> </span></big>,conkyctl settheme_all $themefilename")
#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 < <(tail -n +2 "$SYSSCHEMES")
done out2+=("^sep($YOUR_SCHEMES)")
out2+=("^sep()")
out2+=(" $OPENTHEMEDIR,xdg-open ${COLORIZERDIR}/conky/themes/")
out2+=("^sep()")
out2+=("$APPLY_TO_ALL,^checkout(applytoall)")
out2+=("^sep($GENFROMWP)")
out2+=("<big><span bgcolor='${w[-1]}' fgcolor='${w[0]}'> $LIGHTBG <span fgcolor='${w[4]}'></span> <span fgcolor='${w[5]}'></span> </span></big>,w2theme conkyone light ${1}")
out2+=("<big><span bgcolor='${w[0]}' fgcolor='${w[-1]}'> $DARKBG <span fgcolor='${w[-4]}'></span> <span fgcolor='${w[-5]}'></span> </span></big>,w2theme conkyone dark ${1}")
if [[ "$1" =~ "sysinfo_" ]]; then if [[ "$1" =~ "sysinfo_" ]]; then
out2+=("^sep($NEWTHEME)") currcolors="${WINCLR}|${CLR}|${CLR0}|${CLR1}|${CLR2}|"
out2+=("$SAVENEWTHEME,conkyctl newcolorscheme ${1}") out2+=("<big></big> $SAVE_CURRSCHEME,conkyctl savescheme '${currcolors}'")
fi fi
n=1
while IFS="|" read -r winclr clr clr0 clr1 clr2 scheme_name
do
((n=n+1))
out2+=("<tt>$(printf '%-20s' "${scheme_name}")</tt><big><span bgcolor='$winclr'> <span fgcolor='${clr}'></span> <span fgcolor='${clr0}'></span> <span fgcolor='${clr1}'></span> <span fgcolor='${clr2}'></span> </span></big>,conkyctl applyscheme usr $n ${1}")
#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")
done < <(tail -n +2 "$USERSCHEMES")
out2+=("^sep($GENFROMWP)")
out2+=("<big><span bgcolor='${w[-1]}' fgcolor='${w[0]}'> $LIGHTBG <span fgcolor='${w[4]}'></span> <span fgcolor='${w[5]}'></span> </span></big>,w2theme conkyone light ${1}")
out2+=("<big><span bgcolor='${w[0]}' fgcolor='${w[-1]}'> $DARKBG <span fgcolor='${w[-4]}'></span> <span fgcolor='${w[-5]}'></span> </span></big>,w2theme conkyone dark ${1}")
out+=("^sep()") out+=("^sep()")
fi fi
@ -1108,145 +1119,57 @@ EOF
cat /tmp/xx00 > ${CFGFILE} cat /tmp/xx00 > ${CFGFILE}
} }
savescheme () {
settheme () { case "$LANG" in
source "$COLORIZERDIR"/conky/themes/${1} pl*)SAVE_AS="Nowy motyw Conky"
win_bgcolor ${own_window_colour} $2 DESC="Zapisz obecnie ustawione kolory Conky jako nowy motyw..."
default_color ${default_color} $2 LABEL="Nazwa:"
color0 ${color0} $2 NAME="nazwa";;
color1 ${color1} $2 *) SAVE_AS="New Conky colorscheme"
color2 ${color2} $2 DESC="Save current Conky colors as colorscheme..."
LABEL="Name:"
NAME="colorscheme-name";;
esac
# ask for scheme name
schemename=$(yad --center --width=300 --borders=20 --window-icon=mbcc --title "$SAVE_AS" --text="$DESC" --entry --entry-label="$LABEL" --entry-text="$NAME") || exit 1
echo "${1}${schemename}" >> "$HOME/.config/colorizer/conky/userschemes.csv"
}
delscheme() {
sed -i ${1}d "$HOME/.config/colorizer/conky/userschemes.csv"
} }
settheme_all () { applyscheme () {
source "$COLORIZERDIR"/conky/themes/${1} case "$1" in
win_bgcolor_all ${own_window_colour} sys) SCHEMEFILE="/usr/share/mabox-colorizer/colorschemes/conky.csv";;
usr) SCHEMEFILE="$HOME/.config/colorizer/conky/userschemes.csv";;
esac
while IFS="|" read -r own_window_colour default_color color0 color1 color2 scheme_name
do
win_bgcolor ${own_window_colour} ${3}
default_color ${default_color} ${3}
color0 ${color0} ${3}
color1 ${color1} ${3}
color2 ${color2} ${3}
done < <(awk 'NR == n' n=$2 "$SCHEMEFILE")
}
applyscheme_all () {
case "$1" in
sys) SCHEMEFILE="/usr/share/mabox-colorizer/colorschemes/conky.csv";;
usr) SCHEMEFILE="$HOME/.config/colorizer/conky/userschemes.csv";;
esac
while IFS="|" read -r own_window_colour default_color color0 color1 color2 scheme_name
do
win_bgcolor_all ${own_window_colour}
default_color_all ${default_color} default_color_all ${default_color}
color0_all ${color0} color0_all ${color0}
color1_all ${color1} color1_all ${color1}
color2_all ${color2} color2_all ${color2}
done < <(awk 'NR == n' n=$2 "$SCHEMEFILE")
} }
savecolorscheme () {
# $1 - themename $2 - source conkyrc
#notify-send.sh "${1}" "${2}"
## get colors
read WINCLR <<< "$(grep own_window_colour ${2} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${WINCLR}"
read CLR <<< "$(grep default_color ${2} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}"
read CLR0 <<< "$(grep color0 ${2} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR0 =~ ^#.* ]] && : || CLR0="#${CLR0}"
read CLR1 <<< "$(grep color1 ${2} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}"
read CLR2 <<< "$(grep color2 ${2} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}"
cat << EOF > "$CONKYTHEMEDIR/$1".colors
own_window_colour='${WINCLR}'
default_color='${CLR}'
color0='${CLR0}'
color1='${CLR1}'
color2='${CLR2}'
EOF
case "$LANG" in
pl*)
TITLE="Zapisano motyw ${themename}!"
DESC="Czy zastosować motyw <b>${themename}</b> do wszystkich Conky?\n"
NO="Nie, dzieki"
YES="Tak, zastosuj do wszystkich"
;;
es*)
TITLE="Colorscheme ${themename} saved!"
DESC="Do you want to apply <b>${themename}</b> color scheme to all Conky?\n"
NO="No,thanks"
YES="Yes, apply to all"
;;
*)
TITLE="Colorscheme ${themename} saved!"
DESC="Do you want to apply <b>${themename}</b> color scheme to all Conky?\n"
NO="No,thanks"
YES="Yes, apply to all"
;;
esac
cmd=(
yad --center --borders=20
--title="$TITLE"
--text="$DESC"
--button="$NO":1
--button="$YES":0
)
"${cmd[@]}"
exval=$?
case $exval in
1) :;;
0) settheme_all "${themename}.colors";;
252) :;;
esac
}
newcolorscheme () {
#notify-send.sh "NEW" "${1}"
case "$LANG" in
pl*)
SAVE_AS="Zapisz motyw jako..."
LABEL="Nazwa motywu kolorów:"
NAME="nazwa-motywu"
;;
*)
SAVE_AS="Save theme as..."
LABEL="Conky colorscheme name:"
NAME="colorscheme-name"
;;
*)
SAVE_AS="Save theme as..."
LABEL="Conky colorscheme name:"
NAME="colorscheme-name"
;;
esac
themename=$(yad --center --width=300 --title "$SAVE_AS" --entry --entry-label="$LABEL" --entry-text="$NAME") || exit 1
themename="${themename// /-}"
if [[ -f "$CONKYTHEMEDIR/${themename}.colors" ]]; then
# Themefile EXIST overwrite???
case "$LANG" in
pl*)
TITLE="Nadpisać?"
EXIST="Motyw <b>${themename}</b> już istnieje.\nNadpisać?"
CANCEL="Anuluj"
YES="Tak, nadpisz"
;;
es*)
TITLE="Overwrite?"
EXIST="Colorscheme <b>${themename}</b> exist.\nOverwrite?"
CANCEL="Cancel"
YES="Yes, overwrite"
;;
*)
TITLE="Overwrite?"
EXIST="Colorscheme <b>${themename}</b> exist.\nOverwrite?"
CANCEL="Cancel"
YES="Yes, overwrite"
;;
esac
cmd=(
yad --center --borders=20
--title="$TITLE"
--text="$EXIST"
--button="$CANCEL":1
--button="$YES ${themename}":0
)
"${cmd[@]}"
exval=$?
case $exval in
1) :;;
0) savecolorscheme "${themename}" "${1}";;
252) :;;
esac
else # New themefile, create
savecolorscheme "${themename}" "${1}"
fi
}
convert_from_old () { convert_from_old () {
# try to convert from old syntax to new by convert.lua script # try to convert from old syntax to new by convert.lua script
#notify-send.sh "Convert func" "${1}" #notify-send.sh "Convert func" "${1}"
@ -1302,9 +1225,10 @@ case "$1" in
saveposall) saveposall;; saveposall) saveposall;;
resetcolorsall) resetcolorsall ;; resetcolorsall) resetcolorsall ;;
resetcolorsone) resetcolorsone "$2";; resetcolorsone) resetcolorsone "$2";;
settheme) settheme "$2" "$3";; savescheme) savescheme "$2";;
settheme_all) settheme_all "$2";; delscheme) delscheme "$2";;
newcolorscheme) newcolorscheme "$2";; applyscheme) applyscheme "$2" "$3" "$4";;
applyscheme_all) applyscheme_all "$2" "$3";;
netdevice) netdevice ;; netdevice) netdevice ;;
convert_from_old) convert_from_old "$2";; convert_from_old) convert_from_old "$2";;
*) : ;; *) : ;;

View File

@ -293,14 +293,23 @@ opacity () {
} }
savescheme () { savescheme () {
case "$LANG" in
pl*)SAVE_AS="Nowy motyw Menu"
DESC="Zapisz obecnie ustawione kolory Menu jako nowy motyw..."
LABEL="Nazwa:"
NAME="nazwa";;
*) SAVE_AS="New Menu colorscheme"
DESC="Save current Menu colors as colorscheme..."
LABEL="Name:"
NAME="colorscheme-name";;
esac
# ask for scheme name # ask for scheme name
schemename=$(yad --center --width=300 --title "SAVE_AS" --entry --entry-label="LABEL" --entry-text="NAME") || exit 1 schemename=$(yad --center --width=300 --borders=20 --window-icon=mbcc --title "$SAVE_AS" --text="$DESC" --entry --entry-label="$LABEL" --entry-text="$NAME") || exit 1
echo "${1}${schemename}" >> "$HOME/.config/colorizer/menus/userschemes.csv" echo "${1}${schemename}" >> "$HOME/.config/colorizer/menus/userschemes.csv"
#echo "${1}"
} }
applyscheme () { applyscheme () {
theme MBcolors
line=$(awk 'NR == n' n=$1 "$HOME/.config/colorizer/menus/userschemes.csv") line=$(awk 'NR == n' n=$1 "$HOME/.config/colorizer/menus/userschemes.csv")
#notify-send.sh "$1" "${line}" #notify-send.sh "$1" "${line}"
case "$1" in case "$1" in

View File

@ -144,11 +144,11 @@ CUR_FG=$(pastel textcolor $1|pastel format hex)
out+=("^sep($SHADES_OF_CURRENT <tt><span bgcolor='$1' fgcolor='$CUR_FG'>$1</span></tt>)") out+=("^sep($SHADES_OF_CURRENT <tt><span bgcolor='$1' fgcolor='$CUR_FG'>$1</span></tt>)")
out+=("$LIGHTEN_DARKEN,^checkout(curshades)") out+=("$LIGHTEN_DARKEN,^checkout(curshades)")
out+=("$SATURATION,^checkout(saturate)") out+=("$SATURATION,^checkout(saturate)")
out+=("$ROTATE_HSL_HUE,^checkout(rotate_hsl)") out+=("<big>󰑧</big> $ROTATE_HSL_HUE,^checkout(rotate_hsl)")
#out+=("$SHADES_OF_CURRENT <tt><span bgcolor='$1'> </span></tt> (<small>$1</small>),^checkout(curshades)") #out+=("$SHADES_OF_CURRENT <tt><span bgcolor='$1'> </span></tt> (<small>$1</small>),^checkout(curshades)")
out+=("^sep()") out+=("^sep()")
out+=("$ACCENT_COLORS,^checkout(accents)") out+=("<big><span bgcolor='#e93d57'> </span> <span bgcolor='#f4a300'> </span> <span bgcolor='#3cd425'> </span> <span bgcolor='#3584e4'> </span> <span bgcolor='#e93a9a'> </span></big> $ACCENT_COLORS,^checkout(accents)")
out2+=("^tag(accents)") out2+=("^tag(accents)")
out2+=("^sep($ACCENT_COLORS)") out2+=("^sep($ACCENT_COLORS)")
for i in ${accents[@]};do out2+=("<tt><small>$i</small> <span bgcolor='$i'> </span></tt>,$2 $3 '${i}' ${6};${5}");done for i in ${accents[@]};do out2+=("<tt><small>$i</small> <span bgcolor='$i'> </span></tt>,$2 $3 '${i}' ${6};${5}");done

View File

@ -350,6 +350,8 @@ inactivetextcolor () {
buttons () { buttons () {
rm $THEMEDIR/*.xbm rm $THEMEDIR/*.xbm
cp -a /usr/share/mabox-colorizer/themes/obbuttons/${1}/*.xbm $THEMEDIR/ cp -a /usr/share/mabox-colorizer/themes/obbuttons/${1}/*.xbm $THEMEDIR/
#save buttons name to file
echo "${1}" > $THEMEDIR/.buttons
#if buttons big check font size also #if buttons big check font size also
case "$1" in case "$1" in
big-12) big-12)

View File

@ -13,18 +13,10 @@ menu () {
esac esac
} }
conky () { conky () {
#set random saved colorscheme LINES=$(tail -n +2 /usr/share/mabox-colorizer/colorschemes/conky.csv|wc -l)
COLORIZERDIR="$HOME/.config/colorizer" N=$(( ( RANDOM % $LINES ) + 2 ))
CONKYTHEMEDIR="$COLORIZERDIR/conky/themes" #notify-send.sh "$LINES" "$N"
if [ ! -d "$CONKYTHEMEDIR" ];then conkyctl applyscheme_all sys $N
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 () { wp () {
: # Może niepotrzebne tu : # Może niepotrzebne tu

View File

@ -0,0 +1,10 @@
WINCLR | CLR | CLR0 | CLR1 | CLR2 |scheme_name
#142c2c|#309552|#accdc7|#61c4bc|#E8CB2D|Istredd default
#282936|#e9e9f4|#ea51b2|#00f769|#ebff87|Dracula
#282828|#ebdbb2|#98971a|#d79921|#cc241d|Gruvbox Dark
#2D2A2E|#AB9DF2|#FCFCFA|#78DCE8|#A9DC76|Monokai Pro
#2E3440|#B48EAD|#D8DEE9|#88C0D0|#EBCB8B|Nord
#184956|#adbcbc|#ff665c|#84c747|#ebc13d|Selenized Dark
#ECE3CC|#3A4D53|#AD8900|#CC1729|#428B00|Selenized Light
#151718|#D6D6D6|#CD3F45|#9FCA56|#E6CD69|Seti
#1d1f21|#b294bb|#c5c8c6|#81a2be|#b5bd68|Tomorrow Nigh
1 WINCLR CLR CLR0 CLR1 CLR2 scheme_name
2 #142c2c #309552 #accdc7 #61c4bc #E8CB2D Istredd default
3 #282936 #e9e9f4 #ea51b2 #00f769 #ebff87 Dracula
4 #282828 #ebdbb2 #98971a #d79921 #cc241d Gruvbox Dark
5 #2D2A2E #AB9DF2 #FCFCFA #78DCE8 #A9DC76 Monokai Pro
6 #2E3440 #B48EAD #D8DEE9 #88C0D0 #EBCB8B Nord
7 #184956 #adbcbc #ff665c #84c747 #ebc13d Selenized Dark
8 #ECE3CC #3A4D53 #AD8900 #CC1729 #428B00 Selenized Light
9 #151718 #D6D6D6 #CD3F45 #9FCA56 #E6CD69 Seti
10 #1d1f21 #b294bb #c5c8c6 #81a2be #b5bd68 Tomorrow Nigh