mabox-pipemenus/usr/bin/mbhelper

90 lines
2.0 KiB
Plaintext
Raw Normal View History

2021-05-28 02:51:24 +02:00
#!/bin/bash
# mbhelper - command palette like menu, search and run, quick access to
# all important config tools, edit config files, show keybord shortcuts
# favorites, online resources and more.
#
case $LANG in
pl*)
LNGDIR="pl"
TYPE_TO_SEARCH="pisz aby wyszukać"
2021-08-12 22:05:22 +02:00
ME="MB helper (to menu)"
EDIT="Dostosuj to menu"
RESET="Przywróć domyślne"
2021-05-28 02:51:24 +02:00
;;
es*)
LNGDIR="en"
TYPE_TO_SEARCH="type to search"
2021-08-12 22:05:22 +02:00
ME="MBhelper (this menu)"
EDIT="Edit this menu"
RESET="Reset to default"
2021-05-28 02:51:24 +02:00
;;
*)
LNGDIR="en"
TYPE_TO_SEARCH="type to search"
2021-08-12 22:05:22 +02:00
ME="MBhelper (this menu)"
EDIT="Edit this menu"
RESET="Reset to default"
2021-05-28 02:51:24 +02:00
;;
esac
2021-08-12 22:05:22 +02:00
[[ -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=""
2021-05-28 02:51:24 +02:00
2021-08-12 22:05:22 +02:00
run() {
2021-05-28 02:51:24 +02:00
### RUN
2021-06-09 12:25:27 +02:00
if [[ $1 = "-s" ]]; then
2021-05-28 02:51:24 +02:00
. /usr/bin/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
2021-05-31 15:00:35 +02:00
MENU_PADDING_TOP=$((jgtools_padding+24))
2021-05-28 02:51:24 +02:00
MENU_HALIGN="center"
MENU_VALIGN="top"
MENU_MARGIN_Y=40
jgmenu_icon_size=0
JGWIDTH=500
2021-06-03 14:06:57 +02:00
#MENU_HEIGHT_MAX=600
2021-05-28 02:51:24 +02:00
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
2021-05-31 15:00:35 +02:00
@search,,25,15,292,20,4,left,top,auto,#262626,"""<big></big> <i>$TYPE_TO_SEARCH</i>"""
2021-05-28 02:51:24 +02:00
. $CSVFILE
2021-08-12 22:05:22 +02:00
^sep($ME)
$EDIT,mbhelper edit
${TODEFAULT}
2021-05-28 02:51:24 +02:00
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
2021-08-12 22:05:22 +02:00
}
2021-05-28 02:51:24 +02:00
2021-08-12 22:05:22 +02:00
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
2021-05-28 02:51:24 +02:00