conky pipemenu renamed

This commit is contained in:
Daniel Napora 2021-05-01 18:17:55 +02:00
parent 0d37943f55
commit a45a5e8c00
3 changed files with 243 additions and 243 deletions

128
usr/bin/jgconky-pipe Executable file
View File

@ -0,0 +1,128 @@
#!/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[@]}"

View File

@ -1,4 +1,21 @@
#!/bin/bash #!/bin/bash
# mabox-conky-pipemenu - an Openbox pipemenu for manipulating conky
# Copyright (C) 2015 damo <damo@bunsenlabs.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
MB_COMMON_LIBDIR='/usr/lib/mabox/mabox-common'
CONKYDEFAULT="$HOME/.conkyrc" CONKYDEFAULT="$HOME/.conkyrc"
CONKYPATH="$HOME/.config/conky" CONKYPATH="$HOME/.config/conky"
@ -6,7 +23,12 @@ CSESSIONFILE="$CONKYPATH/conky-sessionfile"
SESSIONS="$CONKYPATH/saved-sessions" SESSIONS="$CONKYPATH/saved-sessions"
CZEN="mb-conky-manager" CZEN="mb-conky-manager"
CSESSION="mb-conky-session" CSESSION="mb-conky-session"
HELPFILE="/usr/share/mabox/mabox-docs/helpfile-conkyzen.txt"
if ! . "$MB_COMMON_LIBDIR/mabox-include.cfg" 2> /dev/null; then
echo "Error: Failed to source mb-include.cfg in $MB_COMMON_LIBDIR" >&2
exit 1
fi
if [ ! -e "$CSESSIONFILE" ] 2> /dev/null ; then if [ ! -e "$CSESSIONFILE" ] 2> /dev/null ; then
echo "Error: Failed to locate conky-sessionfile in $CONKYPATH" >&2 echo "Error: Failed to locate conky-sessionfile in $CONKYPATH" >&2
echo "conky -c $HOME/.conkyrc & sleep 1" > "$CSESSIONFILE" echo "conky -c $HOME/.conkyrc & sleep 1" > "$CSESSIONFILE"
@ -15,10 +37,11 @@ if [ ! -e "$SESSIONS" ] 2> /dev/null ; then
echo "$0: Failed to locate saved-sessions in $CONKYPATH" >&2 echo "$0: Failed to locate saved-sessions in $CONKYPATH" >&2
fi fi
declareDependencies yad
case $LANG in case $LANG in
pl*) pl*)
CHOOSE_CONKY="Wybierz Conky..." CHOOSE_CONKY="Wybierz Conky"
SESSIONS_LBL="Sesje Conky"
NEW_SESSION="Nowa sesja Conky" NEW_SESSION="Nowa sesja Conky"
RELOAD="Przeładuj Conky" RELOAD="Przeładuj Conky"
SAVED_SESSIONS="Zachowane sesje" SAVED_SESSIONS="Zachowane sesje"
@ -27,12 +50,9 @@ case $LANG in
EDIT_CONKY="Edytuj Conky" EDIT_CONKY="Edytuj Conky"
CONKY_EDITOR="Wybierz plik Conky do edycji..." CONKY_EDITOR="Wybierz plik Conky do edycji..."
NONE="Brak" NONE="Brak"
DEFAULT="Domyślna" DEFAULT="Domyślna";;
REMOVE="Usuń to menu z panelu"
;;
es*) es*)
CHOOSE_CONKY="Elegir recuadro Conky..." CHOOSE_CONKY="Elegir recuadro Conky"
SESSIONS_LBL="Conky Sesiones"
NEW_SESSION="Guardar sesión actual Conky" NEW_SESSION="Guardar sesión actual Conky"
RELOAD="Recargar recuadros Conky" RELOAD="Recargar recuadros Conky"
SAVED_SESSIONS="Sesiones Conky guardadas" SAVED_SESSIONS="Sesiones Conky guardadas"
@ -42,11 +62,9 @@ case $LANG in
CONKY_EDITOR="Editor de recuadro" CONKY_EDITOR="Editor de recuadro"
NONE="Ninguno" NONE="Ninguno"
DEFAULT="Default" DEFAULT="Default"
REMOVE="Eliminar este menú del panel"
;; ;;
*) *)
CHOOSE_CONKY="Choose Conky..." CHOOSE_CONKY="Choose Conky"
SESSIONS_LBL="Conky Sessions"
NEW_SESSION="New Conky session" NEW_SESSION="New Conky session"
RELOAD="Reload Conky" RELOAD="Reload Conky"
SAVED_SESSIONS="Saved sessions" SAVED_SESSIONS="Saved sessions"
@ -56,73 +74,107 @@ case $LANG in
CONKY_EDITOR="Conky Editor" CONKY_EDITOR="Conky Editor"
NONE="None" NONE="None"
DEFAULT="Default" DEFAULT="Default"
REMOVE="Remove this menu from panel"
;; ;;
esac esac
EditMenu(){ getSessions(){ # read any saved sessions from save-sessions file
if [[ $(pidof conky) ]];then menuSeparator "$SAVED_SESSIONS"
out+=("$RUNNING_CONKY,^checkout(RUNNING)") #menuItem "$DEFAULT" "$CSESSION $CSESSIONFILE"
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" ] if [ -e "$SESSIONS" ]
then then
while read -r session ;do while read -r session ;do
[[ -z $session ]] && continue # skip if line is blank [[ -z $session ]] && continue # skip if line is blank
out+=("${session##*/},$CSESSION '$session'") menuItem "$session" "$CSESSION $session"
done < "$SESSIONS" done < "$SESSIONS"
else else
echo "$0: Failed to locate saved-sessions in $CONKYPATH" >&2 echo "$0: Failed to locate saved-sessions in $CONKYPATH" >&2
fi fi
}
loadChooserMenu(){
if type "$CZEN" &>/dev/null;then # mb-conkyzen script found
menuItem "$CHOOSE_CONKY" "$CZEN"
fi fi
}
loadNewsessionMenu(){
printf '%s\n' "${out[@]}" if type "$CZEN" &>/dev/null;then # mb-conkyzen script found
menuItem "$NEW_SESSION" "$CZEN -z"
if [ $1 == "-r" ]; then
printf '%s\n' "^sep()"
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_conkypipe=false"
fi fi
printf '%s\n' "${out2[@]}" }
loadReloadMenu(){
if type "$CSESSION" &>/dev/null;then # mb-conky-session script found
menuItem "$RELOAD" "$CSESSION"
fi
}
loadSavedsessionSubmenu(){
if type "$CSESSION" &>/dev/null;then # mb-conky-session script found
menuSubmenu "Sessions" "$SAVED_SESSIONS"
getSessions
menuSubmenuEnd
fi
}
loadPinMenu(){
if type mb-conkypin &>/dev/null;then
menuItem "Ustaw pozycję Conky" "mb-conkypin"
menuSeparator
fi
}
loadEditMenu(){
#menuItem "$DEFAULT_CONKYRC" "geany $CONKYDEFAULT"
if [[ $(pidof conky) ]];then
menuSubmenu "RunningConky" "$RUNNING_CONKY"
menuSeparator "$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 }')
menuItem "$CONKY" "geany $CPATH"
done < "$CSESSIONFILE"
menuSubmenuEnd
else
menuItem "$NONE"
fi
}
getConkys(){
menuSubmenu "EditConky" "$EDIT_CONKY"
menuSeparator "$EDIT_CONKY"
if type mb-conkyedit &>/dev/null;then # mb-conkyedit script found
menuItem "$CONKY_EDITOR" "mb-conkyedit"
loadEditMenu
else
loadEditMenu
fi
menuSubmenuEnd
}
checkHelpfile(){
DLG="yad --text-info --center --borders=20 \
--title='BunsenLabs Conky Manager Help' \
--window-icon=distributor-logo-bunsenlabs \
--filename=$HELPFILE --fontname=Monospace \
--width=650 --height=700 \
--button=OK:0"
if [[ -e $HELPFILE ]];then
menuItem "Pomoc do Conky Manager" "$DLG"
fi
}
menuStart "Conkymenu" "Conky"
menuSeparator "Conky"
loadChooserMenu
loadReloadMenu
getConkys
menuSeparator
#loadPinMenu
loadNewsessionMenu
loadSavedsessionSubmenu
#menuSeparator
#checkHelpfile
menuEnd

View File

@ -1,180 +0,0 @@
#!/bin/bash
# mabox-conky-pipemenu - an Openbox pipemenu for manipulating conky
# Copyright (C) 2015 damo <damo@bunsenlabs.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
MB_COMMON_LIBDIR='/usr/lib/mabox/mabox-common'
CONKYDEFAULT="$HOME/.conkyrc"
CONKYPATH="$HOME/.config/conky"
CSESSIONFILE="$CONKYPATH/conky-sessionfile"
SESSIONS="$CONKYPATH/saved-sessions"
CZEN="mb-conky-manager"
CSESSION="mb-conky-session"
HELPFILE="/usr/share/mabox/mabox-docs/helpfile-conkyzen.txt"
if ! . "$MB_COMMON_LIBDIR/mabox-include.cfg" 2> /dev/null; then
echo "Error: Failed to source mb-include.cfg in $MB_COMMON_LIBDIR" >&2
exit 1
fi
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
declareDependencies yad
case $LANG in
pl*)
CHOOSE_CONKY="Wybierz 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";;
es*)
CHOOSE_CONKY="Elegir recuadro Conky"
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"
;;
*)
CHOOSE_CONKY="Choose Conky"
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"
;;
esac
getSessions(){ # read any saved sessions from save-sessions file
menuSeparator "$SAVED_SESSIONS"
#menuItem "$DEFAULT" "$CSESSION $CSESSIONFILE"
if [ -e "$SESSIONS" ]
then
while read -r session ;do
[[ -z $session ]] && continue # skip if line is blank
menuItem "$session" "$CSESSION $session"
done < "$SESSIONS"
else
echo "$0: Failed to locate saved-sessions in $CONKYPATH" >&2
fi
}
loadChooserMenu(){
if type "$CZEN" &>/dev/null;then # mb-conkyzen script found
menuItem "$CHOOSE_CONKY" "$CZEN"
fi
}
loadNewsessionMenu(){
if type "$CZEN" &>/dev/null;then # mb-conkyzen script found
menuItem "$NEW_SESSION" "$CZEN -z"
fi
}
loadReloadMenu(){
if type "$CSESSION" &>/dev/null;then # mb-conky-session script found
menuItem "$RELOAD" "$CSESSION"
fi
}
loadSavedsessionSubmenu(){
if type "$CSESSION" &>/dev/null;then # mb-conky-session script found
menuSubmenu "Sessions" "$SAVED_SESSIONS"
getSessions
menuSubmenuEnd
fi
}
loadPinMenu(){
if type mb-conkypin &>/dev/null;then
menuItem "Ustaw pozycję Conky" "mb-conkypin"
menuSeparator
fi
}
loadEditMenu(){
#menuItem "$DEFAULT_CONKYRC" "geany $CONKYDEFAULT"
if [[ $(pidof conky) ]];then
menuSubmenu "RunningConky" "$RUNNING_CONKY"
menuSeparator "$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 }')
menuItem "$CONKY" "geany $CPATH"
done < "$CSESSIONFILE"
menuSubmenuEnd
else
menuItem "$NONE"
fi
}
getConkys(){
menuSubmenu "EditConky" "$EDIT_CONKY"
menuSeparator "$EDIT_CONKY"
if type mb-conkyedit &>/dev/null;then # mb-conkyedit script found
menuItem "$CONKY_EDITOR" "mb-conkyedit"
loadEditMenu
else
loadEditMenu
fi
menuSubmenuEnd
}
checkHelpfile(){
DLG="yad --text-info --center --borders=20 \
--title='BunsenLabs Conky Manager Help' \
--window-icon=distributor-logo-bunsenlabs \
--filename=$HELPFILE --fontname=Monospace \
--width=650 --height=700 \
--button=OK:0"
if [[ -e $HELPFILE ]];then
menuItem "Pomoc do Conky Manager" "$DLG"
fi
}
menuStart "Conkymenu" "Conky"
menuSeparator "Conky"
loadChooserMenu
loadReloadMenu
getConkys
menuSeparator
#loadPinMenu
loadNewsessionMenu
loadSavedsessionSubmenu
#menuSeparator
#checkHelpfile
menuEnd