From 69160bbb9245d09adadb3783fecf3dee6410f78f Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Tue, 17 Mar 2026 13:12:32 +0100 Subject: [PATCH] conkyctl upd --- bin/conkyctl | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/bin/conkyctl b/bin/conkyctl index a2ff7a8..4bd4db6 100755 --- a/bin/conkyctl +++ b/bin/conkyctl @@ -1220,16 +1220,14 @@ jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null cmdmenu () { source "$HOME/.config/mabox/mabox.conf" - if [[ "$conky_leftclick" == "off" ]];then - exit 0 - fi - mkdir -p "${CONKYDIR}"/menuscripts + #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) + #notify-send.sh "${X} ${Y}" "${WIDTH} ${HEIGHT}" # Fix for nonsense Conky context menu when Left Click on Root is not binded to ToogleShowDesktop if [ ! -f "$CONKYCFG" ]; then @@ -1245,14 +1243,26 @@ cmdmenu () { exit 0 fi - #notify-send.sh "${X} ${Y}" "${WIDTH} ${HEIGHT}" - # if script exist run it and exit - if [ "$1" != "" ];then - if [ -x "${CONKYDIR}/menuscripts/${name}" ];then - bash -c "${CONKYDIR}/menuscripts/${name} ${1}" + # if command exists in system run it and exit + if hash "${name}" 2>/dev/null ;then + ${name} ${1} exit 0 fi + + # if conky leftclick is disabled ... exit + if [[ "$conky_leftclick" == "off" ]];then + exit 0 fi + + + # if script exist in menuscripts run it and exit + if [ "$1" != "" ];then + if [ -x "${CONKYDIR}/menuscripts/${name}" ];then + bash -c "${CONKYDIR}/menuscripts/${name} ${1}" + exit 0 + fi + fi + # if CSV for menu exist show it if [ -f ${CONKYDIR}/menuscripts/${name}.csv ]; then LINES=$(grep -Ev "^#|^$" ${CONKYDIR}/menuscripts/${name}.csv|wc -l) @@ -1623,8 +1633,12 @@ sd "template0 =.*$" "template0 = [[${1}]]," "$HOME/.config/conky/Better_Clock_mb bc_dformat() { sd "template1 =.*$" "template1 = [[${1}]]," "$HOME/.config/conky/Better_Clock_mbcolor.conkyrc" } - - +lclick() { +mb-setvar conky_leftclick="${1}" +} +rclick() { +mb-setvar conky_rightclick="${1}" +} case "$1" in transparent_all) transparent_all "$2";; transparent) transparent "$2" "$3";; @@ -1694,5 +1708,7 @@ case "$1" in bc_fdate)bc_fdate "$2";; bc_tformat)bc_tformat "$2";; bc_dformat)bc_dformat "$2";; + lclick)lclick "$2";; + rclick)rclick "$2";; *) : ;; esac