mabox-colorizer/bin/conkyctl

1396 lines
48 KiB
Plaintext
Raw Normal View History

2022-05-15 03:25:01 +02:00
#!/bin/bash
#
2022-12-19 22:22:23 +01:00
# conkyctl - script to handle various Conky operations in Mabox
2023-05-09 14:14:23 +02:00
CONKYDIR="$HOME"/.config/conky
2022-05-15 03:25:01 +02:00
BASECONKY="$CONKYDIR/sysinfo_mbcolor.conkyrc"
SESSIONFILE="$CONKYDIR/conky-sessionfile"
2022-12-03 16:23:34 +01:00
COLORIZERDIR="$HOME/.config/colorizer"
CONKYTHEMEDIR="$COLORIZERDIR/conky/themes"
2022-12-19 22:22:23 +01:00
2022-12-03 16:23:34 +01:00
if [ ! -d "$CONKYTHEMEDIR" ];then
mkdir -p "$CONKYTHEMEDIR"
rsync -a /usr/share/mabox-colorizer/themes/conky/* ${CONKYTHEMEDIR}/
fi
2022-05-15 03:25:01 +02:00
update_session () {
2022-09-21 00:27:41 +02:00
sleep 1
2022-05-15 03:25:01 +02:00
:> "${SESSIONFILE}"
while read -r pid b c confpath
do
echo "$b $c ${confpath} & sleep .5" >> ${SESSIONFILE}
2023-08-20 09:07:52 +02:00
done < <(pgrep -u $USER -af "conky -c ")
2023-01-05 19:28:22 +01:00
# Remove duplicates
awk -i inplace '!seen[$0]++' ${SESSIONFILE}
2022-05-15 03:25:01 +02:00
}
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
2022-08-15 01:42:52 +02:00
sd "own_window_transparent.*$" "own_window_transparent = true," ${CONKYDIR}/logo_mbcolor.conkyrc
2022-05-15 03:25:01 +02:00
}
win_bgcolor () {
sd "own_window_colour .*=.*$" "own_window_colour = '${1}'," ${2}
sd "own_window_transparent.*$" "own_window_transparent = false," ${2}
2023-01-05 19:28:22 +01:00
#notify-send.sh "${2}" aaa
2022-12-19 22:22:23 +01:00
2022-05-15 03:25:01 +02:00
}
draw_borders_all () {
sd "draw_borders.*$" "draw_borders = ${1}," ${CONKYDIR}/*mbcolor.conkyrc
2022-09-26 10:02:47 +02:00
sd "draw_borders.*$" "draw_borders = false," ${CONKYDIR}/logo_mbcolor.conkyrc
2022-05-15 03:25:01 +02:00
}
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
2022-09-26 10:02:47 +02:00
sd "draw_borders.*$" "draw_borders = false," ${CONKYDIR}/logo_mbcolor.conkyrc
2022-05-15 03:25:01 +02:00
}
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}
}
2022-09-19 20:59:26 +02:00
2022-05-15 03:25:01 +02:00
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}
}
2023-08-20 09:07:52 +02:00
basefont_family () {
read FONTDEF <<< "$(grep "font .*=.*,$" ${1} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
sd "font .*=.*,$" "font = '${2}:size=${FONTSIZE}'," ${1}
}
basefont_family_all () {
read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
sd "font .*=.*,$" "font = '${1}:size=${FONTSIZE}'," ${CONKYDIR}/*mbcolor.conkyrc
}
basefont_size () {
read FONTDEF <<< "$(grep "font .*=.*,$" ${1} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
sd "font .*=.*,$" "font = '${FONT}:size=${2}'," ${1}
}
basefont_size_all () {
read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
sd "font .*=.*,$" "font = '${FONT}:size=${1}'," ${CONKYDIR}/*mbcolor.conkyrc
}
2022-05-15 03:25:01 +02:00
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
}
2022-05-26 22:39:07 +02:00
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
}
2022-05-15 03:25:01 +02:00
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)
2023-01-07 23:10:48 +01:00
sd "gap_x .*=.*," "gap_x = ${def_x}," ${2}
sd "gap_y .*=.*," "gap_y = ${def_y}," ${2}
2022-05-15 03:25:01 +02:00
;;
top_middle|bottom_middle)
2023-01-07 23:10:48 +01:00
sd "gap_x .*=.*," "gap_x = 0," ${2}
sd "gap_y .*=.*," "gap_y = ${def_y}," ${2}
2022-05-15 03:25:01 +02:00
;;
middle_left|middle_right)
2023-01-07 23:10:48 +01:00
sd "gap_x .*=.*," "gap_x = ${def_x}," ${2}
sd "gap_y .*=.*," "gap_y = 0," ${2}
2022-05-15 03:25:01 +02:00
;;
middle_middle)
2023-01-07 23:10:48 +01:00
sd "gap_x .*=.*," "gap_x = 0," ${2}
sd "gap_y .*=.*," "gap_y = 0," ${2}
2022-05-15 03:25:01 +02:00
;;
esac
}
gap_x () {
2023-01-07 23:10:48 +01:00
sd "gap_x .*=.*," "gap_x = ${1}," ${2}
2022-05-15 03:25:01 +02:00
}
gap_y () {
2023-01-07 23:10:48 +01:00
sd "gap_y .*=.*," "gap_y = ${1}," ${2}
2022-05-15 03:25:01 +02:00
}
2022-08-20 20:51:56 +02:00
setpos () {
filename=${1##*/}
name=${filename%%_mb*}
title=${name//_/ }
case "$LANG" in
pl*)
2022-08-27 16:36:46 +02:00
SUMM="Nowa pozycja dla Conky: ${title^}"
BODY="\nNarysuj mały prostokąt na ekranie aby wyznaczyć nową pozycję...\n <i>(ESC lub prawy klik anuluje</i>"
ABORTED_SUMM="Anulowano!"
ABORTED_BODY="\n...operacja anulowana"
2022-08-20 20:51:56 +02:00
;;
2022-12-03 16:23:34 +01:00
es*)
SUMM="Mark new position for ${title^} Conky"
BODY="\nDraw small rectangle to mark new position...\n <i>(ESC or right click to abort)</i>"
ABORTED_SUMM="Aborted!"
ABORTED_BODY="\n... operation aborted!"
;;
2022-08-20 20:51:56 +02:00
*)
SUMM="Mark new position for ${title^} Conky"
2022-08-27 16:36:46 +02:00
BODY="\nDraw small rectangle to mark new position...\n <i>(ESC or right click to abort)</i>"
ABORTED_SUMM="Aborted!"
ABORTED_BODY="\n... operation aborted!"
;;
2022-08-20 20:51:56 +02:00
esac
wmctrl -k on
2022-08-27 16:36:46 +02:00
notify-send.sh -i mbcc --replace-file=/tmp/conkyctlfile "${SUMM}" "${BODY}"
2022-08-20 20:51:56 +02:00
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
2022-08-27 16:36:46 +02:00
notify-send.sh -i mbcc --replace-file=/tmp/conkyctlfile "${ABORTED_SUMM}" "${ABORTED_BODY}"
2022-08-20 20:51:56 +02:00
else
pos top_left ${1}
2022-12-03 16:23:34 +01:00
# improve conky margin calculation here: gap = border_width + border_inner_margin + border_outer_margin
((X=X+17))
((Y=Y+17))
2022-08-20 20:51:56 +02:00
gap_x ${X} ${1}
gap_y ${Y} ${1}
2022-08-27 16:36:46 +02:00
case "$LANG" in
pl*)
THNX_SUMM="Dziękuję!"
THNX_BODY="Zapisano nową pozycję ${title^} \n\tX: <b>$X</b>\n\tY: <b>$Y</b>"
;;
2022-12-03 16:23:34 +01:00
es*)
THNX_SUMM="Thank you!"
THNX_BODY="New position of ${title^} saved! \n\tX: <b>$X</b>\n\tY: <b>$Y</b>"
;;
2022-08-27 16:36:46 +02:00
*)
THNX_SUMM="Thank you!"
THNX_BODY="New position of ${title^} saved! \n\tX: <b>$X</b>\n\tY: <b>$Y</b>"
;;
esac
notify-send.sh -i mbcc --replace-file=/tmp/conkyctlfile "${THNX_SUMM}" "${THNX_BODY}"
2022-08-20 20:51:56 +02:00
#wmctrl -k off
fi
}
2022-05-15 03:25:01 +02:00
startone () {
2023-01-05 19:28:22 +01:00
conky -c "${1}" &
2022-05-15 03:25:01 +02:00
update_session
}
startall () {
for i in "$CONKYDIR"/*_mbcolor*; do
2023-08-20 09:07:52 +02:00
if pgrep -u $USER -af "conky .*${i}" >/dev/null; then
2022-05-15 03:25:01 +02:00
:
else
2023-01-05 19:28:22 +01:00
conky -c "${i}" &
2022-05-15 03:25:01 +02:00
fi
done
update_session
}
kill () {
pkill -f "conky .*${1}"
update_session
}
2022-09-19 20:59:26 +02:00
restartone () {
kill ${1}
2023-01-05 19:28:22 +01:00
startone ${1}
2022-09-19 20:59:26 +02:00
}
2024-01-25 13:01:29 +01:00
toggleone () {
if pgrep -u $USER -af "conky .*${1}" >/dev/null; then
kill "${1}"
else
CCFG=$(ls ~/.config/conky/${1}*.conkyrc)
#notify-send.sh "Conky" "$CCFG"
if test -f "$CCFG";
then
startone "$CCFG"
fi
#conky -c "${i}" &
fi
}
2022-10-27 01:10:17 +02:00
makemoveableall () {
2022-12-03 16:23:34 +01:00
wmctrl -k on
2022-10-27 01:10:17 +02:00
sd "own_window_type.*$" "own_window_type = 'normal'," ${CONKYDIR}/*mbcolor.conkyrc
2022-12-03 16:23:34 +01:00
case "$LANG" in
pl*)
TITLE="Przenieś Conky dokąd chcesz"
2022-12-30 08:38:43 +01:00
DESC="Możesz teraz przesuwać wszystkie Conky.\nPrzytrzymaj wciśnięty klawisz <b>Alt</b> i przesuń każde Conky gdzie chcesz\n "
2022-12-17 12:12:52 +01:00
VB="<span foreground='red'>To prawdopodobnie nie zadziała w środowiskach wirtualnych</span>"
2022-12-03 16:23:34 +01:00
CANCEL="Anuluj"
SAVE="Zapisz nowe pozycje"
;;
es*)
TITLE="Move Conkies where you want"
2022-12-30 08:38:43 +01:00
DESC="Move Conkies to desired locations now...\n Hold <b>Alt</b> and drag Conkies one by one.\n"
2022-12-17 12:12:52 +01:00
VB="<span foreground='red'>It will probably not work in Virtual environments</span>"
2022-12-03 16:23:34 +01:00
CANCEL="Cancel"
SAVE="Save new positions"
;;
*)
TITLE="Move Conkies where you want"
2022-12-30 08:38:43 +01:00
DESC="Move Conkies to desired locations now...\n Hold <b>Alt</b> and drag Conkies one by one.\n"
2022-12-17 12:12:52 +01:00
VB="<span foreground='red'>It will probably not work in Virtual environments</span>"
2022-12-03 16:23:34 +01:00
CANCEL="Cancel"
SAVE="Save new positions"
;;
esac
2022-12-17 12:12:52 +01:00
TYPE=$(cat /sys/class/dmi/id/chassis_type)
if [ "$TYPE" != "1" ];then
VB=""
fi
2022-10-27 01:10:17 +02:00
cmd=(
yad --center --borders=20
2022-12-03 16:23:34 +01:00
--title="$TITLE"
2022-12-17 12:12:52 +01:00
--text="$DESC\n\n${VB}"
2022-12-03 16:23:34 +01:00
--button="$CANCEL":1
--button="$SAVE":0
2022-10-27 01:10:17 +02:00
)
"${cmd[@]}"
exval=$?
2022-12-03 16:23:34 +01:00
#notify-send.sh -t 10000 "Exval" "${exval}"
2022-10-27 01:10:17 +02:00
case $exval in
1) makedesktoptypeall;;
0) saveposall;;
252) makedesktoptypeall;;
esac
2022-12-03 16:23:34 +01:00
2022-10-27 01:10:17 +02:00
}
saveposall () {
# save new positions here
2022-12-03 16:23:34 +01:00
while read -r WIN_ID b c X Y rest
do
conffile=$(xprop -id $WIN_ID |grep WM_COMMAND |cut -d'"' -f6)
2023-01-07 23:10:48 +01:00
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
2022-12-03 16:23:34 +01:00
done < <(wmctrl -lpG | grep '1 0 ')
2022-10-27 01:10:17 +02:00
makedesktoptypeall
}
makedesktoptypeall () {
sd "own_window_type.*$" "own_window_type = 'desktop'," ${CONKYDIR}/*mbcolor.conkyrc
2022-09-19 20:59:26 +02:00
}
2022-10-27 01:10:17 +02:00
resetcolorsall () {
2022-10-15 12:19:57 +02:00
transparent_all false
win_bgcolor_all '#142c2c'
2022-10-27 01:10:17 +02:00
#draw_borders_all true
#stippled_borders_all 0
2022-10-15 12:19:57 +02:00
default_color_all '#309552'
color0_all '#accdc7'
color1_all '#61c4bc'
2022-11-21 12:31:17 +01:00
color2_all '#E8CB2D'
2022-10-27 01:10:17 +02:00
}
resetcolorsone () {
transparent false "${1}"
win_bgcolor '#142c2c' "${1}"
default_color '#309552' "${1}"
color0 '#accdc7' "${1}"
color1 '#61c4bc' "${1}"
2022-11-21 12:31:17 +01:00
color2 '#E8CB2D' "${1}"
2022-10-15 12:19:57 +02:00
}
2022-05-15 03:25:01 +02:00
2022-10-05 19:44:22 +02:00
languages () {
case "$LANG" in
2022-08-20 20:51:56 +02:00
pl*)
2023-01-07 23:10:48 +01:00
UNSUPPORTED="częściowo wspierane!!!"
2023-01-08 01:22:16 +01:00
OLD_SYNTAX_DETECTED="<b><span bgcolor='yellow' fgcolor='black'> stara składnia! </span></b> wykryta..."
2023-01-07 23:10:48 +01:00
CONVERT_OLD="Czy spróbować skonwertować?"
CONVERT_OLD_TRY="Tak, spróbuj konwertować"
2022-08-20 20:51:56 +02:00
POSITION="Pozycja"
2022-12-03 16:23:34 +01:00
MAKEMOVEABLE="Ustaw wszystkie (<i>poprzez przeciąganie</i>)..."
2022-08-20 20:51:56 +02:00
MARKNEWPOS="Nowa pozycja (<i>zaznacz na ekranie</i>)..."
ALIGNMENT="Wyrównanie"
2022-10-05 19:44:22 +02:00
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"
2022-08-20 20:51:56 +02:00
HORIZONTAL_GAP="Odstęp poziomy"
VERTICAL_GAP="Odstęp pionowy"
COLORS="Kolory"
2022-08-27 16:36:46 +02:00
DEFCOLOR="Domyślny kolor <small>(tekst i ramka)</small>"
COLOR_0="Kolor 0 <small>(tekst2)</small>"
COLOR_1="Kolor 1 <small>(większy tekst)</small>"
COLOR_2="Kolor 2 <small>(pasek/graf)</small>"
2022-08-20 20:51:56 +02:00
BACKGROUND="Kolor tła"
2022-12-08 17:48:55 +01:00
COLORSCHEME="Motywy kolorów"
2023-09-08 12:34:28 +02:00
SYSTEM_SCHEMES="Systemowe"
YOUR_SCHEMES="Moje motywy"
2022-12-03 16:23:34 +01:00
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..."
2023-09-08 13:17:36 +02:00
SAVE_CURRSCHEME="Zapisz aktualną kolorystykę jako..."
2024-02-22 14:24:51 +01:00
MONOCHROMATIC="Monochromatyczny"
CHOOSE_AND_PICK="Wybierz wariant i pobierz kolor..."
2023-09-06 16:13:11 +02:00
LIGHTBG="Jasne tło"
DARKBG="Ciemne tło"
2022-10-27 01:10:17 +02:00
RESETCOLORS="Przywróć domyślne kolory"
GENFROMWP="Generuj z kolorów tapety"
2022-12-03 16:23:34 +01:00
TRANSPARENT="Przezroczyste tło?"
2022-08-20 20:51:56 +02:00
YES="Tak"
NO="Nie"
FONTS="Czcionka"
SELECTFONT="Wybierz czcionkę..."
2023-08-20 09:07:52 +02:00
FONTFAMILY_LBL="czcionka"
2023-08-30 14:00:09 +02:00
_EDIT_FAVFONTS="Edytuj ulubione czcionki"
2023-08-20 09:07:52 +02:00
FONTSIZE_LBL="rozmiar czcionki"
INCREASE="Powiększ do"
DECREASE="Pomniejsz do"
2022-08-20 20:51:56 +02:00
OLINE="Obrys"
SHADOW="Cień"
DRAW="Rysuj"
BORDERS="Obramowanie"
2023-05-09 14:14:23 +02:00
EDIT="Edytuj plik Conky"
2022-10-27 01:10:17 +02:00
RELOAD="Przeładuj"
2022-08-20 20:51:56 +02:00
KILL="Zabij"
LOGOSIZE="Rozmiar logo"
SMALL="Małe"
NORMAL="Normalne"
BIG="Duże"
2022-08-27 16:36:46 +02:00
STIPPLED_BORDERS="Nakrapiane"
SOLID_LINE="linia ciągła"
2022-10-17 14:48:35 +02:00
NOT_WORKING="Nie działa? Naprawmy to :)"
2022-12-03 16:23:34 +01:00
MOUNTPOINTS="Dyski (punkty montowania)"
;;
es*)
2023-01-07 23:10:48 +01:00
UNSUPPORTED="partially supported!!!"
2023-01-08 01:22:16 +01:00
OLD_SYNTAX_DETECTED="<b><span bgcolor='yellow' fgcolor='black'> old syntax!!! </span></b> detected..."
2023-01-07 23:10:48 +01:00
CONVERT_OLD="Try to convert to new syntax?"
CONVERT_OLD_TRY="Yes, try to convert"
2022-12-03 16:23:34 +01:00
POSITION="Position"
MAKEMOVEABLE="Make moveable all..."
MARKNEWPOS="New position (<i>mark on the screen</i>)..."
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 <small>(text and border)</small>"
COLOR_0="Color 0 <small>(text2)</small>"
COLOR_1="Color 1 <small>(bigger text)</small>"
COLOR_2="Color 2 <small>(bars/graphs)</small>"
BACKGROUND="Background color"
2022-12-08 17:48:55 +01:00
COLORSCHEME="Color schemes"
2023-09-08 12:34:28 +02:00
SYSTEM_SCHEMES="System colorschemes"
YOUR_SCHEMES="My colorschemes"
2022-12-03 16:23:34 +01:00
OPENTHEMEDIR="Open schemes dir"
2022-12-08 17:48:55 +01:00
APPLY_THEME="Apply scheme..."
2022-12-03 16:23:34 +01:00
APPLY_TO_ONE="Apply to "
APPLY_TO_ALL="Apply to All"
NEWTHEME="New Color scheme..."
SAVENEWTHEME="from current colors..."
2023-09-08 13:17:36 +02:00
SAVE_CURRSCHEME="Save current colors as..."
2024-02-22 14:24:51 +01:00
MONOCHROMATIC="Monochromatic"
CHOOSE_AND_PICK="Choose variant and pick color..."
2023-09-06 16:13:11 +02:00
LIGHTBG="Light Background"
DARKBG="Dark Background"
2022-12-03 16:23:34 +01:00
RESETCOLORS="Restore default colors"
GENFROMWP="Generate from wallpaper"
TRANSPARENT="Transparent background?"
YES="Yes"
NO="No"
FONTS="Font"
SELECTFONT="Select Font..."
2023-08-20 09:07:52 +02:00
FONTFAMILY_LBL="font family"
2023-08-30 14:00:09 +02:00
_EDIT_FAVFONTS="Edit favorite fonts list"
2023-08-20 09:07:52 +02:00
FONTSIZE_LBL="font size"
INCREASE="Increase to"
DECREASE="Decrease to"
2022-12-03 16:23:34 +01:00
OLINE="Outline"
SHADOW="Shadow"
DRAW="Draw"
BORDERS="Borders"
2023-05-09 14:14:23 +02:00
EDIT="Edit Conky file"
2022-12-03 16:23:34 +01:00
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)"
2022-08-20 20:51:56 +02:00
;;
*)
2023-01-07 23:10:48 +01:00
UNSUPPORTED="partially supported!!!"
2023-01-08 01:22:16 +01:00
OLD_SYNTAX_DETECTED="<b><span bgcolor='yellow' fgcolor='black'> old syntax!!! </span></b> detected..."
2023-01-07 23:10:48 +01:00
CONVERT_OLD="Try to convert to new syntax?"
CONVERT_OLD_TRY="Yes, try to convert"
2022-08-20 20:51:56 +02:00
POSITION="Position"
2022-12-03 16:23:34 +01:00
MAKEMOVEABLE="Make moveable all..."
2022-08-20 20:51:56 +02:00
MARKNEWPOS="New position (<i>mark on the screen</i>)..."
ALIGNMENT="Alignment"
2022-10-05 19:44:22 +02:00
TOPLEFT="TopLeft"
TOP="Top"
TOPRIGHT="TopRight"
LEFT="Left"
CENTER="Center"
RIGHT="Right"
BOTTOMLEFT="BottomLeft"
BOTTOM="Bottom"
BOTTOMRIGHT="BottomRight"
2022-08-20 20:51:56 +02:00
HORIZONTAL_GAP="Horizontal Gap"
VERTICAL_GAP="Vertical Gap"
COLORS="Colors"
2022-08-27 16:36:46 +02:00
DEFCOLOR="Default color <small>(text and border)</small>"
COLOR_0="Color 0 <small>(text2)</small>"
COLOR_1="Color 1 <small>(bigger text)</small>"
COLOR_2="Color 2 <small>(bars/graphs)</small>"
2022-08-20 20:51:56 +02:00
BACKGROUND="Background color"
2022-12-08 17:48:55 +01:00
COLORSCHEME="Color schemes"
2023-09-08 12:34:28 +02:00
SYSTEM_SCHEMES="System colorschemes"
YOUR_SCHEMES="My colorschemes"
2022-12-03 16:23:34 +01:00
OPENTHEMEDIR="Open schemes dir"
2022-12-08 17:48:55 +01:00
APPLY_THEME="Apply scheme..."
2022-12-03 16:23:34 +01:00
APPLY_TO_ONE="Apply to "
APPLY_TO_ALL="Apply to All"
NEWTHEME="New Color scheme..."
SAVENEWTHEME="from current colors..."
2023-09-08 13:17:36 +02:00
SAVE_CURRSCHEME="Save current colors as..."
2024-02-22 14:24:51 +01:00
MONOCHROMATIC="Monochromatic"
CHOOSE_AND_PICK="Choose variant and pick color..."
2023-09-06 16:13:11 +02:00
LIGHTBG="Light Background"
DARKBG="Dark Background"
2022-10-27 01:10:17 +02:00
RESETCOLORS="Restore default colors"
GENFROMWP="Generate from wallpaper"
2022-12-03 16:23:34 +01:00
TRANSPARENT="Transparent background?"
2022-08-20 20:51:56 +02:00
YES="Yes"
NO="No"
FONTS="Font"
SELECTFONT="Select Font..."
2023-08-20 09:07:52 +02:00
FONTFAMILY_LBL="font family"
2023-08-30 14:00:09 +02:00
_EDIT_FAVFONTS="Edit favorite fonts list"
2023-08-20 09:07:52 +02:00
FONTSIZE_LBL="font size"
INCREASE="Increase to"
DECREASE="Decrease to"
2022-08-20 20:51:56 +02:00
OLINE="Outline"
SHADOW="Shadow"
2022-12-03 16:23:34 +01:00
DRAW="Draw"
2022-08-20 20:51:56 +02:00
BORDERS="Borders"
2023-05-09 14:14:23 +02:00
EDIT="Edit Conky file"
2022-10-27 01:10:17 +02:00
RELOAD="Reload"
2022-08-20 20:51:56 +02:00
KILL="Kill"
LOGOSIZE="Logo size"
SMALL="Small"
NORMAL="Normal"
BIG="Big"
2022-08-27 16:36:46 +02:00
STIPPLED_BORDERS="Stippled borders"
SOLID_LINE="solid line"
2022-10-17 14:48:35 +02:00
NOT_WORKING="Not working? Try to fix"
2022-12-03 16:23:34 +01:00
MOUNTPOINTS="Discs (mount points)"
2022-08-20 20:51:56 +02:00
;;
2022-10-05 19:44:22 +02:00
esac
}
single () {
2023-01-07 23:10:48 +01:00
unset NOT_SUPPORTED OLD_SYNTAX
2023-09-08 12:34:28 +02:00
SYSSCHEMES="/usr/share/mabox-colorizer/colorschemes/conky.csv"
2023-09-11 18:59:49 +02:00
USERSCHEMES="$HOME/.config/colorizer/conky/c_userschemes.csv"
2023-09-08 12:34:28 +02:00
if [ ! -f "$USERSCHEMES" ]; then
mkdir -p "$HOME/.config/colorizer/conky/"
2023-09-11 18:59:49 +02:00
echo "WINCLR | CLR | CLR0 | CLR1 | CLR2 |WINTRANS|OUTLINE|SHADES | BORD | STIP |scheme_name" > "$USERSCHEMES"
2023-09-08 12:34:28 +02:00
fi
2023-09-06 16:13:11 +02:00
### Wallpaper colors
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"
2022-10-05 19:44:22 +02:00
languages
2022-06-03 19:43:56 +02:00
filename=${1##*/}
name=${filename%%_mb*}
title=${name//_/ }
2023-01-07 23:10:48 +01:00
grep -q "conky.text" "$1" && : || OLD_SYNTAX="true"
2022-10-15 12:19:57 +02:00
# breaks mbclr color picking from contextmenu, leave it as "colorizer-conky -s" for now
2022-10-05 19:44:22 +02:00
if [[ "$2" == "s" ]];then
2022-12-03 16:23:34 +01:00
me="none none"
2022-10-05 19:44:22 +02:00
else
2022-05-15 03:25:01 +02:00
me="colorizer-conky -s"
2022-10-05 19:44:22 +02:00
fi
2022-05-15 03:25:01 +02:00
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)"
2022-10-05 19:44:22 +02:00
[[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${WINCLR}"
2022-05-15 03:25:01 +02:00
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"
2022-05-15 03:25:01 +02:00
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=""
2023-01-05 19:28:22 +01:00
if [[ "$filename" == *"mbcolor"* ]];then
2022-08-27 16:36:46 +02:00
out+=("^sep(Conky: [ ${title^} ])")
2023-01-05 19:28:22 +01:00
else
2023-01-07 23:10:48 +01:00
NOT_SUPPORTED="true"
2023-01-05 19:28:22 +01:00
out+=("^sep(Conky: [ ${title^} ]")
2023-01-07 23:10:48 +01:00
out+=("^sep(<span bgcolor='red' fgcolor='white'> ${UNSUPPORTED} </span>)")
2023-01-05 19:28:22 +01:00
fi
2023-01-07 23:10:48 +01:00
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
2022-12-19 22:22:23 +01:00
out+=(" $POSITION,^checkout(position)")
2022-10-17 14:48:35 +02:00
if [[ "$1" =~ "etwork_mbcolor" ]]; then
out+=("$NOT_WORKING,conkyctl netdevice")
fi
2022-10-27 01:10:17 +02:00
#out+=("^sep($POSITION)")
out2+=("^tag(position)")
2022-08-20 20:51:56 +02:00
out2+=("^sep($POSITION)")
2023-05-09 14:14:23 +02:00
out2+=("<big></big> $MARKNEWPOS,conkyctl setpos ${1};$me")
2023-01-10 15:23:33 +01:00
#out2+=("^sep()")
out2+=("^sep($ALIGNMENT)")
2023-05-09 14:14:23 +02:00
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")
2023-01-10 15:23:33 +01:00
out2+=("$CENTER,conkyctl pos middle_middle ${1};$me")
2023-05-09 14:14:23 +02:00
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")
2023-01-10 15:23:33 +01:00
2023-05-29 21:16:10 +02:00
if [[ "$NOT_SUPPORTED" != "true" ]];then
2022-12-03 16:23:34 +01:00
out2+=("^sep()")
2022-12-17 12:12:52 +01:00
out2+=(" $MAKEMOVEABLE,conkyctl makemoveableall")
2023-01-07 23:10:48 +01:00
fi
2022-05-15 03:25:01 +02:00
2022-05-26 22:39:07 +02:00
if [[ "$1" =~ "logo_mbcolor" ]]; then
read LSIZE <<< "$(grep minimum_height ${1} | cut -d'=' -f2 | cut -d"," -f1)"
2022-08-20 20:51:56 +02:00
out+=("^sep($LOGOSIZE)")
out+=("$LOGOSIZE [ <b>$LSIZE</b> ],^checkout(logosize)")
2022-05-26 22:39:07 +02:00
out2+=("^tag(logosize)")
2022-08-20 20:51:56 +02:00
out2+=("^sep($LOGOSIZE)")
out2+=("$SMALL 64px,conkyctl logosize 64;$me")
out2+=("$NORMAL 128px,conkyctl logosize 128;$me")
out2+=("$BIG 256px,conkyctl logosize 256;$me")
2022-05-26 22:39:07 +02:00
fi
2022-09-19 20:59:26 +02:00
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"
;;
2022-12-03 16:23:34 +01:00
es*)
FONTSIZE="Font size"
QUOTE_FSIZE="Quote"
AUTHOR_FSIZE="Author"
EDIT_CONF="Edit conf file"
RELOAD="Reload"
;;
2022-09-19 20:59:26 +02:00
*)
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 [ <b>$quote_fontsize</b> ],^checkout(qsize)")
out+=("$AUTHOR_FSIZE [ <b>$author_fontsize</b> ],^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
2022-08-20 20:51:56 +02:00
out+=("^sep($COLORS)")
2023-09-08 13:17:36 +02:00
# COLOR SCHEMES
2023-09-11 18:59:49 +02:00
#if [ "$WINTRANS" == false ];then
2023-05-09 14:14:23 +02:00
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)")
2024-02-22 14:24:51 +01:00
out2+=("^sep($MONOCHROMATIC)")
out2+=("^sep(<i>$CHOOSE_AND_PICK</i>)")
out2+=("<big></big> $DARKBG...,conkyctl monoone pick dark ${1}")
out2+=("<big></big> $LIGHTBG...,conkyctl monoone pick light ${1}")
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}")
2023-05-09 14:14:23 +02:00
out2+=("^sep($APPLY_THEME)")
2023-09-08 12:34:28 +02:00
out2+=("^sep($SYSTEM_SCHEMES)")
n=1
2023-09-11 18:59:49 +02:00
while IFS="|" read -r winclr clr clr0 clr1 clr2 wintrans outline shades bord stip scheme_name
2023-09-08 12:34:28 +02:00
do
((n=n+1))
2023-09-11 18:59:49 +02:00
[[ "$wintrans" = true ]] && bga=1 || bga=100
out2+=("<tt>$(printf '%-20s' "${scheme_name}")</tt><big><span bgcolor='$winclr' bgalpha='${bga}%'> <span fgcolor='${clr}'></span> <span fgcolor='${clr0}'></span> <span fgcolor='${clr1}'></span> <span fgcolor='${clr2}'></span> </span></big>,conkyctl applyscheme sys $n ${1}")
2023-09-08 12:34:28 +02:00
done < <(tail -n +2 "$SYSSCHEMES")
out2+=("^sep($YOUR_SCHEMES)")
2023-05-09 14:14:23 +02:00
if [[ "$1" =~ "sysinfo_" ]]; then
2023-09-11 18:59:49 +02:00
#currcolors="${WINCLR}|${CLR}|${CLR0}|${CLR1}|${CLR2}|"
cursettings="${WINCLR}|${CLR}|${CLR0}|${CLR1}|${CLR2}|${WINTRANS}|${OUTLINE}|${SHADES}|${BORD}|${STIP}|"
out2+=("<big></big> $SAVE_CURRSCHEME,conkyctl savescheme '${cursettings}'" "^sep()")
2023-05-09 14:14:23 +02:00
fi
2023-09-08 12:34:28 +02:00
n=1
2023-09-11 18:59:49 +02:00
while IFS="|" read -r winclr clr clr0 clr1 clr2 wintrans outline shades bord stip scheme_name
2023-09-08 12:34:28 +02:00
do
((n=n+1))
2023-09-11 18:59:49 +02:00
[[ "$wintrans" = true ]] && bga=1 || bga=100
out2+=("<tt>$(printf '%-20s' "${scheme_name}")</tt><big><span bgcolor='$winclr' bgalpha='${bga}%'> <span fgcolor='${clr}'></span> <span fgcolor='${clr0}'></span> <span fgcolor='${clr1}'></span> <span fgcolor='${clr2}'></span> </span></big>,conkyctl applyscheme usr $n ${1}")
2023-09-08 13:17:36 +02:00
#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")
2023-09-08 12:34:28 +02:00
done < <(tail -n +2 "$USERSCHEMES")
2024-02-22 14:24:51 +01:00
2023-09-08 12:34:28 +02:00
2023-05-09 14:14:23 +02:00
out+=("^sep()")
2023-09-11 18:59:49 +02:00
#fi
2023-09-08 13:17:36 +02:00
if [[ "$WINCLR" != "#" ]];then
if [ "$WINTRANS" == false ];then
out+=("<small><span bgcolor='$WINCLR'> </span><span ${BG} fgcolor='$WINCLR'> AbCd </span></small> $BACKGROUND,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor '${BACKGROUND}' '$me' ${1})")
else
out+=("<small><span bgcolor='$WINCLR'> transparent </span></small> $BACKGROUND,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor '${BACKGROUND}' '$me' ${1})")
fi
fi
[[ "$WINTRANS" == false ]] && out+=("<big>󰄱</big> $TRANSPARENT,conkyctl transparent true ${1}") || out+=("<big>󰄲</big> $TRANSPARENT,conkyctl transparent false ${1}")
out+=("^sep()")
if [[ "$1" != *"logo_mbcolor"* ]]; then
[[ "$CLR" != "#" ]] && out+=("<small><span bgcolor='$CLR'> </span><span ${BG} fgcolor='$CLR'> <b>AbCd</b> </span></small> $DEFCOLOR,^pipe(mbclr '$CLR' conkyctl default_color '${DEFCOLOR}' '$me' ${1})")
[[ "$CLR0" != "#" ]] && out+=("<small><span bgcolor='$CLR0'> </span><span ${BG} fgcolor='$CLR0'> <b>AbCd</b> </span></small> $COLOR_0,^pipe(mbclr '$CLR0' conkyctl color0 '$COLOR_0' '$me' ${1})")
[[ "$CLR1" != "#" ]] && out+=("<small><span bgcolor='$CLR1'> </span><span ${BG} fgcolor='$CLR1'> <b>AbCd</b> </span></small> $COLOR_1,^pipe(mbclr '$CLR1' conkyctl color1 '$COLOR_1' '$me' ${1})")
[[ "$CLR2" != "#" ]] && out+=("<small><span bgcolor='$CLR2'> </span><span ${BG} fgcolor='$CLR2'> <b>AbCd</b> </span></small> $COLOR_2,^pipe(mbclr '$CLR2' conkyctl color2 '$COLOR_2' '$me' ${1})")
out+=("^sep()")
fi
2023-05-09 14:14:23 +02:00
if [[ "$1" != *"logo_mbcolor"* ]]; then
if [[ "$1" != *"quoter_mbcolor"* ]]; then
2023-08-30 14:00:09 +02:00
out+=("<big>󰛖</big> $FONTS [ <b><span font_family=\"${FONT}\">$FONT</span> $FONTSIZE</b> ],^checkout(fontsingle)")
out2+=("^tag(fontsingle)")
out2+=("^sep($FONTS)")
out2+=("<big>󰛖</big> $SELECTFONT [ <b><span font_family=\"${FONT}\">$FONT</span> $FONTSIZE</b> ],mb-setfont conky_single ${1};$me")
out2+=("^sep($FONTSIZE_LBL)")
out2+=("<big>󰧴</big> $INCREASE <b>$((FONTSIZE+1)) px</b>,conkyctl basefont_inc ${1};$me")
out2+=("<big>󰧳</big> $DECREASE <b>$((FONTSIZE-1)) px</b>,conkyctl basefont_dec ${1};$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8 7 6)
for i in "${sizes[@]}"
do
[[ "$FONTSIZE" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,conkyctl basefont_size ${1} $i;$me") || out2+=("<big>祿</big> $i px,conkyctl basefont_size ${1} $i;$me")
done
2023-08-20 09:07:52 +02:00
2023-08-30 14:00:09 +02:00
if [ -f "$HOME/.config/mabox/fonts.list" ];then
mapfile -t favfonts < <( grep -vE "^($|#)" ~/.config/mabox/fonts.list)
else
mapfile -t favfonts < <( grep -vE "^($|#)" /usr/share/mabox-colorizer/fonts.list)
cp /usr/share/mabox-colorizer/fonts.list ~/.config/mabox/
fi
#notify-send.sh "Ile" "${#favfonts[@]}"
if [ "${#favfonts[@]}" -gt 0 ];then
out2+=("^sep($FONTFAMILY_LBL)")
for fon in "${favfonts[@]}";do
[[ "$FONT" == "$fon" ]] && out2+=("<big>綠</big> <span font_family=\"${fon}\">${fon}</span>,$me") || out2+=("<big>祿</big> <span font_family=\"${fon}\">${fon}</span>,conkyctl basefont_family ${1} \"${fon}\";$me")
done
fi
out2+=("^sep()")
out2+=("<small> $_EDIT_FAVFONTS</small>,geany ~/.config/mabox/fonts.list")
2023-08-20 09:07:52 +02:00
fi
[[ "$SHADOWS" == "shadow" ]] && out+=("<big>󰄲</big> $SHADOW,conkyctl shades no ${1};$me") || out+=("<big>󰄱</big> $SHADOW,conkyctl shades shadow ${1};$me")
[[ "$SHADOWS" == "outline" ]] && out+=("<big>󰄲</big> $OLINE,conkyctl shades no ${1};$me") || out+=("<big>󰄱</big> $OLINE,conkyctl shades outline ${1};$me")
out+=("^sep()")
fi
2023-08-30 14:00:09 +02:00
2023-05-29 21:16:10 +02:00
[[ "$BORD" == false ]] && out+=("<big>󰄱</big> $BORDERS [ <b>$STIP</b> ],^checkout(bordersingle)") || out+=("<big>󰄲</big> $BORDERS [ <b>$STIP</b> ],^checkout(bordersingle)")
2022-05-15 03:25:01 +02:00
out2+=("^tag(bordersingle)")
2022-08-20 20:51:56 +02:00
out2+=("^sep($DRAW $BORDERS?)")
2023-05-29 21:16:10 +02:00
[[ "$BORD" == false ]] && out2+=("<big>祿</big> $YES,conkyctl draw_borders true ${1};$me") || out2+=("<big>綠</big> $YES,conkyctl draw_borders false ${1};$me")
[[ "$BORD" == false ]] && out2+=("<big>綠</big> $NO,conkyctl draw_borders true ${1};$me") || out2+=("<big>祿</big> $NO,conkyctl draw_borders false ${1};$me")
2022-08-27 16:36:46 +02:00
out2+=("^sep($STIPPLED_BORDERS ?)")
out2+=("0 ($SOLID_LINE),conkyctl stippled_borders 0 ${1};$me")
out2+=("^sep()")
2022-05-15 03:25:01 +02:00
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")
2023-01-07 23:10:48 +01:00
fi #OLD SYNTAX CHECK
2022-05-15 03:25:01 +02:00
out+=("^sep()")
2022-12-17 12:12:52 +01:00
out+=(" $EDIT ${title^},xdg-open ${1}")
out+=("北 $RELOAD ${title^},conkyctl restartone ${1}")
2022-05-15 03:25:01 +02:00
out+=("^sep()")
2022-12-17 12:12:52 +01:00
out+=(" $KILL ${title^},conkyctl kill ${1##*/};${me}")
2022-10-05 19:44:22 +02:00
}
pipemenu () {
single "$1"
2022-05-15 03:25:01 +02:00
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"
2022-10-27 01:10:17 +02:00
printf '%s\n' "${out3[@]}"
2022-05-15 03:25:01 +02:00
exit 0
}
2022-10-05 19:44:22 +02:00
contextmenu () {
# get conky config path from clicked "conky window"
# maybe split this to separate function?
eval $(xdotool getmouselocation --shell)
eval $(xdotool getwindowgeometry --shell ${WINDOW})
2022-11-21 12:31:17 +01:00
hexid=$(wmctrl -lpG | grep ${X} |grep ${Y}|grep ${WIDTH}|grep ${HEIGHT} |cut -d' ' -f1)
2022-10-05 19:44:22 +02:00
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
2022-11-21 12:31:17 +01:00
menu_gradient_pos=none
jgtools_padding=4
2022-10-05 19:44:22 +02:00
MENU_PADDING_TOP=${jgtools_padding:-0}
2022-08-20 20:51:56 +02:00
2023-05-29 21:16:10 +02:00
TABS=140
2022-10-05 19:44:22 +02:00
jgmenu_icon_size=0
2022-11-21 12:31:17 +01:00
2022-10-05 19:44:22 +02:00
2022-10-15 12:19:57 +02:00
single "${CONKYCFG}" "s"
2022-12-03 16:23:34 +01:00
2022-12-17 12:12:52 +01:00
case "$LANG" in
2023-05-09 14:14:23 +02:00
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^}";;
2022-12-17 12:12:52 +01:00
esac
out+=("^sep()")
2023-05-09 14:14:23 +02:00
out+=("<small>$EDIT_CUSTOMCOMMANDS</small>,conkyctl cmdmenu_edit ${name}")
2022-12-03 16:23:34 +01:00
out+=("^sep()")
2023-09-05 17:18:04 +02:00
out+=(" ${arrow_string_left} Conky Manager (Colorizer),colorizer-conky -s")
2022-12-03 16:23:34 +01:00
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
2022-11-21 12:31:17 +01:00
2022-12-03 16:23:34 +01:00
2022-11-21 12:31:17 +01:00
mkconfigfile
2023-05-29 21:16:10 +02:00
2022-12-17 12:12:52 +01:00
cat <<EOF > ${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)
2023-04-22 20:49:26 +02:00
# Fix for nonsense Conky context menu when Left Click on Root is not binded to ToogleShowDesktop
if [ ! -f "$CONKYCFG" ]; then
exit 0
fi
2022-12-17 12:12:52 +01:00
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
2022-12-19 22:22:23 +01:00
# if CSV for menu exist show it
2022-12-17 12:12:52 +01:00
if [ -f ${CONKYDIR}/menuscripts/${name}.csv ]; then
LINES=$(grep -Ev "^#|^$" ${CONKYDIR}/menuscripts/${name}.csv|wc -l)
2022-12-19 22:22:23 +01:00
#notify-send.sh "$LINES"
2023-05-09 14:14:23 +02:00
if [ ${LINES} == 0 ]; then
2024-01-25 13:01:29 +01:00
: # do nothing, was contextmenu
2022-12-17 12:12:52 +01:00
fi
2023-05-09 14:14:23 +02:00
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
2022-12-17 12:12:52 +01:00
else
2024-01-25 13:01:29 +01:00
: # do nothing
2022-12-17 12:12:52 +01:00
fi
2022-12-19 22:22:23 +01:00
# otherwise build and show standalone menu with custom commands
2022-12-17 12:12:52 +01:00
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
2023-05-29 21:16:10 +02:00
TABS=140
2022-12-17 12:12:52 +01:00
jgmenu_icon_size=0
mkconfigfile
case "$LANG" in
2022-10-05 19:44:22 +02:00
pl*)
CUSTOM_COMMANDS_SEP="Własne polecenia"
2022-12-17 12:12:52 +01:00
EDIT_CUSTOMCOMMANDS=" Edytuj menu"
2022-10-05 19:44:22 +02:00
;;
2022-12-03 16:23:34 +01:00
es*)
CUSTOM_COMMANDS_SEP="Custom commands"
2022-12-17 12:12:52 +01:00
EDIT_CUSTOMCOMMANDS=" Edit menu"
2022-12-03 16:23:34 +01:00
;;
2022-10-05 19:44:22 +02:00
*)
CUSTOM_COMMANDS_SEP="Custom commands"
2022-12-17 12:12:52 +01:00
EDIT_CUSTOMCOMMANDS=" Edit menu"
2022-10-05 19:44:22 +02:00
;;
esac
2022-10-17 14:48:35 +02:00
cat <<EOF > ${MENU_ITEMS}
2022-11-21 12:31:17 +01:00
${CUSTOMCOMMANDS}
2022-10-17 14:48:35 +02:00
EOF
2022-10-05 19:44:22 +02:00
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
2023-05-09 14:14:23 +02:00
cmdmenu_edit() {
2023-05-09 16:45:54 +02:00
if [[ -s "${CONKYDIR}/menuscripts/${1}.csv" ]];then
geany "${CONKYDIR}/menuscripts/${1}.csv"
2023-05-09 14:14:23 +02:00
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
}
2022-12-17 12:12:52 +01:00
2022-10-17 14:48:35 +02:00
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}')
2022-12-17 12:12:52 +01:00
# thanks @sng :)
2022-10-17 14:48:35 +02:00
IFACE=$(ip route get 8.8.8.8 | awk '{for(i=1; i<NF; i++) {if($i=="dev") dev=i+1} print $dev}')
case "$LANG" in
pl*)
NETWORK="SIEĆ"
DEVICE="Urządzenie"
IP="Adres IP"
DOWNLOAD="Pobieranie"
;;
2022-12-03 16:23:34 +01:00
es*)
NETWORK="NETWORK"
DEVICE="Device"
IP="IP"
DOWNLOAD="Download"
;;
2022-10-17 14:48:35 +02:00
*)
NETWORK="NETWORK"
DEVICE="Device"
IP="IP"
DOWNLOAD="Download"
;;
esac
cat <<EOF >> /tmp/xx00
conky.text = [[
\${color}$NETWORK
2022-10-27 01:10:17 +02:00
\${color}$DEVICE \${alignr}\${color0}$IFACE
\${color}$IP \${alignr}\${color0}\${addr $IFACE}
2022-10-17 14:48:35 +02:00
\${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
2022-10-27 01:10:17 +02:00
\${color0}\${hr}
2022-10-17 14:48:35 +02:00
\${execi 30 netstat -ept | grep ESTAB | awk '{print \$9}' | cut -d/ -f2 | sort | uniq -c | sort -nr}
]];
EOF
cat /tmp/xx00 > ${CFGFILE}
}
2023-09-08 12:34:28 +02:00
savescheme () {
case "$LANG" in
pl*)SAVE_AS="Nowy motyw Conky"
DESC="Zapisz obecnie ustawione kolory Conky jako nowy motyw..."
LABEL="Nazwa:"
NAME="nazwa";;
*) SAVE_AS="New Conky colorscheme"
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
2023-09-11 18:59:49 +02:00
echo "${1}${schemename}" >> "$HOME/.config/colorizer/conky/c_userschemes.csv"
2023-09-08 12:34:28 +02:00
}
delscheme() {
2023-09-11 18:59:49 +02:00
sed -i ${1}d "$HOME/.config/colorizer/conky/c_userschemes.csv"
2023-09-08 12:34:28 +02:00
}
2022-10-17 14:48:35 +02:00
2023-09-08 12:34:28 +02:00
applyscheme () {
case "$1" in
sys) SCHEMEFILE="/usr/share/mabox-colorizer/colorschemes/conky.csv";;
2023-09-11 18:59:49 +02:00
usr) SCHEMEFILE="$HOME/.config/colorizer/conky/c_userschemes.csv";;
2023-09-08 12:34:28 +02:00
esac
2023-09-11 18:59:49 +02:00
while IFS="|" read -r own_window_colour default_color color0 color1 color2 wintrans outline shades bord stip scheme_name
2023-09-08 12:34:28 +02:00
do
win_bgcolor ${own_window_colour} ${3}
default_color ${default_color} ${3}
color0 ${color0} ${3}
color1 ${color1} ${3}
color2 ${color2} ${3}
2023-09-11 18:59:49 +02:00
transparent ${wintrans} ${3}
shadow="no"
[[ "$outline" == true ]] && shadow="outline"
[[ "$shades" == true ]] && shadow="shadow"
shades "$shadow" ${3}
stippled_borders ${stip} ${3}
draw_borders ${bord} ${3}
2023-09-08 12:34:28 +02:00
done < <(awk 'NR == n' n=$2 "$SCHEMEFILE")
2022-12-03 16:23:34 +01:00
}
2023-09-08 12:34:28 +02:00
applyscheme_all () {
case "$1" in
sys) SCHEMEFILE="/usr/share/mabox-colorizer/colorschemes/conky.csv";;
2023-09-11 18:59:49 +02:00
usr) SCHEMEFILE="$HOME/.config/colorizer/conky/c_userschemes.csv";;
2023-09-08 12:34:28 +02:00
esac
2023-09-11 18:59:49 +02:00
while IFS="|" read -r own_window_colour default_color color0 color1 color2 wintrans outline shades bord stip scheme_name
2023-09-08 12:34:28 +02:00
do
win_bgcolor_all ${own_window_colour}
2022-12-03 16:23:34 +01:00
default_color_all ${default_color}
color0_all ${color0}
color1_all ${color1}
color2_all ${color2}
2023-09-11 18:59:49 +02:00
transparent_all ${wintrans}
shadow="no"
[[ "$outline" == true ]] && shadow="outline"
[[ "$shades" == true ]] && shadow="shadow"
shades_all "$shadow"
stippled_borders_all ${stip}
draw_borders_all ${bord}
2023-09-08 12:34:28 +02:00
done < <(awk 'NR == n' n=$2 "$SCHEMEFILE")
2022-12-03 16:23:34 +01:00
}
2023-01-07 23:10:48 +01:00
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}
}
2023-09-11 18:59:49 +02:00
baseconky_info() {
#notify-send.sh -i mbcc "Important" "Baseconky info"
case "$LANG" in
pl*)
TITLE="Ważna informacja"
MSG="Podczas pracy nad nowymi schematami kolorów lub dostosowywaniem kolorów warto uruchomić Conky: Sysinfo - który jest bazowym Conky.\nJego kolory i inne zmienne są brane pod uwagę.\n\nUruchomić Sysinfo teraz?\n\n"
START="Tak, uruchom Sysinfo Conky"
NO="Nie"
;;
*)
TITLE="Important info"
MSG="When working on new color schemes or customizing colors, it's worth running Conky: Sysinfo - which is the base Conky. Its colors and other variables are taken into account by Colorizer.\n\nStart Sysinfo Conky now?\n\n"
START="Yes, start Sysinfo Conky"
NO="No"
;;
esac
cmd=(
yad --center --width=360 --borders=20 --window-icon=mbcc --image=colorizer
--title "${TITLE}"
--text="${MSG}"
--button="${START}:1"
--button="${NO}:0"
)
"${cmd[@]}"
exval=$?
#notify-send.sh -t 10000 "Exval" "${exval}"
case $exval in
1) startone "$HOME/.config/conky/sysinfo_mbcolor.conkyrc";;
0) : ;;
252): ;;
esac
colorizer-conky -s
}
2024-02-22 14:24:51 +01:00
mono () {
lighten=(0.92 0.8 0.65 0.45 0.28)
darken=(0.9 0.74 0.54 0.38 0.18)
if [ "${1}" == pick ];then
color=$(gpick -pso 2>/dev/null)
else
color="${1}"
fi
if [ "${#color}" == 7 ];then
for i in "${lighten[@]}"
do
pal+=("$(pastel mix -f $i "#ffffff" "$color"|pastel format hex)")
done
pal+=("$color")
for i in "${darken[@]}"
do
pal+=("$(pastel mix -f $i "$color" "#000000"|pastel format hex)")
done
else
exit 0
fi
#colorize Conky
if [ "$2" == "dark" ];then
win_bgcolor_all "${pal[10]}"
default_color_all "${pal[0]}"
color0_all "${pal[3]}"
color1_all "${pal[4]}"
color2_all "${pal[5]}"
else # light
win_bgcolor_all "${pal[4]}"
default_color_all "${pal[9]}"
color0_all "${pal[7]}"
color1_all "${pal[8]}"
color2_all "${pal[1]}"
fi
colorizer-conky -s 2>/dev/null
}
monoone () {
lighten=(0.92 0.8 0.65 0.45 0.28)
darken=(0.9 0.74 0.54 0.38 0.18)
if [ "${1}" == pick ];then
color=$(gpick -pso 2>/dev/null)
else
color="${1}"
fi
if [ "${#color}" == 7 ];then
for i in "${lighten[@]}"
do
pal+=("$(pastel mix -f $i "#ffffff" "$color"|pastel format hex)")
done
pal+=("$color")
for i in "${darken[@]}"
do
pal+=("$(pastel mix -f $i "$color" "#000000"|pastel format hex)")
done
else
exit 0
fi
# colorize one Conky
if [ "$2" == "dark" ];then
win_bgcolor "${pal[10]}" "${3}"
default_color "${pal[0]}" "${3}"
color0 "${pal[3]}" "${3}"
color1 "${pal[4]}" "${3}"
color2 "${pal[5]}" "${3}"
else # light
win_bgcolor "${pal[4]}" "${3}"
default_color "${pal[9]}" "${3}"
color0 "${pal[7]}" "${3}"
color1 "${pal[8]}" "${3}"
color2 "${pal[1]}" "${3}"
fi
}
2022-05-15 03:25:01 +02:00
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";;
2023-08-20 09:07:52 +02:00
basefont_family) basefont_family "$2" "$3";;
basefont_family_all) basefont_family_all "$2";;
basefont_size) basefont_size "$2" "$3";;
basefont_size_all) basefont_size_all "$2";;
2022-05-19 14:50:08 +02:00
setfont_all) setfont_all;;
serfont) setfont;;
2022-05-15 03:25:01 +02:00
shades_all) shades_all "$2";;
shades) shades "$2" "$3";;
2022-05-26 22:39:07 +02:00
logosize) logosize "$2";;
2022-10-05 19:44:22 +02:00
single) pipemenu "$2";;
2022-05-15 03:25:01 +02:00
pos) pos "$2" "$3";;
gap_x) gap_x "$2" "$3";;
gap_y) gap_y "$2" "$3";;
2022-08-20 20:51:56 +02:00
setpos) setpos "$2";;
2022-05-15 03:25:01 +02:00
startone) startone "$2";;
startall) startall;;
kill) kill "$2";;
2024-01-25 13:01:29 +01:00
toggleone) toggleone "$2";;
2022-09-19 20:59:26 +02:00
restartone) restartone "$2";;
2022-10-05 19:44:22 +02:00
contextmenu) contextmenu;;
2022-12-17 12:12:52 +01:00
cmdmenu) cmdmenu;;
2023-05-09 14:14:23 +02:00
cmdmenu_edit) cmdmenu_edit "$2";;
2022-10-27 01:10:17 +02:00
makemoveableall) makemoveableall;;
2022-09-19 20:59:26 +02:00
saveposall) saveposall;;
2022-10-27 01:10:17 +02:00
resetcolorsall) resetcolorsall ;;
resetcolorsone) resetcolorsone "$2";;
2023-09-08 12:34:28 +02:00
savescheme) savescheme "$2";;
delscheme) delscheme "$2";;
applyscheme) applyscheme "$2" "$3" "$4";;
applyscheme_all) applyscheme_all "$2" "$3";;
2022-10-17 14:48:35 +02:00
netdevice) netdevice ;;
2023-01-07 23:10:48 +01:00
convert_from_old) convert_from_old "$2";;
2023-09-11 18:59:49 +02:00
baseconky_info) baseconky_info;;
2024-02-22 14:24:51 +01:00
mono) mono "$2" "$3";;
monoone) monoone "$2" "$3" "$4";;
2022-05-15 03:25:01 +02:00
*) : ;;
esac