mabox-pipemenus/usr/bin/mabox-tint2-pipemenu

115 lines
3.3 KiB
Plaintext
Raw Normal View History

2016-03-26 10:18:26 +01:00
#!/bin/bash
# mabox-tint2-pipemenu - an Openbox pipemenu for tint2 manipulation
# Copyright (C) 2015-2016 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'
TINT2PATH="$HOME/.config/tint2"
TINT2RC="$TINT2PATH/tint2rc"
2020-08-29 10:00:57 +02:00
TZEN="mb-tint2-manager"
2016-03-26 10:18:26 +01:00
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
2017-01-04 19:18:24 +01:00
case $LANG in
pl*)
RUNNING_TINT2="Działające Tint2"
DEFAULT_TINT2RC="Domyślny tint2rc"
EDIT_TINT2="Edytuj Tint2"
2020-04-25 17:36:39 +02:00
TINT2_EDITOR="Wybierz pliki Tint2 do edycji..."
2018-12-13 12:39:01 +01:00
TINT2_EDITOR_GUI="tint2conf (GUI)"
2017-01-04 19:18:24 +01:00
CHOOSE_TINT2="Wybierz Tint2"
RESTART_TINT2="Restartuj Tint2"
;;
2020-08-26 15:50:04 +02:00
es*)
2020-08-29 20:47:05 +02:00
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)"
2020-08-26 15:50:04 +02:00
;;
2017-01-04 19:18:24 +01:00
*)
RUNNING_TINT2="Running Tint2"
DEFAULT_TINT2RC="Default tint2rc"
EDIT_TINT2="Edit Tint2"
2018-12-13 12:39:01 +01:00
TINT2_EDITOR="Choose Tint2 to edit"
TINT2_EDITOR_GUI="tint2conf (GUI)"
2017-01-04 19:18:24 +01:00
CHOOSE_TINT2="Choose Tint2"
RESTART_TINT2="Restart Tint2"
;;
esac
2016-03-26 10:18:26 +01:00
loadTEditmenu(){
menuSeparator
2017-01-04 19:18:24 +01:00
menuItem "$DEFAULT_TINT2RC" "geany $TINT2RC"
2016-03-26 10:18:26 +01:00
if [ "$(pidof tint2)" ];then
2017-01-04 19:18:24 +01:00
menuSubmenu "RunningTint2" "$RUNNING_TINT2"
2020-09-01 19:24:09 +02:00
menuSeparator "$RUNNING_TINT2"
2016-03-26 10:18:26 +01:00
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"
2017-01-04 19:18:24 +01:00
TINT2="$DEFAULT_TINT2RC"
2016-03-26 10:18:26 +01:00
fi
menuItem "$TINT2" "geany $TINT"
fi
done
menuSubmenuEnd
fi
}
getTint2s(){
2017-01-04 19:18:24 +01:00
menuSubmenu "EditTint2" "$EDIT_TINT2"
2020-09-01 19:24:09 +02:00
menuSeparator "$EDIT_TINT2"
2018-12-13 13:54:32 +01:00
menuItem "$TINT2_EDITOR_GUI" "tint2conf"
2016-03-26 10:18:26 +01:00
if type mb-tint2edit &>/dev/null;then # mb-tint2edit script found
2017-01-04 19:18:24 +01:00
menuItem "$TINT2_EDITOR" "mb-tint2edit"
2016-03-26 10:18:26 +01:00
loadTEditmenu
else
loadTEditmenu
fi
menuSubmenuEnd
}
loadChoosermenu(){
if type $TZEN &>/dev/null;then # mb-tint2zen script found
2017-01-04 19:18:24 +01:00
menuItem "$CHOOSE_TINT2" "$TZEN"
2016-03-26 10:18:26 +01:00
fi
}
loadRestartmenu(){
if [ "$(pidof tint2)" ];then
if type mb-tint2restart &>/dev/null;then # mb-tint2restart script found
2017-01-04 19:18:24 +01:00
menuItem "$RESTART_TINT2" "mb-tint2restart"
2016-03-26 10:18:26 +01:00
fi
fi
}
menuStart "Tintmenu" "Tint2"
2020-04-25 17:36:39 +02:00
menuSeparator "Tint2 panel"
2016-03-26 10:18:26 +01:00
loadChoosermenu
loadRestartmenu
getTint2s
menuEnd