#!/bin/bash
# jgkeys-pipe - native jgmenu pipemenu with keyboard shortcuts
#
case $LANG in
pl*)
APPS="Aplikacje"
FILEMNGR="Menadżer plików"
BROWSER="Przeglądarka WWW"
TERMINAL="Terminal"
EDITOR="Edytor tekstu"
FSEARCH="Wyszukiwanie plików"
RESMON="Monitor zasobów"
PYRADIO="PyRadio"
VOLUME="Kontrola głośności"
COMPOSITOR="wł/wył Picom"
WINDOWS="Okna"
HALF="połowa ekranu"
FULL="Pełny ekran"
ARROWS="Strzałki"
SHOW_DESKTOP="pokaż pulpit"
PANELS="Menu/Panele boczne"
M_MAIN="Główne menu"
M_SETTINGS="Menu ustawień"
M_HELP="Menu pomocy (to menu)"
PLACES="Lewy (miejsca)"
RIGHT="Prawy (ustawienia/pomoc)"
LOCK="Blokada ekranu"
EXIT="Wyloguj..."
HELPERS="Pomocnicy"
HISTORY="Ściągawka z historii"
ESPANSO="Espanso - text expander"
JGTILE="Kafelkowanie okien"
SHORTCUTS="Wszystkie skróty"
REMOVE="Usuń to menu z panelu"
;;
es*)
APPS="Ejecutar"
FILEMNGR="gestor archivos"
BROWSER="Navegador"
TERMINAL="Terminal"
EDITOR="Editor de textos"
FSEARCH="FSearch"
RESMON="Monitor de recursos"
PYRADIO="Internet Radio"
VOLUME="control volumen "
COMPOSITOR="activa/desact compositor"
WINDOWS="VENTANAS"
HALF="1/2 pantalla"
FULL="Toggle Full Screen"
ARROWS="Arrows"
SHOW_DESKTOP="mostrar escritorio"
PANELS="Paneles Laterales"
M_MAIN="Menú principal"
M_SETTINGS="Menú de configuración"
M_HELP="Menú de ayuda"
PLACES="Lugares (izquierda)"
RIGHT="Ajustes (derecha)"
LOCK="Bloquear pantalla"
EXIT="Salir "
HELPERS="Ayudantes"
HISTORY="Historia breve"
ESPANSO="Espanso - text expander"
JGTILE="Tiling helper"
SHORTCUTS="Atajos del teclado"
REMOVE="Eliminar este menú del panel"
;;
*)
APPS="Applications"
FILEMNGR="File Manager"
BROWSER="WWW browser"
TERMINAL="Terminal"
EDITOR="Text Editor"
FSEARCH="FSearch"
RESMON="Resource Monitor"
PYRADIO="Internet Radio"
VOLUME="Volume Control"
COMPOSITOR="toggle Picom (Compositor)"
WINDOWS="Windows"
HALF="Half screen"
FULL="Toggle Full Screen"
ARROWS="Arrows"
SHOW_DESKTOP="Show desktop"
PANELS="Menu/SidePanels"
M_MAIN="Main Menu"
M_SETTINGS="Settings Menu"
M_HELP="Help (this) Menu"
PLACES="Places Sidepanel (Left)"
RIGHT="Help/Settings Sidepanel (Right)"
LOCK="Lock screen"
EXIT="Exit Dialog"
HELPERS="Helpers"
HISTORY="History helper"
ESPANSO="Espanso - text expander"
JGTILE="Tiling helper"
SHORTCUTS="All Keybindings"
REMOVE="Remove this menu from panel"
;;
esac
out+=("^sep($APPS)")
out+=("$(printf "%11s %s,%s" "W-f" "$FILEMNGR" "exo-open --launch FileManager")")
out+=("$(printf "%11s %s,%s" "W-w" "$BROWSER" "exo-open --launch WebBrowser")")
out+=("$(printf "%11s %s,%s" "W-t" "$TERMINAL" "exo-open --launch TerminalEmulator")")
out+=("$(printf "%11s %s,%s" "W-grave" "Quake-like $TERMINAL" "mabox-terminal")")
out+=("$(printf "%11s %s,%s" "W-e" "$EDITOR" geany)")
out+=("$(printf "%11s %s,%s" "W-g" "Galculator" galculator)")
out+=("$(printf "%11s %s,%s" "W-h" "$RESMON" "^term(bpytop)")")
out+=("$(printf "%11s %s,%s" "W-/" "$FSEARCH" fsearch)")
out+=("$(printf "%11s %s,%s" "W-r" "$PYRADIO" "sakura -e 'pyradio'")")
out+=("$(printf "%11s %s,%s" "W-v" "$VOLUME" pavucontrol)")
out+=("$(printf "%11s %s,%s" "W-c" "$COMPOSITOR" compton_toggle)")
out+=("$(printf "%11s %s,%s" "W-l" "$LOCK" "betterlockscreen -l")")
out+=("$(printf "%11s %s,%s" "W-x" "$EXIT" "mb-jgtools mblogout")")
out+=("^sep($PANELS)")
out+=("$(printf "%11s %s,%s" "W" "$M_MAIN" "mb-jgtools main")")
out+=("$(printf "%11s %s,%s" "W-s" "$M_SETTINGS" "mb-jgtools settings")")
out+=("$(printf "%11s %s,%s" "W-A-k" "$M_HELP" "jgkeys-pipe -s")")
out+=("$(printf "%11s %s,%s" "C-W-Left" "$PLACES" "mb-jgtools places")")
out+=("$(printf "%11s %s,%s" "C-W-Right" "$RIGHT" "mb-jgtools right")")
out+=("^sep($WINDOWS)")
out+=("$(printf "%11s %s,%s" "W-d" "$SHOW_DESKTOP" show_desktop)")
out+=("$(printf "%11s %s,%s" "W-$ARROWS" "$HALF")")
out+=("$(printf "%11s %s,%s" "F11/W-Enter" "$FULL")")
out+=("^sep($HELPERS)")
out+=("$(printf "%11s %s,%s" "W-A-t" "$JGTILE" "jgtile")")
out+=("$(printf "%11s %s,%s" "W-A-h" "$HISTORY" "jghistory-pipe -s")")
out+=("$(printf "%11s %s,%s" "W-A-e" "$ESPANSO" "jgespanso-pipe -s")")
out+=("^sep()")
out+=("$(printf "%s,%s" "$SHORTCUTS" "mb-kb --gui &>/dev/null")")
### RUN
if [ $1 == "-s" ]; then
. /usr/bin/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
MENU_PADDING_TOP=0
MENU_HALIGN="center"
MENU_VALIGN="center"
jgmenu_icon_size=0
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
mkconfigfile
cat < ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
#printf '%s\n' "${out[@]}" > $HOME/.config/mabox/shortkeys.csv
if [ $1 == "-r" ]; then
printf '%s\n' "^sep()"
printf '%s\n' "$REMOVE,mb-setvar places_keyspipe=false"
fi