#!/bin/bash # # conkyctl - script to handle various Conky operations in Mabox CONKYDIR="$HOME/.config/conky" BASECONKY="$CONKYDIR/sysinfo_mbcolor.conkyrc" SESSIONFILE="$CONKYDIR/conky-sessionfile" 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 update_session () { sleep 1 :> "${SESSIONFILE}" while read -r pid b c confpath do echo "$b $c ${confpath} & sleep .5" >> ${SESSIONFILE} done < <(pgrep -af "conky -c ") # Remove duplicates awk -i inplace '!seen[$0]++' ${SESSIONFILE} } transparent_all () { sd "own_window_transparent.*$" "own_window_transparent = ${1}," ${CONKYDIR}/*mbcolor.conkyrc } transparent () { sd "own_window_transparent.*$" "own_window_transparent = ${1}," ${2} } win_bgcolor_all () { sd "own_window_colour .*=.*$" "own_window_colour = '${1}'," ${CONKYDIR}/*mbcolor.conkyrc sd "own_window_transparent.*$" "own_window_transparent = false," ${CONKYDIR}/*mbcolor.conkyrc sd "own_window_transparent.*$" "own_window_transparent = true," ${CONKYDIR}/logo_mbcolor.conkyrc } win_bgcolor () { sd "own_window_colour .*=.*$" "own_window_colour = '${1}'," ${2} sd "own_window_transparent.*$" "own_window_transparent = false," ${2} #notify-send.sh "${2}" aaa } draw_borders_all () { sd "draw_borders.*$" "draw_borders = ${1}," ${CONKYDIR}/*mbcolor.conkyrc sd "draw_borders.*$" "draw_borders = false," ${CONKYDIR}/logo_mbcolor.conkyrc } draw_borders () { sd "draw_borders.*$" "draw_borders = ${1}," ${2} } stippled_borders_all () { sd "stippled_borders.*$" "stippled_borders = ${1}," ${CONKYDIR}/*mbcolor.conkyrc sd "draw_borders.*$" "draw_borders = true," ${CONKYDIR}/*mbcolor.conkyrc sd "draw_borders.*$" "draw_borders = false," ${CONKYDIR}/logo_mbcolor.conkyrc } stippled_borders () { sd "stippled_borders.*$" "stippled_borders = ${1}," ${2} sd "draw_borders.*$" "draw_borders = true," ${2} } default_color_all () { sd "default_color .*=.*$" "default_color = '${1}'," ${CONKYDIR}/*mbcolor.conkyrc } color0_all () { sd "color0 .*=.*$" "color0 = '${1}'," ${CONKYDIR}/*mbcolor.conkyrc } color1_all () { sd "color1 .*=.*$" "color1 = '${1}'," ${CONKYDIR}/*mbcolor.conkyrc } color2_all () { sd "color2 .*=.*$" "color2 = '${1}'," ${CONKYDIR}/*mbcolor.conkyrc } default_color () { sd "default_color .*=.*$" "default_color = '${1}'," ${2} } color0 () { sd "color0 .*=.*$" "color0 = '${1}'," ${2} } color1 () { sd "color1 .*=.*$" "color1 = '${1}'," ${2} } color2 () { sd "color2 .*=.*$" "color2 = '${1}'," ${2} } basefont_inc_all () { read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)" FONT=${FONTDEF%:*} FONTSIZE=${FONTDEF#*=} ((FONTSIZE++)) sd "font .*=.*,$" "font = '${FONT}:size=${FONTSIZE}'," ${CONKYDIR}/*mbcolor.conkyrc } basefont_dec_all () { read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)" FONT=${FONTDEF%:*} FONTSIZE=${FONTDEF#*=} ((FONTSIZE--)) sd "font .*=.*,$" "font = '${FONT}:size=${FONTSIZE}'," ${CONKYDIR}/*mbcolor.conkyrc } basefont_inc () { read FONTDEF <<< "$(grep "font .*=.*,$" ${1} | cut -d'=' -f2,3 |cut -d"'" -f2)" FONT=${FONTDEF%:*} FONTSIZE=${FONTDEF#*=} ((FONTSIZE++)) sd "font .*=.*,$" "font = '${FONT}:size=${FONTSIZE}'," ${1} } basefont_dec () { read FONTDEF <<< "$(grep "font .*=.*,$" ${1} | cut -d'=' -f2,3 |cut -d"'" -f2)" FONT=${FONTDEF%:*} FONTSIZE=${FONTDEF#*=} ((FONTSIZE--)) sd "font .*=.*,$" "font = '${FONT}:size=${FONTSIZE}'," ${1} } shades_all () { case "$1" in shadow) sd "draw_shades .*=.*,$" "draw_shades = true," ${CONKYDIR}/*mbcolor.conkyrc sd "draw_outline .*=.*,$" "draw_outline = false," ${CONKYDIR}/*mbcolor.conkyrc ;; outline) sd "draw_shades .*=.*,$" "draw_shades = false," ${CONKYDIR}/*mbcolor.conkyrc sd "draw_outline .*=.*,$" "draw_outline = true," ${CONKYDIR}/*mbcolor.conkyrc ;; *) sd "draw_shades .*=.*,$" "draw_shades = false," ${CONKYDIR}/*mbcolor.conkyrc sd "draw_outline .*=.*,$" "draw_outline = false," ${CONKYDIR}/*mbcolor.conkyrc ;; esac } shades () { case "$1" in shadow) sd "draw_shades .*=.*,$" "draw_shades = true," ${2} sd "draw_outline .*=.*,$" "draw_outline = false," ${2} ;; outline) sd "draw_shades .*=.*,$" "draw_shades = false," ${2} sd "draw_outline .*=.*,$" "draw_outline = true," ${2} ;; *) sd "draw_shades .*=.*,$" "draw_shades = false," ${2} sd "draw_outline .*=.*,$" "draw_outline = false," ${2} ;; esac } logosize () { sd "minimum_height.*$" "minimum_height = ${1}," ${CONKYDIR}/logo_mbcolor.conkyrc sd "minimum_width.*$" "minimum_width = ${1}," ${CONKYDIR}/logo_mbcolor.conkyrc sd "\{image ~.*$" "{image ~/.config/conky/images/mabox_3d.png -s ${1}x${1}}" ${CONKYDIR}/logo_mbcolor.conkyrc } pos () { def_x=${conky_gap_x:-30} def_y=${conky_gap_y:-60} sd "alignment .*=.*,$" "alignment = '${1}'," ${2} ### jak po środku to wyzerować gaps case "$1" in top_left|top_right|bottom_left|bottom_right) sd "gap_x .*=.*," "gap_x = ${def_x}," ${2} sd "gap_y .*=.*," "gap_y = ${def_y}," ${2} ;; top_middle|bottom_middle) sd "gap_x .*=.*," "gap_x = 0," ${2} sd "gap_y .*=.*," "gap_y = ${def_y}," ${2} ;; middle_left|middle_right) sd "gap_x .*=.*," "gap_x = ${def_x}," ${2} sd "gap_y .*=.*," "gap_y = 0," ${2} ;; middle_middle) sd "gap_x .*=.*," "gap_x = 0," ${2} sd "gap_y .*=.*," "gap_y = 0," ${2} ;; esac } gap_x () { sd "gap_x .*=.*," "gap_x = ${1}," ${2} } gap_y () { sd "gap_y .*=.*," "gap_y = ${1}," ${2} } setpos () { filename=${1##*/} name=${filename%%_mb*} title=${name//_/ } case "$LANG" in pl*) SUMM="Nowa pozycja dla Conky: ${title^}" BODY="\nNarysuj mały prostokąt na ekranie aby wyznaczyć nową pozycję...\n (ESC lub prawy klik anuluje" ABORTED_SUMM="Anulowano!" ABORTED_BODY="\n...operacja anulowana" ;; es*) SUMM="Mark new position for ${title^} Conky" BODY="\nDraw small rectangle to mark new position...\n (ESC or right click to abort)" ABORTED_SUMM="Aborted!" ABORTED_BODY="\n... operation aborted!" ;; *) SUMM="Mark new position for ${title^} Conky" BODY="\nDraw small rectangle to mark new position...\n (ESC or right click to abort)" ABORTED_SUMM="Aborted!" ABORTED_BODY="\n... operation aborted!" ;; esac wmctrl -k on notify-send.sh -i mbcc --replace-file=/tmp/conkyctlfile "${SUMM}" "${BODY}" read -r X Y < <(slop -t 0 -l -b 3 --color=0.3,0.4,0.6,0.4 -f "%x %y") if [ -z "$X" ] then notify-send.sh -i mbcc --replace-file=/tmp/conkyctlfile "${ABORTED_SUMM}" "${ABORTED_BODY}" else pos top_left ${1} # improve conky margin calculation here: gap = border_width + border_inner_margin + border_outer_margin ((X=X+17)) ((Y=Y+17)) gap_x ${X} ${1} gap_y ${Y} ${1} case "$LANG" in pl*) THNX_SUMM="Dziękuję!" THNX_BODY="Zapisano nową pozycję ${title^} \n\tX: $X\n\tY: $Y" ;; es*) THNX_SUMM="Thank you!" THNX_BODY="New position of ${title^} saved! \n\tX: $X\n\tY: $Y" ;; *) THNX_SUMM="Thank you!" THNX_BODY="New position of ${title^} saved! \n\tX: $X\n\tY: $Y" ;; esac notify-send.sh -i mbcc --replace-file=/tmp/conkyctlfile "${THNX_SUMM}" "${THNX_BODY}" #wmctrl -k off fi } startone () { conky -c "${1}" & update_session } startall () { for i in "$CONKYDIR"/*_mbcolor*; do if pgrep -af "conky .*${i}" >/dev/null; then : else conky -c "${i}" & fi done update_session } kill () { pkill -f "conky .*${1}" update_session } restartone () { kill ${1} startone ${1} } makemoveableall () { wmctrl -k on sd "own_window_type.*$" "own_window_type = 'normal'," ${CONKYDIR}/*mbcolor.conkyrc case "$LANG" in pl*) TITLE="Przenieś Conky dokąd chcesz" DESC="Możesz teraz przesuwać wszystkie Conky.\nPrzytrzymaj wciśnięty klawisz Alt i przesuń każde Conky gdzie chcesz\n " VB="To prawdopodobnie nie zadziała w środowiskach wirtualnych" CANCEL="Anuluj" SAVE="Zapisz nowe pozycje" ;; es*) TITLE="Move Conkies where you want" DESC="Move Conkies to desired locations now...\n Hold Alt and drag Conkies one by one.\n" VB="It will probably not work in Virtual environments" CANCEL="Cancel" SAVE="Save new positions" ;; *) TITLE="Move Conkies where you want" DESC="Move Conkies to desired locations now...\n Hold Alt and drag Conkies one by one.\n" VB="It will probably not work in Virtual environments" CANCEL="Cancel" SAVE="Save new positions" ;; esac TYPE=$(cat /sys/class/dmi/id/chassis_type) if [ "$TYPE" != "1" ];then VB="" fi cmd=( yad --center --borders=20 --title="$TITLE" --text="$DESC\n\n${VB}" --button="$CANCEL":1 --button="$SAVE":0 ) "${cmd[@]}" exval=$? #notify-send.sh -t 10000 "Exval" "${exval}" case $exval in 1) makedesktoptypeall;; 0) saveposall;; 252) makedesktoptypeall;; esac } saveposall () { # save new positions here while read -r WIN_ID b c X Y rest do conffile=$(xprop -id $WIN_ID |grep WM_COMMAND |cut -d'"' -f6) if [[ "$conffile" = *"mbcolor"* ]];then pos top_left ${conffile} #notify-send.sh -t 10000 "${X} ${Y}" "${conffile}" # improve conky margin calculation here: gap = border_width + border_inner_margin + border_outer_margin ((X=X+17)) ((Y=Y+17)) gap_x ${X} ${conffile} gap_y ${Y} ${conffile} fi done < <(wmctrl -lpG | grep '1 0 ') makedesktoptypeall } makedesktoptypeall () { sd "own_window_type.*$" "own_window_type = 'desktop'," ${CONKYDIR}/*mbcolor.conkyrc } resetcolorsall () { transparent_all false win_bgcolor_all '#142c2c' #draw_borders_all true #stippled_borders_all 0 default_color_all '#309552' color0_all '#accdc7' color1_all '#61c4bc' color2_all '#E8CB2D' } resetcolorsone () { transparent false "${1}" win_bgcolor '#142c2c' "${1}" default_color '#309552' "${1}" color0 '#accdc7' "${1}" color1 '#61c4bc' "${1}" color2 '#E8CB2D' "${1}" } languages () { case "$LANG" in pl*) UNSUPPORTED="częściowo wspierane!!!" OLD_SYNTAX_DETECTED=" stara składnia! wykryta..." CONVERT_OLD="Czy spróbować skonwertować?" CONVERT_OLD_TRY="Tak, spróbuj konwertować" POSITION="Pozycja" MAKEMOVEABLE="Ustaw wszystkie (poprzez przeciąganie)..." MARKNEWPOS="Nowa pozycja (zaznacz na ekranie)..." ALIGNMENT="Wyrównanie" TOPLEFT="Góra po lewej" TOP="Góra" TOPRIGHT="Góra po prawej" LEFT="Lewa" CENTER="Po środku" RIGHT="Prawa" BOTTOMLEFT="Dół po lewej" BOTTOM="Dół" BOTTOMRIGHT="Dół po prawej" HORIZONTAL_GAP="Odstęp poziomy" VERTICAL_GAP="Odstęp pionowy" COLORS="Kolory" DEFCOLOR="Domyślny kolor (tekst i ramka)" COLOR_0="Kolor 0 (tekst2)" COLOR_1="Kolor 1 (większy tekst)" COLOR_2="Kolor 2 (pasek/graf)" BACKGROUND="Kolor tła" COLORSCHEME="Motywy kolorów" OPENTHEMEDIR="Otwórz katalog motywów" APPLY_THEME="Zastosuj motyw" APPLY_TO_ONE="Zastosuj do " APPLY_TO_ALL="Zastosuj do wszystkich" NEWTHEME="Nowy motyw kolorów..." SAVENEWTHEME="utwórz nowy motyw..." LIGHTBG="light - jasne tło" DARKBG="dark - ciemne tło" RESETCOLORS="Przywróć domyślne kolory" GENFROMWP="Generuj z kolorów tapety" TRANSPARENT="Przezroczyste tło?" YES="Tak" NO="Nie" FONTS="Czcionka" SELECTFONT="Wybierz czcionkę..." INCREASE="Powiększ" DECREASE="Pomniejsz" OLINE="Obrys" SHADOW="Cień" DRAW="Rysuj" BORDERS="Obramowanie" EDIT="Edytuj plik" RELOAD="Przeładuj" KILL="Zabij" LOGOSIZE="Rozmiar logo" SMALL="Małe" NORMAL="Normalne" BIG="Duże" STIPPLED_BORDERS="Nakrapiane" SOLID_LINE="linia ciągła" NOT_WORKING="Nie działa? Naprawmy to :)" MOUNTPOINTS="Dyski (punkty montowania)" ;; es*) UNSUPPORTED="partially supported!!!" OLD_SYNTAX_DETECTED=" old syntax!!! detected..." CONVERT_OLD="Try to convert to new syntax?" CONVERT_OLD_TRY="Yes, try to convert" POSITION="Position" MAKEMOVEABLE="Make moveable all..." MARKNEWPOS="New position (mark on the screen)..." ALIGNMENT="Alignment" TOPLEFT="TopLeft" TOP="Top" TOPRIGHT="TopRight" LEFT="Left" CENTER="Center" RIGHT="Right" BOTTOMLEFT="BottomLeft" BOTTOM="Bottom" BOTTOMRIGHT="BottomRight" HORIZONTAL_GAP="Horizontal Gap" VERTICAL_GAP="Vertical Gap" COLORS="Colors" DEFCOLOR="Default color (text and border)" COLOR_0="Color 0 (text2)" COLOR_1="Color 1 (bigger text)" COLOR_2="Color 2 (bars/graphs)" BACKGROUND="Background color" COLORSCHEME="Color schemes" OPENTHEMEDIR="Open schemes dir" APPLY_THEME="Apply scheme..." APPLY_TO_ONE="Apply to " APPLY_TO_ALL="Apply to All" NEWTHEME="New Color scheme..." SAVENEWTHEME="from current colors..." LIGHTBG="light" DARKBG="dark" RESETCOLORS="Restore default colors" GENFROMWP="Generate from wallpaper" TRANSPARENT="Transparent background?" YES="Yes" NO="No" FONTS="Font" SELECTFONT="Select Font..." INCREASE="Increase" DECREASE="Decrease" OLINE="Outline" SHADOW="Shadow" DRAW="Draw" BORDERS="Borders" EDIT="Edit file" RELOAD="Reload" KILL="Kill" LOGOSIZE="Logo size" SMALL="Small" NORMAL="Normal" BIG="Big" STIPPLED_BORDERS="Stippled borders" SOLID_LINE="solid line" NOT_WORKING="Not working? Try to fix" MOUNTPOINTS="Discs (mount points)" ;; *) UNSUPPORTED="partially supported!!!" OLD_SYNTAX_DETECTED=" old syntax!!! detected..." CONVERT_OLD="Try to convert to new syntax?" CONVERT_OLD_TRY="Yes, try to convert" POSITION="Position" MAKEMOVEABLE="Make moveable all..." MARKNEWPOS="New position (mark on the screen)..." ALIGNMENT="Alignment" TOPLEFT="TopLeft" TOP="Top" TOPRIGHT="TopRight" LEFT="Left" CENTER="Center" RIGHT="Right" BOTTOMLEFT="BottomLeft" BOTTOM="Bottom" BOTTOMRIGHT="BottomRight" HORIZONTAL_GAP="Horizontal Gap" VERTICAL_GAP="Vertical Gap" COLORS="Colors" DEFCOLOR="Default color (text and border)" COLOR_0="Color 0 (text2)" COLOR_1="Color 1 (bigger text)" COLOR_2="Color 2 (bars/graphs)" BACKGROUND="Background color" COLORSCHEME="Color schemes" OPENTHEMEDIR="Open schemes dir" APPLY_THEME="Apply scheme..." APPLY_TO_ONE="Apply to " APPLY_TO_ALL="Apply to All" NEWTHEME="New Color scheme..." SAVENEWTHEME="from current colors..." LIGHTBG="light" DARKBG="dark" RESETCOLORS="Restore default colors" GENFROMWP="Generate from wallpaper" TRANSPARENT="Transparent background?" YES="Yes" NO="No" FONTS="Font" SELECTFONT="Select Font..." INCREASE="Increase" DECREASE="Decrease" OLINE="Outline" SHADOW="Shadow" DRAW="Draw" BORDERS="Borders" EDIT="Edit file" RELOAD="Reload" KILL="Kill" LOGOSIZE="Logo size" SMALL="Small" NORMAL="Normal" BIG="Big" STIPPLED_BORDERS="Stippled borders" SOLID_LINE="solid line" NOT_WORKING="Not working? Try to fix" MOUNTPOINTS="Discs (mount points)" ;; esac } single () { unset NOT_SUPPORTED OLD_SYNTAX languages filename=${1##*/} name=${filename%%_mb*} title=${name//_/ } grep -q "conky.text" "$1" && : || OLD_SYNTAX="true" # breaks mbclr color picking from contextmenu, leave it as "colorizer-conky -s" for now if [[ "$2" == "s" ]];then me="none none" else me="colorizer-conky -s" fi read POS <<< "$(grep alignment ${1} | cut -d'=' -f2 | cut -d"'" -f2)" read GAPX <<< "$(grep gap_x ${1} | cut -d'=' -f2 | cut -d"," -f1)" read GAPY <<< "$(grep gap_y ${1} | cut -d'=' -f2 | cut -d"," -f1)" read WINTRANS <<< "$(grep own_window_transparent ${1} | cut -d'=' -f2 | cut -d"," -f1)" read FONTDEF <<< "$(grep "font .*=.*,$" ${1} | cut -d'=' -f2,3 |cut -d"'" -f2)" FONT=${FONTDEF%:*} FONTSIZE=${FONTDEF#*=} read WINCLR <<< "$(grep own_window_colour ${1} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${WINCLR}" read CLR <<< "$(grep default_color ${1} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}" read CLR0 <<< "$(grep color0 ${1} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR0 =~ ^#.* ]] && : || CLR0="#${CLR0}" read CLR1 <<< "$(grep color1 ${1} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}" read CLR2 <<< "$(grep color2 ${1} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}" read OUTLINE <<< "$(grep draw_outline ${1} | cut -d'=' -f2 | cut -d"," -f1)" read SHADES <<< "$(grep draw_shades ${1} | cut -d'=' -f2 | cut -d"," -f1)" SHADOWS="no" [[ "$OUTLINE" == "true" ]] && SHADOWS="outline" [[ "$SHADES" == "true" ]] && SHADOWS="shadow" read BORD <<< "$(grep draw_borders ${1} | cut -d'=' -f2 | cut -d"," -f1)" read STIP <<< "$(grep stippled_borders ${1} | cut -d'=' -f2 | cut -d"," -f1)" [[ "$WINTRANS" == false ]] && BG="bgcolor='$WINCLR'" || BG="" if [[ "$filename" == *"mbcolor"* ]];then out+=("^sep(Conky: [ ${title^} ])") else NOT_SUPPORTED="true" out+=("^sep(Conky: [ ${title^} ]") out+=("^sep( ${UNSUPPORTED} )") fi if [[ "$OLD_SYNTAX" = "true" ]];then out+=("$OLD_SYNTAX_DETECTED,^checkout(oldsyntax)") out2+=("^tag(oldsyntax)") out2+=("^sep($CONVERT_OLD)") out2+=("\"\"\"$CONVERT_OLD_TRY\"\"\",conkyctl convert_from_old ${1}") #notify-send.sh "Plik" "${1}" else out+=(" $POSITION,^checkout(position)") if [[ "$1" =~ "etwork_mbcolor" ]]; then out+=("$NOT_WORKING,conkyctl netdevice") fi #out+=("^sep($POSITION)") out2+=("^tag(position)") out2+=("^sep($POSITION)") out2+=(" $MARKNEWPOS,conkyctl setpos ${1};$me") out2+=("^sep()") out2+=("$ALIGNMENT [ $POS ],^checkout(posi)") out3+=("^tag(posi)") out3+=("^sep($POSITION)") out3+=(" $TOPLEFT,conkyctl pos top_left ${1};$me") out3+=(" $TOP,conkyctl pos top_middle ${1};$me") out3+=(" $TOPRIGHT,conkyctl pos top_right ${1};$me") out3+=(" $LEFT,conkyctl pos middle_left ${1};$me") out3+=("$CENTER,conkyctl pos middle_middle ${1};$me") out3+=(" $RIGHT,conkyctl pos middle_right ${1};$me") out3+=(" $BOTTOMLEFT,conkyctl pos bottom_left ${1};$me") out3+=(" $BOTTOM,conkyctl pos bottom_middle ${1};$me") out3+=(" $BOTTOMRIGHT,conkyctl pos bottom_right ${1};$me") out2+=("$HORIZONTAL_GAP [ $GAPX ],^checkout(gapx)") out3+=("^tag(gapx)") out3+=("^sep($HORIZONTAL_GAP)") for i in 0 10 20 30 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360; do out3+=("${i},conkyctl gap_x ${i} ${1};$me") done out2+=("$VERTICAL_GAP [ $GAPY ],^checkout(gapy)") out3+=("^tag(gapy)") out3+=("^sep($VERTICAL_GAP)") for i in 0 10 20 30 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360; do out3+=("${i},conkyctl gap_y ${i} ${1};$me") done if [[ "$NOT_SUPPORTED" != "true" ]];then out2+=("^sep()") out2+=(" $MAKEMOVEABLE,conkyctl makemoveableall") fi if [[ "$1" =~ "logo_mbcolor" ]]; then read LSIZE <<< "$(grep minimum_height ${1} | cut -d'=' -f2 | cut -d"," -f1)" out+=("^sep($LOGOSIZE)") out+=("$LOGOSIZE [ $LSIZE ],^checkout(logosize)") out2+=("^tag(logosize)") out2+=("^sep($LOGOSIZE)") out2+=("$SMALL 64px,conkyctl logosize 64;$me") out2+=("$NORMAL 128px,conkyctl logosize 128;$me") out2+=("$BIG 256px,conkyctl logosize 256;$me") fi if [[ "$1" =~ "quoter" ]]; then case "$LANG" in pl*) FONTSIZE="Rozmiar czcionki" QUOTE_FSIZE="Cytat" AUTHOR_FSIZE="Autor" EDIT_CONF="Edytuj plik konfiguracyjny" RELOAD="Przeładuj" ;; es*) FONTSIZE="Font size" QUOTE_FSIZE="Quote" AUTHOR_FSIZE="Author" EDIT_CONF="Edit conf file" RELOAD="Reload" ;; *) FONTSIZE="Font size" QUOTE_FSIZE="Quote" AUTHOR_FSIZE="Author" EDIT_CONF="Edit conf file" RELOAD="Reload" ;; esac Q_CFG="$HOME/.config/quoter/quoter.cfg" source "$Q_CFG" out+=("^sep($FONTSIZE)") out+=("$QUOTE_FSIZE [ $quote_fontsize ],^checkout(qsize)") out+=("$AUTHOR_FSIZE [ $author_fontsize ],^checkout(asize)") out2+=("^tag(qsize)") out2+=("^sep($QUOTE_FSIZE)") for i in 10 11 12 13 14 15 16 18 20; do out2+=("${i},mb-setvar quote_fontsize=$i $Q_CFG;conkyctl restartone ${1};$me") done out2+=("^tag(asize)") out2+=("^sep($AUTHOR_FSIZE)") for i in 10 11 12 13 14 15 16 18 20; do out2+=("${i},mb-setvar author_fontsize=$i $Q_CFG;conkyctl restartone ${1};$me") done fi out+=("^sep($COLORS)") if [ "$WINTRANS" == false ];then out+=(" $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} out2+=(" $themename,conkyctl settheme $themefilename $1") out3+=(" $themename,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 [ $WINTRANS ],^checkout(transsingle)") if [[ "$WINCLR" != "#" ]];then if [ "$WINTRANS" == false ];then out+=(" AbCd $BACKGROUND,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor '${BACKGROUND}' '$me' ${1})") out+=("^sep()") else out+=(" transparent $BACKGROUND,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor '${BACKGROUND}' '$me' ${1})") out+=("^sep()") fi fi if [[ "$1" != *"logo_mbcolor"* ]]; then [[ "$CLR" != "#" ]] && out+=(" AbCd $DEFCOLOR,^pipe(mbclr '$CLR' conkyctl default_color '${DEFCOLOR}' '$me' ${1})") [[ "$CLR0" != "#" ]] && out+=(" AbCd $COLOR_0,^pipe(mbclr '$CLR0' conkyctl color0 '$COLOR_0' '$me' ${1})") [[ "$CLR1" != "#" ]] && out+=(" AbCd $COLOR_1,^pipe(mbclr '$CLR1' conkyctl color1 '$COLOR_1' '$me' ${1})") [[ "$CLR2" != "#" ]] && out+=(" AbCd $COLOR_2,^pipe(mbclr '$CLR2' conkyctl color2 '$COLOR_2' '$me' ${1})") out+=("^sep()") fi out2+=("^tag(transsingle)") out2+=("^sep($TRANSPARENT)") out2+=("$YES,conkyctl transparent true ${1};$me") out2+=("$NO,conkyctl transparent false ${1};$me") if [[ "$1" != *"logo_mbcolor"* ]]; then if [[ "$1" != *"quoter_mbcolor"* ]]; then out+=("$FONTS [ $FONT $FONTSIZE ],^checkout(fontsingle)") out2+=("^tag(fontsingle)") out2+=("^sep($FONTS)") out2+=("$SELECTFONT,mb-setfont conky_single ${1};$me") out2+=("^sep()") out2+=("++ $INCREASE,conkyctl basefont_inc ${1};$me") out2+=("-- $DECREASE,conkyctl basefont_dec ${1};$me") fi out+=("$OLINE/$SHADOW [ $SHADOWS ],^checkout(outline2)") out2+=("^tag(outline2)") out2+=("^sep($DRAW $OLINE/$SHADOW?)") out2+=("$NO,conkyctl shades no ${1};$me") out2+=("^sep()") out2+=("$DRAW $SHADOW,conkyctl shades shadow ${1};$me") out2+=("$DRAW $OLINE,conkyctl shades outline ${1};$me") out+=("^sep()") fi out+=("$BORDERS [ $BORD $STIP ],^checkout(bordersingle)") out2+=("^tag(bordersingle)") out2+=("^sep($DRAW $BORDERS?)") out2+=("$YES,conkyctl draw_borders true ${1};$me") out2+=("$NO,conkyctl draw_borders false ${1};$me") out2+=("^sep($STIPPLED_BORDERS ?)") out2+=("0 ($SOLID_LINE),conkyctl stippled_borders 0 ${1};$me") out2+=("^sep()") out2+=("1,conkyctl stippled_borders 1 ${1};$me") out2+=("2,conkyctl stippled_borders 2 ${1};$me") out2+=("3,conkyctl stippled_borders 3 ${1};$me") out2+=("4,conkyctl stippled_borders 4 ${1};$me") fi #OLD SYNTAX CHECK out+=("^sep()") out+=(" $EDIT ${title^},xdg-open ${1}") out+=("北 $RELOAD ${title^},conkyctl restartone ${1}") out+=("^sep()") out+=(" $KILL ${title^},conkyctl kill ${1##*/};${me}") } pipemenu () { single "$1" printf '%s\n' "${out[@]}" printf '%s\n' "${out2[@]}" printf '%s\n' "${out3[@]}" exit 0 } contextmenu () { # get conky config path from clicked "conky window" # maybe split this to separate function? eval $(xdotool getmouselocation --shell) eval $(xdotool getwindowgeometry --shell ${WINDOW}) hexid=$(wmctrl -lpG | grep ${X} |grep ${Y}|grep ${WIDTH}|grep ${HEIGHT} |cut -d' ' -f1) CONKYCFG=$(xprop -id ${hexid}|grep WM_COMMAND|cut -d'"' -f6) languages filename=${CONKYCFG##*/} name=${filename%%_mb*} title=${name//_/ } read POS <<< "$(grep alignment ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)" read GAPX <<< "$(grep gap_x ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)" read GAPY <<< "$(grep gap_y ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)" read WINTRANS <<< "$(grep own_window_transparent ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)" read FONTDEF <<< "$(grep "font .*=.*,$" ${CONKYCFG} | cut -d'=' -f2,3 |cut -d"'" -f2)" FONT=${FONTDEF%:*} FONTSIZE=${FONTDEF#*=} read WINCLR <<< "$(grep own_window_colour ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${WINCLR}" read CLR <<< "$(grep default_color ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}" read CLR0 <<< "$(grep color0 ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR0 =~ ^#.* ]] && : || CLR0="#${CLR0}" read CLR1 <<< "$(grep color1 ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}" read CLR2 <<< "$(grep color2 ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}" read OUTLINE <<< "$(grep draw_outline ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)" read SHADES <<< "$(grep draw_shades ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)" SHADOWS="no" [[ "$OUTLINE" == "true" ]] && SHADOWS="outline" [[ "$SHADES" == "true" ]] && SHADOWS="shadow" read BORD <<< "$(grep draw_borders ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)" read STIP <<< "$(grep stippled_borders ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)" [[ "$WINTRANS" == false ]] && BG="bgcolor='$WINCLR'" || BG="" #notify-send.sh -t 0 "Window" "z xdotool: ${WINDOW} \n X $X \n Y $Y \n hexid: $hexid \n $CONKYCFG \n ${WINCLR}\n ${name}\n $HOME/.config/mabox/${name}.csv" . /usr/share/mb-jgtools/pipemenu-standalone.cfg . $HOME/.config/mabox/mabox.conf CONFIG_FILE=$(mktemp) MENU_ITEMS=$(mktemp) trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT POSITION_MODE=${1:-pointer} HIDE_BACK_ITEMS=1 menu_gradient_pos=none jgtools_padding=4 MENU_PADDING_TOP=${jgtools_padding:-0} TABS="90" jgmenu_icon_size=0 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)";; esac out+=("^sep()") out+=("$EDIT_CUSTOMCOMMANDS,touch ${CONKYDIR}/menuscripts/${name}.csv;sleep 1;xdg-open ${CONKYDIR}/menuscripts/${name}.csv") out+=("^sep()") out+=(" ⮜⮜⮜ Conky Manager (Colorizer),colorizer-conky -s") if [[ "$CONKYCFG" =~ "mount_points" ]]; then out+=("^sep($MOUNTPOINTS)") while read DEVICE SIZE USED FREE PERCENT MOUNT do [[ "${#MOUNT}" -gt "10" ]] && MOUNTLBL=${MOUNT##*/} || MOUNTLBL=${MOUNT} [[ "${#MOUNTLBL}" -gt "10" ]] && MOUNTLBL=${MOUNTLBL:0:9} out+=("$MOUNTLBL,^pipe(jgbrowser ${MOUNT})") done < <(df -h | grep -v "boot" | grep '^/dev') fi mkconfigfile if [[ "$OLD_SYNTAX" != "true" ]];then echo "color_menu_bg_to=${WINCLR} 100" >> ${CONFIG_FILE} TXTCOLOR=$(pastel textcolor ${WINCLR}|pastel format hex) #notify-send.sh "TXTCOLOR" "${TXTCOLOR} ${menu_gradient_pos}" if [ "$TXTCOLOR" == "#ffffff" ];then #bg is dark TXTCOLOR_NORM="#cccccc" WINCLR=$(pastel lighten 0.03 ${WINCLR}|pastel format hex) echo "color_norm_fg=${TXTCOLOR_NORM} 100" >> ${CONFIG_FILE} echo "color_sel_fg=${TXTCOLOR} 100" >> ${CONFIG_FILE} echo "color_title_fg=${TXTCOLOR} 60" >> ${CONFIG_FILE} SELBG=$(pastel darken 0.1 ${WINCLR}|pastel format hex) echo "color_sel_bg=${SELBG} 80" >> ${CONFIG_FILE} echo "color_title_bg=${SELBG} 30" >> ${CONFIG_FILE} echo "color_title_border=${SELBG} 60" >> ${CONFIG_FILE} else #bg is light TXTCOLOR_NORM="#333333" echo "color_norm_fg=${TXTCOLOR_NORM} 100" >> ${CONFIG_FILE} echo "color_sel_fg=${TXTCOLOR} 100" >> ${CONFIG_FILE} echo "color_title_fg=${TXTCOLOR} 90" >> ${CONFIG_FILE} SELBG=$(pastel darken 0.1 ${WINCLR}|pastel format hex) echo "color_sel_bg=${SELBG} 80" >> ${CONFIG_FILE} echo "color_title_bg=${SELBG} 90" >> ${CONFIG_FILE} echo "color_title_border=${SELBG} 90" >> ${CONFIG_FILE} fi echo "color_menu_bg=${WINCLR} 90" >> ${CONFIG_FILE} echo "color_menu_border=${CLR} 60" >> ${CONFIG_FILE} echo "menu_border=1" >> ${CONFIG_FILE} echo "menu_radius=0" >> ${CONFIG_FILE} echo "color_sep_fg=${CLR} 10" >> ${CONFIG_FILE} echo "font=${FONT} 10" >> ${CONFIG_FILE} fi cat < ${MENU_ITEMS} $(printf '%s\n' "${out[@]}") $(printf '%s\n' "${out2[@]}") $(printf '%s\n' "${out3[@]}") EOF jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null } cmdmenu () { mkdir -p "${CONKYDIR}"/menuscripts # get conky config path from clicked "conky window" eval $(xdotool getmouselocation --shell) eval $(xdotool getwindowgeometry --shell ${WINDOW}) hexid=$(wmctrl -lpG | grep ${X} |grep ${Y}|grep ${WIDTH}|grep ${HEIGHT} |cut -d' ' -f1) CONKYCFG=$(xprop -id ${hexid}|grep WM_COMMAND|cut -d'"' -f6) filename=${CONKYCFG##*/} name=${filename%%_mb*} title=${name//_/ } #notify-send.sh "${X} ${Y}" "${WIDTH} ${HEIGHT}" # if script exist run it and exit if [ -f "${CONKYDIR}/menuscripts/${name}" ];then bash "${CONKYDIR}/menuscripts/${name}" exit 0 fi # if CSV for menu exist show it 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 contextmenu fi else contextmenu fi # otherwise build and show standalone menu with custom commands sleep .2 read WINTRANS <<< "$(grep own_window_transparent ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)" read FONTDEF <<< "$(grep "font .*=.*,$" ${CONKYCFG} | cut -d'=' -f2,3 |cut -d"'" -f2)" FONT=${FONTDEF%:*} FONTSIZE=${FONTDEF#*=} read WINCLR <<< "$(grep own_window_colour ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${WINCLR}" read CLR <<< "$(grep default_color ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}" . /usr/share/mb-jgtools/pipemenu-standalone.cfg . $HOME/.config/mabox/mabox.conf CONFIG_FILE=$(mktemp) MENU_ITEMS=$(mktemp) trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT POSITION_MODE=${1:-pointer} #POSITION_MODE=fixed HIDE_BACK_ITEMS=1 menu_gradient_pos=none jgtools_padding=4 MENU_PADDING_TOP=${jgtools_padding:-0} JGWIDTH=270 TABS="90" jgmenu_icon_size=0 mkconfigfile echo "color_menu_bg_to=${WINCLR} 100" >> ${CONFIG_FILE} TXTCOLOR=$(pastel textcolor ${WINCLR}|pastel format hex) #notify-send.sh "TXTCOLOR" "${TXTCOLOR} ${menu_gradient_pos}" if [ "$TXTCOLOR" == "#ffffff" ];then #bg is dark TXTCOLOR_NORM="#cccccc" WINCLR=$(pastel lighten 0.03 ${WINCLR}|pastel format hex) echo "color_norm_fg=${TXTCOLOR_NORM} 100" >> ${CONFIG_FILE} echo "color_sel_fg=${TXTCOLOR} 100" >> ${CONFIG_FILE} echo "color_title_fg=${TXTCOLOR} 60" >> ${CONFIG_FILE} SELBG=$(pastel darken 0.1 ${WINCLR}|pastel format hex) echo "color_sel_bg=${SELBG} 80" >> ${CONFIG_FILE} echo "color_title_bg=${SELBG} 30" >> ${CONFIG_FILE} echo "color_title_border=${SELBG} 60" >> ${CONFIG_FILE} else #bg is light TXTCOLOR_NORM="#333333" echo "color_norm_fg=${TXTCOLOR_NORM} 100" >> ${CONFIG_FILE} echo "color_sel_fg=${TXTCOLOR} 100" >> ${CONFIG_FILE} echo "color_title_fg=${TXTCOLOR} 90" >> ${CONFIG_FILE} SELBG=$(pastel darken 0.1 ${WINCLR}|pastel format hex) echo "color_sel_bg=${SELBG} 80" >> ${CONFIG_FILE} echo "color_title_bg=${SELBG} 90" >> ${CONFIG_FILE} echo "color_title_border=${SELBG} 90" >> ${CONFIG_FILE} fi echo "color_menu_bg=${WINCLR} 90" >> ${CONFIG_FILE} echo "color_menu_border=${CLR} 60" >> ${CONFIG_FILE} echo "menu_border=1" >> ${CONFIG_FILE} echo "menu_radius=0" >> ${CONFIG_FILE} echo "color_sep_fg=${CLR} 10" >> ${CONFIG_FILE} echo "font=${FONT} 10" >> ${CONFIG_FILE} echo "sub_spacing=3" >> ${CONFIG_FILE} echo "menu_margin_x=3" >> ${CONFIG_FILE} echo "menu_margin_y=3" >> ${CONFIG_FILE} #notify-send.sh "CFG" "$(cat $CONFIG_FILE)" case "$LANG" in pl*) CUSTOM_COMMANDS_SEP="Własne polecenia" EDIT_CUSTOMCOMMANDS=" Edytuj menu" ;; es*) CUSTOM_COMMANDS_SEP="Custom commands" EDIT_CUSTOMCOMMANDS=" Edit menu" ;; *) CUSTOM_COMMANDS_SEP="Custom commands" EDIT_CUSTOMCOMMANDS=" Edit menu" ;; esac cat < ${MENU_ITEMS} ${CUSTOMCOMMANDS} EOF jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null } netdevice () { CFGFILE="$HOME/.config/conky/Network_mbcolor.conkyrc" rm /tmp/xx* cd /tmp csplit -s ${CFGFILE} /conky.text/ #IFACE=$(ip route get 8.8.8.8 | awk -- '{printf $5}') # thanks @sng :) IFACE=$(ip route get 8.8.8.8 | awk '{for(i=1; i> /tmp/xx00 conky.text = [[ \${color}$NETWORK \${color}$DEVICE \${alignr}\${color0}$IFACE \${color}$IP \${alignr}\${color0}\${addr $IFACE} \${color}$DOWNLOAD \$color0\${downspeed $IFACE} \${alignr}\${color0}\${upspeed $IFACE}\${color} Upload \${color2}\${downspeedgraph $IFACE 30,100 -t} \${alignr} \${upspeedgraph $IFACE 30,100 -t} \${color}Total Down \${color0}\${totaldown $IFACE} \${alignr}\${color0}\${totalup $IFACE}\${color} Total Up \${color0}\${hr} \${execi 30 netstat -ept | grep ESTAB | awk '{print \$9}' | cut -d/ -f2 | sort | uniq -c | sort -nr} ]]; EOF cat /tmp/xx00 > ${CFGFILE} } settheme () { source "$COLORIZERDIR"/conky/themes/${1} win_bgcolor ${own_window_colour} $2 default_color ${default_color} $2 color0 ${color0} $2 color1 ${color1} $2 color2 ${color2} $2 } settheme_all () { source "$COLORIZERDIR"/conky/themes/${1} win_bgcolor_all ${own_window_colour} default_color_all ${default_color} color0_all ${color0} color1_all ${color1} color2_all ${color2} } 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 ${themename} do wszystkich Conky?\n" NO="Nie, dzieki" YES="Tak, zastosuj do wszystkich" ;; es*) TITLE="Colorscheme ${themename} saved!" DESC="Do you want to apply ${themename} color scheme to all Conky?\n" NO="No,thanks" YES="Yes, apply to all" ;; *) TITLE="Colorscheme ${themename} saved!" DESC="Do you want to apply ${themename} 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 ${themename} już istnieje.\nNadpisać?" CANCEL="Anuluj" YES="Tak, nadpisz" ;; es*) TITLE="Overwrite?" EXIST="Colorscheme ${themename} exist.\nOverwrite?" CANCEL="Cancel" YES="Yes, overwrite" ;; *) TITLE="Overwrite?" EXIST="Colorscheme ${themename} 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 () { # try to convert from old syntax to new by convert.lua script #notify-send.sh "Convert func" "${1}" kill ${1} convert.lua ${1} sleep 1 startone ${1} } case "$1" in transparent_all) transparent_all "$2";; transparent) transparent "$2" "$3";; win_bgcolor_all) win_bgcolor_all "$2";; win_bgcolor) win_bgcolor "$2" "$3";; draw_borders_all) draw_borders_all "$2" ;; draw_borders) draw_borders "$2" "$3";; stippled_borders_all) stippled_borders_all "$2" ;; stippled_borders) stippled_borders "$2" "$3";; default_color_all) default_color_all "$2";; color0_all) color0_all "$2";; color1_all) color1_all "$2";; color2_all) color2_all "$2";; default_color) default_color "$2" "$3";; color0) color0 "$2" "$3";; color1) color1 "$2" "$3";; color2) color2 "$2" "$3";; basefont_inc_all) basefont_inc_all;; basefont_dec_all) basefont_dec_all;; basefont_inc) basefont_inc "$2";; basefont_dec) basefont_dec "$2";; setfont_all) setfont_all;; serfont) setfont;; shades_all) shades_all "$2";; shades) shades "$2" "$3";; logosize) logosize "$2";; single) pipemenu "$2";; pos) pos "$2" "$3";; gap_x) gap_x "$2" "$3";; gap_y) gap_y "$2" "$3";; setpos) setpos "$2";; startone) startone "$2";; startall) startall;; kill) kill "$2";; restartone) restartone "$2";; contextmenu) contextmenu;; cmdmenu) cmdmenu;; makemoveableall) makemoveableall;; saveposall) saveposall;; resetcolorsall) resetcolorsall ;; resetcolorsone) resetcolorsone "$2";; settheme) settheme "$2" "$3";; settheme_all) settheme_all "$2";; newcolorscheme) newcolorscheme "$2";; netdevice) netdevice ;; convert_from_old) convert_from_old "$2";; *) : ;; esac