From 2960ef69dff7b7083ed0fdca52154f1ba7ef9199 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Sun, 27 Sep 2020 12:29:11 +0200 Subject: [PATCH] tint2 pipemenu simplified --- usr/bin/mabox-tint2-pipemenu | 92 ++++++------------------- usr/bin/mabox-tint2-pipemenu.old | 114 +++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+), 70 deletions(-) create mode 100755 usr/bin/mabox-tint2-pipemenu.old diff --git a/usr/bin/mabox-tint2-pipemenu b/usr/bin/mabox-tint2-pipemenu index 89f17e6..dc804de 100755 --- a/usr/bin/mabox-tint2-pipemenu +++ b/usr/bin/mabox-tint2-pipemenu @@ -1,114 +1,66 @@ #!/bin/bash -# mabox-tint2-pipemenu - an Openbox pipemenu for tint2 manipulation -# Copyright (C) 2015-2016 damo -# -# 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 . - -MB_COMMON_LIBDIR='/usr/lib/mabox/mabox-common' TINT2PATH="$HOME/.config/tint2" TINT2RC="$TINT2PATH/tint2rc" TZEN="mb-tint2-manager" -if ! . "$MB_COMMON_LIBDIR/mabox-include.cfg" 2> /dev/null; then - echo $"Error: Failed to source mabox-include.cfg in $MB_COMMON_LIBDIR" >&2 - exit 1 -fi - case $LANG in pl*) + TITLE="Panel Tint2" RUNNING_TINT2="Działające Tint2" DEFAULT_TINT2RC="Domyślny tint2rc" EDIT_TINT2="Edytuj Tint2" TINT2_EDITOR="Wybierz pliki Tint2 do edycji..." TINT2_EDITOR_GUI="tint2conf (GUI)" - CHOOSE_TINT2="Wybierz Tint2" + CHOOSE_TINT2="Wybierz Tint2..." RESTART_TINT2="Restartuj Tint2" + CONFIGURE="Konfiguruj" ;; es*) + TITLE="Panel Tint2" RUNNING_TINT2="Panel(es) en ejecución" DEFAULT_TINT2RC="Panel tint2rc x defecto" EDIT_TINT2="Edición manual panel" TINT2_EDITOR="Elegir panel Tint2 a editar" TINT2_EDITOR_GUI="Editor gráfico" - CHOOSE_TINT2="Elegir un panel" + CHOOSE_TINT2="Elegir un panel..." RESTART_TINT2="Reiniciar panel(es)" + CONFIGURE="Configurar" ;; *) + TITLE="Tint2 Panel" RUNNING_TINT2="Running Tint2" DEFAULT_TINT2RC="Default tint2rc" EDIT_TINT2="Edit Tint2" TINT2_EDITOR="Choose Tint2 to edit" TINT2_EDITOR_GUI="tint2conf (GUI)" - CHOOSE_TINT2="Choose Tint2" + CHOOSE_TINT2="Choose Tint2..." RESTART_TINT2="Restart Tint2" + CONFIGURE="Configure" ;; esac -loadTEditmenu(){ - menuSeparator - menuItem "$DEFAULT_TINT2RC" "geany $TINT2RC" - if [ "$(pidof tint2)" ];then - menuSubmenu "RunningTint2" "$RUNNING_TINT2" - menuSeparator "$RUNNING_TINT2" - pgrep -a tint2 | while read -r pid cmd; do +out+=("^sep($TITLE)") +out+=("$CHOOSE_TINT2,$TZEN") +out+=("$RESTART_TINT2,mb-tint2restart") + +if [ "$(pidof tint2)" ];then +out+=("^sep($TINT2_EDITOR_GUI)") + while read -r pid cmd; do if [[ ${cmd%% *} = tint2 ]]; then TINT=${cmd##* } - TINT2=${TINT#$HOME/.config/} + TINT2=${TINT#$HOME/.config/tint2/} if [[ $TINT = tint2 ]];then TINT="$TINT2RC" TINT2="$DEFAULT_TINT2RC" fi - menuItem "$TINT2" "geany $TINT" + out+=("$CONFIGURE $TINT2,tint2conf $TINT") fi - done - menuSubmenuEnd - fi -} + done < <(pgrep -a tint2) +fi +#out+=("^sep($EDIT_TINT2)") -getTint2s(){ - menuSubmenu "EditTint2" "$EDIT_TINT2" - menuSeparator "$EDIT_TINT2" - menuItem "$TINT2_EDITOR_GUI" "tint2conf" - if type mb-tint2edit &>/dev/null;then # mb-tint2edit script found - menuItem "$TINT2_EDITOR" "mb-tint2edit" - loadTEditmenu - else - loadTEditmenu - fi - menuSubmenuEnd -} -loadChoosermenu(){ - if type $TZEN &>/dev/null;then # mb-tint2zen script found - menuItem "$CHOOSE_TINT2" "$TZEN" - fi -} - -loadRestartmenu(){ - if [ "$(pidof tint2)" ];then - if type mb-tint2restart &>/dev/null;then # mb-tint2restart script found - menuItem "$RESTART_TINT2" "mb-tint2restart" - fi - fi -} - -menuStart "Tintmenu" "Tint2" -menuSeparator "Tint2 panel" -loadChoosermenu -loadRestartmenu -getTint2s -menuEnd +printf '%s\n' "${out[@]}" diff --git a/usr/bin/mabox-tint2-pipemenu.old b/usr/bin/mabox-tint2-pipemenu.old new file mode 100755 index 0000000..89f17e6 --- /dev/null +++ b/usr/bin/mabox-tint2-pipemenu.old @@ -0,0 +1,114 @@ +#!/bin/bash + +# mabox-tint2-pipemenu - an Openbox pipemenu for tint2 manipulation +# Copyright (C) 2015-2016 damo +# +# 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 . + +MB_COMMON_LIBDIR='/usr/lib/mabox/mabox-common' + +TINT2PATH="$HOME/.config/tint2" +TINT2RC="$TINT2PATH/tint2rc" +TZEN="mb-tint2-manager" + +if ! . "$MB_COMMON_LIBDIR/mabox-include.cfg" 2> /dev/null; then + echo $"Error: Failed to source mabox-include.cfg in $MB_COMMON_LIBDIR" >&2 + exit 1 +fi + +case $LANG in + pl*) + RUNNING_TINT2="Działające Tint2" + DEFAULT_TINT2RC="Domyślny tint2rc" + EDIT_TINT2="Edytuj Tint2" + TINT2_EDITOR="Wybierz pliki Tint2 do edycji..." + TINT2_EDITOR_GUI="tint2conf (GUI)" + CHOOSE_TINT2="Wybierz Tint2" + RESTART_TINT2="Restartuj Tint2" + ;; + es*) + RUNNING_TINT2="Panel(es) en ejecución" + DEFAULT_TINT2RC="Panel tint2rc x defecto" + EDIT_TINT2="Edición manual panel" + TINT2_EDITOR="Elegir panel Tint2 a editar" + TINT2_EDITOR_GUI="Editor gráfico" + CHOOSE_TINT2="Elegir un panel" + RESTART_TINT2="Reiniciar panel(es)" + ;; + *) + RUNNING_TINT2="Running Tint2" + DEFAULT_TINT2RC="Default tint2rc" + EDIT_TINT2="Edit Tint2" + TINT2_EDITOR="Choose Tint2 to edit" + TINT2_EDITOR_GUI="tint2conf (GUI)" + CHOOSE_TINT2="Choose Tint2" + RESTART_TINT2="Restart Tint2" + ;; +esac + + +loadTEditmenu(){ + menuSeparator + menuItem "$DEFAULT_TINT2RC" "geany $TINT2RC" + if [ "$(pidof tint2)" ];then + menuSubmenu "RunningTint2" "$RUNNING_TINT2" + menuSeparator "$RUNNING_TINT2" + pgrep -a tint2 | while read -r pid cmd; do + if [[ ${cmd%% *} = tint2 ]]; then + TINT=${cmd##* } + TINT2=${TINT#$HOME/.config/} + if [[ $TINT = tint2 ]];then + TINT="$TINT2RC" + TINT2="$DEFAULT_TINT2RC" + fi + menuItem "$TINT2" "geany $TINT" + fi + done + menuSubmenuEnd + fi +} + +getTint2s(){ + menuSubmenu "EditTint2" "$EDIT_TINT2" + menuSeparator "$EDIT_TINT2" + menuItem "$TINT2_EDITOR_GUI" "tint2conf" + if type mb-tint2edit &>/dev/null;then # mb-tint2edit script found + menuItem "$TINT2_EDITOR" "mb-tint2edit" + loadTEditmenu + else + loadTEditmenu + fi + menuSubmenuEnd +} + +loadChoosermenu(){ + if type $TZEN &>/dev/null;then # mb-tint2zen script found + menuItem "$CHOOSE_TINT2" "$TZEN" + fi +} + +loadRestartmenu(){ + if [ "$(pidof tint2)" ];then + if type mb-tint2restart &>/dev/null;then # mb-tint2restart script found + menuItem "$RESTART_TINT2" "mb-tint2restart" + fi + fi +} + +menuStart "Tintmenu" "Tint2" +menuSeparator "Tint2 panel" +loadChoosermenu +loadRestartmenu +getTint2s +menuEnd