From 9ea2e5734941b075557ec4dd857b147073b65208 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Thu, 5 Jan 2023 19:28:22 +0100 Subject: [PATCH] upd --- bin/colorizer | 2 +- bin/colorizer-conky | 37 ++++++++++++++++++++++++++++--------- bin/colorizer-ob | 4 ++-- bin/conkyctl | 20 +++++++++++++++----- bin/obtctl | 21 ++++++++++++++++++++- 5 files changed, 66 insertions(+), 18 deletions(-) diff --git a/bin/colorizer b/bin/colorizer index d7ef851..860b539 100755 --- a/bin/colorizer +++ b/bin/colorizer @@ -288,7 +288,7 @@ out+=("^sep()") out+=(" $COLORIZE,^pipe(randomizer c)") out+=("^sep($MODULES)") out+=("$OBTHEME,^pipe(colorizer-ob)") -out+=("Conky,^pipe(colorizer-conky)") +out+=("Conky Manager,^pipe(colorizer-conky)") out+=("$MENUPANELS,^pipe(colorizer-menus)") #out+=("TINT2,^pipe(colorizer-tint2)") #out+=("Systray HW monitor,^pipe(colorizer-phwmon)") diff --git a/bin/colorizer-conky b/bin/colorizer-conky index efa6682..a4cf703 100755 --- a/bin/colorizer-conky +++ b/bin/colorizer-conky @@ -30,7 +30,7 @@ fi case "$LANG" in pl*) - COLORIZECONKY="Conky Colorizer" + COLORIZECONKY="Conky Manager" NO_CONKY_RUNNING="Brak uruchomionych Conky" RUN_CONKY_SESSION="Uruchom zapisaną sesję" MOVEABLEALL="Ustaw wszystkie (przeciągaj)..." @@ -70,7 +70,7 @@ case "$LANG" in AREYOUSURE="Czy aby napewno?" ;; *) - COLORIZECONKY="Colorize Conky" + COLORIZECONKY="Conky Manager" NO_CONKY_RUNNING="No Conky running" RUN_CONKY_SESSION="Run Conky session" MOVEABLEALL="Make moveable all..." @@ -153,15 +153,21 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then #done < <(pgrep -af "conky.*mbcolor") # array with running conkies - only filenames with full path - readarray -t running < <(pgrep -af "conky -c.*mbcolor" | cut -d' ' -f4) + readarray -t running < <(pgrep -af "conky -c " | cut -d' ' -f4) #array with all supported conkies - for i in "$CONKYDIR"/*_mbcolor*; do + for i in "$CONKYDIR"/*.con* "$CONKYDIR"/**/*.con*; do + if [[ "$i" == *mbcolor* ]];then supported+=("$i") + else + unsupported+=("$i") + fi done #array with not started conkies - notstarted=($(echo ${running[@]} ${supported[@]} | tr ' ' '\n' | sort | uniq -u)) + notstarted=($(echo ${running[@]} ${supported[@]} ${unsupported[@]} ${unsupported[@]}| tr ' ' '\n' | sort | uniq -u)) + notstarted_unsupported=($(echo ${running[@]} ${supported[@]} ${supported[@]} ${unsupported[@]} | tr ' ' '\n' | sort | uniq -u)) + if [[ ${#running[@]} > 0 ]];then out+=("^sep($RUNNING_CONKIES)") @@ -173,7 +179,8 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then done out+=("^sep()") out+=("$STOP_ALL (${#running[@]}),conky_toggle;sleep .5;$me") - if [[ ${#notstarted[@]} > 0 ]];then + fi + if [[ ${#notstarted[@]} > 0 ]];then out+=("^sep($MORECONKIES)") out+=("^sep($CLICKTOSTART)") for c in ${notstarted[@]};do @@ -181,13 +188,25 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then name=${filename%%_mb*} title=${name//_/ } out+=("${title^},conkyctl startone ${c};$me") - done + done if [[ ${#notstarted[@]} > 1 ]];then out+=("^sep()") out+=("$STARTALL (${#notstarted[@]}),conkyctl startall;$me") - fi - fi + fi fi + if [[ ${#notstarted_unsupported[@]} > 0 ]];then + out+=("^sep()") + out+=("UNSUPPORTED,^checkout(unsup)") + out2+=("^tag(unsup)") + out2+=("^sep(UNSUPPORTED)") + for c in ${notstarted_unsupported[@]};do + filename=${c##*/} + name=${filename%%_mb*} + title=${name//_/ } + out2+=("${title^},conkyctl startone ${c};$me") + done + fi + #GLOBAL START out+=("^sep($GLOBALSETTINGS)") diff --git a/bin/colorizer-ob b/bin/colorizer-ob index ddb681a..922417f 100755 --- a/bin/colorizer-ob +++ b/bin/colorizer-ob @@ -193,12 +193,12 @@ out+=("^sep($GENERATEFROMWP)") out+=("$LIGHTBG,w2theme ob light;$me") out+=("$DARKBG,w2theme ob dark;$me") out+=("^sep($TITLEBAR)") -out+=(" $ACTIVE_BG,^pipe(mbclr '$ABG' obtctl clractivebg '${ACTIVE_BG}' '$me')") +out+=(" $ACTIVE_BG,^pipe(mbclr '$ABG' obtctl clractivebg_only '${ACTIVE_BG}' '$me')") [[ ! -z "$ABGTO" ]] && out+=(" $ACTIVE_BG_TO,^pipe(mbclr '$ABGTO' obtctl clractivebgto '${ACTIVE_BG_TO}' '$me')") out+=(" AbCd $TITLEBAR_TEXT,^checkout(titletext)") out+=("^sep()") -out+=(" $INACTIVE_BG,^pipe(mbclr '$NBG' obtctl clrnormalbg '${INACTIVE_BG}' '$me')") +out+=(" $INACTIVE_BG,^pipe(mbclr '$NBG' obtctl clrnormalbg_only '${INACTIVE_BG}' '$me')") [[ ! -z "$ABGTO" ]] && out+=(" $INACTIVE_BG_TO,^pipe(mbclr '$NBGTO' obtctl clrnormalbgto '${INACTIVE_BG_TO}' '$me')") out+=("^sep()") diff --git a/bin/conkyctl b/bin/conkyctl index 5e5d584..86657a5 100755 --- a/bin/conkyctl +++ b/bin/conkyctl @@ -18,7 +18,9 @@ update_session () { while read -r pid b c confpath do echo "$b $c ${confpath} & sleep .5" >> ${SESSIONFILE} - done < <(pgrep -af "conky .*mbcolor") + done < <(pgrep -af "conky -c ") + # Remove duplicates + awk -i inplace '!seen[$0]++' ${SESSIONFILE} } transparent_all () { @@ -35,6 +37,7 @@ win_bgcolor_all () { 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 () { @@ -234,7 +237,7 @@ fi } startone () { - conky -c "${1}" + conky -c "${1}" & update_session } startall () { @@ -242,7 +245,7 @@ startall () { if pgrep -af "conky .*${i}" >/dev/null; then : else - conky -c "${i}" + conky -c "${i}" & fi done update_session @@ -253,7 +256,7 @@ kill () { } restartone () { kill ${1} - startone ${1} + startone ${1} } makemoveableall () { wmctrl -k on @@ -554,7 +557,14 @@ single () { [[ "$WINTRANS" == false ]] && BG="bgcolor='$WINCLR'" || BG="" + if [[ "$filename" == *"mbcolor"* ]];then out+=("^sep(Conky: [ ${title^} ])") + else + out+=("^sep(Conky: [ ${title^} ]") + out+=("^sep( unsupported!!! )") + + fi + out+=(" $POSITION,^checkout(position)") if [[ "$1" =~ "etwork_mbcolor" ]]; then out+=("$NOT_WORKING,conkyctl netdevice") @@ -819,7 +829,7 @@ contextmenu () { out+=("^sep()") out+=("$EDIT_CUSTOMCOMMANDS,touch ${CONKYDIR}/menuscripts/${name}.csv;sleep 1;xdg-open ${CONKYDIR}/menuscripts/${name}.csv") out+=("^sep()") - out+=(" ⮜⮜⮜ Colorizer Conky,colorizer-conky -s") + out+=(" ⮜⮜⮜ Conky Manager (Colorizer),colorizer-conky -s") if [[ "$CONKYCFG" =~ "mount_points" ]]; then out+=("^sep($MOUNTPOINTS)") diff --git a/bin/obtctl b/bin/obtctl index 33c4962..6acb9ca 100755 --- a/bin/obtctl +++ b/bin/obtctl @@ -238,7 +238,20 @@ activehandle () { ;; esac } - +clractivebg_only () { + sd "^window.active.title.bg.color:.*$" "window.active.title.bg.color: ${1}" ${THEMERC} + # calculate color for title.fg and buttons + TITLE_FG=$(pastel textcolor ${1}|pastel format hex) + if [[ "${TITLE_FG}" == *"ffffff"* ]];then + TITLE_FG="#EEEEEE" + else + TITLE_FG="#111111" + fi + sd "\.active.label.text.color:.*$" ".active.label.text.color: ${TITLE_FG}" ${THEMERC} + + # Button colors + activebuttonscolors "${TITLE_FG}" +} clractivebg () { colorTo=$(pastel darken 0.1 "${1}"|pastel format hex) #activehandle? @@ -275,6 +288,10 @@ clractivebg () { } +clrnormalbg_only () { + sd "^window.inactive.title.bg.color:.*$" "window.inactive.title.bg.color: ${1}" ${THEMERC} +} + clrnormalbg () { colorTo=$(pastel darken 0.1 "${1}"|pastel format hex) #normalhandle? @@ -532,8 +549,10 @@ case "$1" in random_gradient) random_gradient;; activegradient) activegradient "$2" "$3";; activehandle) activehandle "$2";; + clractivebg_only) clractivebg_only "$2";; #ADVANCED - do not calculate colorTo clractivebg) clractivebg "$2";; clractivebgto) clractivebgto "$2";; + clrnormalbg_only) clrnormalbg_only "$2";; clrnormalbg) clrnormalbg "$2";; clrnormalbgto) clrnormalbgto "$2";; activetextcolor) activetextcolor "$2";;