2021-05-01 18:17:55 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
CONKYDEFAULT="$HOME/.conkyrc"
|
|
|
|
CONKYPATH="$HOME/.config/conky"
|
|
|
|
CSESSIONFILE="$CONKYPATH/conky-sessionfile"
|
|
|
|
SESSIONS="$CONKYPATH/saved-sessions"
|
|
|
|
CZEN="mb-conky-manager"
|
|
|
|
CSESSION="mb-conky-session"
|
|
|
|
|
|
|
|
if [ ! -e "$CSESSIONFILE" ] 2> /dev/null ; then
|
|
|
|
echo "Error: Failed to locate conky-sessionfile in $CONKYPATH" >&2
|
|
|
|
echo "conky -c $HOME/.conkyrc & sleep 1" > "$CSESSIONFILE"
|
|
|
|
fi
|
|
|
|
if [ ! -e "$SESSIONS" ] 2> /dev/null ; then
|
|
|
|
echo "$0: Failed to locate saved-sessions in $CONKYPATH" >&2
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $LANG in
|
|
|
|
pl*)
|
|
|
|
CHOOSE_CONKY="Wybierz Conky..."
|
|
|
|
SESSIONS_LBL="Sesje Conky"
|
|
|
|
NEW_SESSION="Nowa sesja Conky"
|
|
|
|
RELOAD="Przeładuj Conky"
|
|
|
|
SAVED_SESSIONS="Zachowane sesje"
|
|
|
|
DEFAULT_CONKYRC="Domyślne conkyrc"
|
|
|
|
RUNNING_CONKY="Działające Conky"
|
|
|
|
EDIT_CONKY="Edytuj Conky"
|
|
|
|
CONKY_EDITOR="Wybierz plik Conky do edycji..."
|
|
|
|
NONE="Brak"
|
|
|
|
DEFAULT="Domyślna"
|
|
|
|
REMOVE="Usuń to menu z panelu"
|
|
|
|
;;
|
|
|
|
es*)
|
|
|
|
CHOOSE_CONKY="Elegir recuadro Conky..."
|
|
|
|
SESSIONS_LBL="Conky Sesiones"
|
|
|
|
NEW_SESSION="Guardar sesión actual Conky"
|
|
|
|
RELOAD="Recargar recuadros Conky"
|
|
|
|
SAVED_SESSIONS="Sesiones Conky guardadas"
|
|
|
|
DEFAULT_CONKYRC="Archivo conkyrc x defecto"
|
|
|
|
RUNNING_CONKY="Recuadros en ejecución"
|
|
|
|
EDIT_CONKY="Edición manual recuadro"
|
|
|
|
CONKY_EDITOR="Editor de recuadro"
|
|
|
|
NONE="Ninguno"
|
|
|
|
DEFAULT="Default"
|
|
|
|
REMOVE="Eliminar este menú del panel"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
CHOOSE_CONKY="Choose Conky..."
|
|
|
|
SESSIONS_LBL="Conky Sessions"
|
|
|
|
NEW_SESSION="New Conky session"
|
|
|
|
RELOAD="Reload Conky"
|
|
|
|
SAVED_SESSIONS="Saved sessions"
|
|
|
|
DEFAULT_CONKYRC="Default conkyrc"
|
|
|
|
RUNNING_CONKY="Running Conky"
|
|
|
|
EDIT_CONKY="Edit Conky"
|
|
|
|
CONKY_EDITOR="Conky Editor"
|
|
|
|
NONE="None"
|
|
|
|
DEFAULT="Default"
|
|
|
|
REMOVE="Remove this menu from panel"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
EditMenu(){
|
|
|
|
if [[ $(pidof conky) ]];then
|
|
|
|
out+=("$RUNNING_CONKY,^checkout(RUNNING)")
|
|
|
|
out2+=("^tag(RUNNING)")
|
|
|
|
out2+=("^sep($RUNNING_CONKY)")
|
|
|
|
while read -r session ;do # get running conkys from sessionfile
|
|
|
|
[[ -z $session ]] && continue
|
|
|
|
CPATH=$(echo "$session" | awk '{print $3}')
|
|
|
|
#CONKY=$(echo "$CPATH" | awk -F"/" '{print $(NF-1)"/"$NF }')
|
|
|
|
CONKY=${CPATH##*/}
|
|
|
|
out2+=("$CONKY,geany $CPATH")
|
|
|
|
done < "$CSESSIONFILE"
|
|
|
|
|
|
|
|
else
|
|
|
|
out2+=("^tag(RUNNING)")
|
|
|
|
out2+=("$NONE")
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
out+=("^sep(Conky)")
|
|
|
|
|
|
|
|
if type "$CZEN" &>/dev/null;then # mb-conky-manager script found
|
|
|
|
out+=("$CHOOSE_CONKY,$CZEN")
|
|
|
|
fi
|
|
|
|
|
|
|
|
if type "$CSESSION" &>/dev/null;then # mb-conky-session script found
|
|
|
|
out+=("$RELOAD,$CSESSION")
|
|
|
|
fi
|
|
|
|
|
|
|
|
out+=("^sep($EDIT_CONKY)")
|
|
|
|
if type mb-conkyedit &>/dev/null;then # mb-conkyedit script found
|
|
|
|
out+=("$CONKY_EDITOR,mb-conkyedit")
|
|
|
|
EditMenu
|
|
|
|
else
|
|
|
|
EditMenu
|
|
|
|
fi
|
|
|
|
|
|
|
|
out+=("^sep($SESSIONS_LBL)")
|
|
|
|
if type "$CZEN" &>/dev/null;then # mb-conkyzen script found
|
|
|
|
out+=("$NEW_SESSION,$CZEN -z")
|
|
|
|
fi
|
|
|
|
|
|
|
|
if type "$CSESSION" &>/dev/null;then # mb-conky-session script found
|
|
|
|
out+=("^sep($SAVED_SESSIONS)")
|
2021-05-30 12:26:18 +02:00
|
|
|
if [[ -e "$SESSIONS" ]]
|
2021-05-01 18:17:55 +02:00
|
|
|
then
|
|
|
|
while read -r session ;do
|
|
|
|
[[ -z $session ]] && continue # skip if line is blank
|
2021-05-01 19:26:30 +02:00
|
|
|
out+=("${session##*/},$CSESSION $session")
|
2021-05-01 18:17:55 +02:00
|
|
|
done < "$SESSIONS"
|
|
|
|
else
|
|
|
|
echo "$0: Failed to locate saved-sessions in $CONKYPATH" >&2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2021-05-30 12:26:18 +02:00
|
|
|
|
|
|
|
if [ $1 == "-s" ]; then
|
|
|
|
. /usr/bin/pipemenu-standalone.cfg
|
|
|
|
. $HOME/.config/mabox/mabox.conf
|
2021-05-31 15:00:35 +02:00
|
|
|
MENU_PADDING_TOP=${jgtools_padding:-0}
|
2021-05-30 12:26:18 +02:00
|
|
|
MENU_HALIGN="left"
|
|
|
|
MENU_VALIGN="center"
|
|
|
|
MENU_MARGIN_Y=40
|
|
|
|
jgmenu_icon_size=0
|
|
|
|
menu_margin_x=${submenu_spacing:-0}
|
|
|
|
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
|
|
|
|
|
|
|
|
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
|
|
|
|
[ -z $jgmenu_use_borders ] && menu_border=0
|
|
|
|
|
|
|
|
mkconfigfile
|
|
|
|
|
|
|
|
cat <<EOF > ${MENU_ITEMS}
|
|
|
|
|
|
|
|
$(printf '%s\n' "${out[@]}")
|
|
|
|
$(printf '%s\n' "${out2[@]}")
|
|
|
|
EOF
|
|
|
|
|
|
|
|
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-01 18:17:55 +02:00
|
|
|
printf '%s\n' "${out[@]}"
|
|
|
|
|
|
|
|
|
|
|
|
if [ $1 == "-r" ]; then
|
|
|
|
printf '%s\n' "^sep()"
|
2021-05-23 10:20:13 +02:00
|
|
|
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_conkypipe=false;mb-jgtools places"
|
2021-05-01 18:17:55 +02:00
|
|
|
fi
|
|
|
|
printf '%s\n' "${out2[@]}"
|