jgdesktops and mbhelper fixes

master
Daniel Napora 2021-08-12 22:05:22 +02:00
parent 7a632f51c2
commit 077dfef52a
2 changed files with 39 additions and 7 deletions

View File

@ -13,7 +13,7 @@ case $LANG in
ALL_DESK="Wszystkich pulpitach"
MANAGE="Pulpity"
ADD="<b>Dodaj nowy</b>"
REMOVE="<b>Usuń ostatni</b>"
REMOVE_LAST="<b>Usuń ostatni</b>"
DESKMNGR="Menadżer sesji pulpitowych"
;;
es*)
@ -27,7 +27,7 @@ case $LANG in
ALL_DESK="All Desktops"
MANAGE="Manage Desktops"
ADD="<b>Add new</b> desktop"
REMOVE="<b>Remove last</b> desktop"
REMOVE_LAST="<b>Remove last</b> desktop"
DESKMNGR="Desktop session Manager"
;;
*)
@ -41,7 +41,7 @@ case $LANG in
ALL_DESK="All Desktops"
MANAGE="Manage Desktops"
ADD="<b>Add new</b> desktop"
REMOVE="<b>Remove last</b> desktop"
REMOVE_LAST="<b>Remove last</b> desktop"
DESKMNGR="Desktop session Manager"
;;
esac
@ -89,7 +89,7 @@ fi
out+=("^sep($MANAGE)")
desktops=$(wmctrl -d |wc -l)
out+=("  $ADD,wmctrl -n $((desktops+1))")
out+=("  $REMOVE,wmctrl -n $((desktops-1))")
out+=("  $REMOVE_LAST,wmctrl -n $((desktops-1))")
out+=("^sep()")
out+=("$DESKMNGR,jgdeskmngr -s")

View File

@ -8,22 +8,31 @@ case $LANG in
pl*)
LNGDIR="pl"
TYPE_TO_SEARCH="pisz aby wyszukać"
ME="MB helper (to menu)"
EDIT="Dostosuj to menu"
RESET="Przywróć domyślne"
;;
es*)
LNGDIR="en"
TYPE_TO_SEARCH="type to search"
ME="MBhelper (this menu)"
EDIT="Edit this menu"
RESET="Reset to default"
;;
*)
LNGDIR="en"
TYPE_TO_SEARCH="type to search"
ME="MBhelper (this menu)"
EDIT="Edit this menu"
RESET="Reset to default"
;;
esac
##[[ -f "$HOME/.config/mabox/mbhelper.csv" ]] && CSVFILE="$HOME/.config/mabox/mbhelper.csv" || CSVFILE="/usr/share/mabox/lang/${LNGDIR}/.config/mabox/mbhelper.csv"
CSVFILE="/usr/share/mabox/lang/${LNGDIR}/.config/mabox/mbhelper.csv"
[[ -f "$HOME/.config/mabox/mbhelper.csv" ]] && CSVFILE="$HOME/.config/mabox/mbhelper.csv" TODEFAULT="$RESET,mbhelper reset"|| CSVFILE="/usr/share/mabox/lang/${LNGDIR}/.config/mabox/mbhelper.csv" TODEFAULT=""
run() {
### RUN
if [[ $1 = "-s" ]]; then
. /usr/bin/pipemenu-standalone.cfg
@ -45,6 +54,10 @@ mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@search,,25,15,292,20,4,left,top,auto,#262626,"""<big></big> <i>$TYPE_TO_SEARCH</i>"""
. $CSVFILE
^sep($ME)
$EDIT,mbhelper edit
${TODEFAULT}
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
@ -53,5 +66,24 @@ exit 0
fi
printf '%s\n' "${out[@]}"
}
edit() {
if [[ -f "$HOME/.config/mabox/mbhelper.csv" ]];then
geany "$HOME/.config/mabox/mbhelper.csv"
else
cp "/usr/share/mabox/lang/${LNGDIR}/.config/mabox/mbhelper.csv" "$HOME/.config/mabox/mbhelper.csv"
geany "$HOME/.config/mabox/mbhelper.csv"
fi
}
reset() {
rm "$HOME/.config/mabox/mbhelper.csv"
}
case "$1" in
-e|edit) edit;;
-r|reset) reset;;
*) run "$1";;
esac