mabox-pipemenus/usr/bin/jgkeys-pipe
2021-05-23 10:20:13 +02:00

177 lines
6.0 KiB
Bash
Executable File

#!/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 "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-f" "$FILEMNGR" "exo-open --launch FileManager")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-w" "$BROWSER" "exo-open --launch WebBrowser")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-t" "$TERMINAL" "exo-open --launch TerminalEmulator")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-grave" "Quake-like $TERMINAL" "mabox-terminal")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-e" "$EDITOR" geany)")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-g" "Galculator" galculator)")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-h" "$RESMON" "^term(bpytop)")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-/" "$FSEARCH" fsearch)")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-r" "$PYRADIO" "sakura -e 'pyradio'")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-v" "$VOLUME" pavucontrol)")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-c" "$COMPOSITOR" compton_toggle)")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-l" "$LOCK" "betterlockscreen -l")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-x" "$EXIT" "mb-jgtools mblogout")")
out+=("^sep($PANELS)")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W" "$M_MAIN" "mb-jgtools main")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-s" "$M_SETTINGS" "mb-jgtools settings")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-A-k" "$M_HELP" "jgkeys-pipe -s")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "C-W-Left" "$PLACES" "mb-jgtools places")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "C-W-Right" "$RIGHT" "mb-jgtools right")")
out+=("^sep($WINDOWS)")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-d" "$SHOW_DESKTOP" show_desktop)")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-$ARROWS" "$HALF")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "F11/W-Enter" "$FULL")")
out+=("^sep($HELPERS)")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-A-t" "$JGTILE" "jgtile")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%s" "W-A-h" "$HISTORY" "jghistory-pipe -s")")
out+=("$(printf "<b><tt>%11s</tt></b> <i> %s</i>,%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 <<EOF > ${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' "<i>$REMOVE</i>,mb-setvar places_keyspipe=false;mb-jgtools places"
fi