129 lines
3.6 KiB
Bash
Executable File
129 lines
3.6 KiB
Bash
Executable File
#!/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)")
|
|
if [ -e "$SESSIONS" ]
|
|
then
|
|
while read -r session ;do
|
|
[[ -z $session ]] && continue # skip if line is blank
|
|
out+=("${session##*/},$CSESSION $session")
|
|
done < "$SESSIONS"
|
|
else
|
|
echo "$0: Failed to locate saved-sessions in $CONKYPATH" >&2
|
|
fi
|
|
fi
|
|
|
|
|
|
printf '%s\n' "${out[@]}"
|
|
|
|
|
|
if [ $1 == "-r" ]; then
|
|
printf '%s\n' "^sep()"
|
|
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_conkypipe=false"
|
|
fi
|
|
printf '%s\n' "${out2[@]}"
|