diff --git a/bin/conkyctl b/bin/conkyctl
index 68ff837..c0e2a31 100755
--- a/bin/conkyctl
+++ b/bin/conkyctl
@@ -243,12 +243,21 @@ makemovableall () {
echo "dupa"
}
-single () {
- case "$LANG" in
+languages () {
+ case "$LANG" in
pl*)
POSITION="Pozycja"
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"
@@ -281,6 +290,15 @@ single () {
POSITION="Position"
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"
@@ -309,11 +327,19 @@ single () {
STIPPLED_BORDERS="Stippled borders"
SOLID_LINE="solid line"
;;
- esac
+ esac
+}
+
+single () {
+ languages
filename=${1##*/}
name=${filename%%_mb*}
title=${name//_/ }
+ if [[ "$2" == "s" ]];then
+ me=""
+ 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)"
@@ -323,7 +349,7 @@ single () {
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
read WINCLR <<< "$(grep own_window_colour ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
- [[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${1}"
+ [[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${WINCLR}"
read CLR <<< "$(grep default_color ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}"
@@ -352,15 +378,15 @@ single () {
out+=("$ALIGNMENT [ $POS ],^checkout(pos)")
out2+=("^tag(pos)")
out2+=("^sep($POSITION)")
- out2+=("TopLeft,conkyctl pos top_left ${1};$me")
- out2+=("Top,conkyctl pos top_middle ${1};$me")
- out2+=("TopRight,conkyctl pos top_right ${1};$me")
- out2+=("Left,conkyctl pos middle_left ${1};$me")
- out2+=("Center,conkyctl pos middle_middle ${1};$me")
- out2+=("Right,conkyctl pos middle_right ${1};$me")
- out2+=("BottomLeft,conkyctl pos bottom_left ${1};$me")
- out2+=("Bottom,conkyctl pos bottom_middle ${1};$me")
- out2+=("BottomRight,conkyctl pos bottom_right ${1};$me")
+ out2+=(" $TOPLEFT,conkyctl pos top_left ${1};$me")
+ out2+=(" $TOP,conkyctl pos top_middle ${1};$me")
+ out2+=(" $TOPRIGHT,conkyctl pos top_right ${1};$me")
+ out2+=(" $LEFT,conkyctl pos middle_left ${1};$me")
+ out2+=("$CENTER,conkyctl pos middle_middle ${1};$me")
+ out2+=(" $RIGHT,conkyctl pos middle_right ${1};$me")
+ out2+=(" $BOTTOMLEFT,conkyctl pos bottom_left ${1};$me")
+ out2+=(" $BOTTOM,conkyctl pos bottom_middle ${1};$me")
+ out2+=(" $BOTTOMRIGHT,conkyctl pos bottom_right ${1};$me")
out+=("$HORIZONTAL_GAP [ $GAPX ],^checkout(gapx)")
out2+=("^tag(gapx)")
out2+=("^sep($HORIZONTAL_GAP)")
@@ -480,13 +506,105 @@ single () {
out+=(" $EDIT ${title^},xdg-open ${1}")
out+=("^sep()")
out+=(" $KILL ${title^},conkyctl kill ${1##*/};${me}")
-
+}
+pipemenu () {
+ single "$1"
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"
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}|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"
+
+ if [ ! -f $HOME/.config/mabox/${name}.csv ]; then
+ #touch $HOME/.config/mabox/${name}.csv
+ CUSTOMCOMMANDS=""
+ else
+ CUSTOMCOMMANDS=". $HOME/.config/mabox/${name}.csv"
+ fi
+
+ . /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_PADDING_TOP=${jgtools_padding:-0}
+ TABS="90"
+ jgmenu_icon_size=0
+ mkconfigfile
+
+ single "$CONKYCFG" "s"
+
+ case "$LANG" in
+ pl*)
+ CUSTOM_COMMANDS_SEP="Własne polecenia"
+ EDIT_CUSTOMCOMMANDS=" Edytuj własne polecenia"
+ ;;
+ *)
+ CUSTOM_COMMANDS_SEP="Custom commands"
+ EDIT_CUSTOMCOMMANDS=" Edit custom commands"
+ ;;
+ esac
+
+cat < ${MENU_ITEMS}
+$(printf '%s\n' "${out[@]}")
+^sep()
+ ⮜⮜⮜ Colorizer Conky,colorizer-conky -s
+^sep($CUSTOM_COMMANDS_SEP)
+${CUSTOMCOMMANDS}
+$EDIT_CUSTOMCOMMANDS,touch ~/.config/mabox/${name}.csv;sleep 1;xdg-open ~/.config/mabox/${name}.csv
+$(printf '%s\n' "${out2[@]}")
+EOF
+jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
+
+}
case "$1" in
transparent_all) transparent_all "$2";;
transparent) transparent "$2" "$3";;
@@ -513,7 +631,7 @@ case "$1" in
shades_all) shades_all "$2";;
shades) shades "$2" "$3";;
logosize) logosize "$2";;
- single) single "$2";;
+ single) pipemenu "$2";;
pos) pos "$2" "$3";;
gap_x) gap_x "$2" "$3";;
gap_y) gap_y "$2" "$3";;
@@ -522,6 +640,7 @@ case "$1" in
startall) startall;;
kill) kill "$2";;
restartone) restartone "$2";;
+ contextmenu) contextmenu;;
makemovableall) makemovableall;;
saveposall) saveposall;;
reset) reset ;;