mabox-pipemenus/usr/bin/jgkeys-pipe

131 lines
3.8 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"
PANELS="Menu/Panele boczne"
M_MAIN="Główne menu"
M_SETTINGS="Menu ustawień"
PLACES="Lewy (miejsca)"
RIGHT="Prawy (ustawienia/pomoc)"
LOCK="Blokada ekranu"
EXIT="Wyloguj..."
REMOVE="Usuń to menu z panelu"
;;
es*)
APPS="Ejacutar"
FILEMNGR="gestor archivos"
BROWSER="Navegador"
TERMINAL="Terminal"
EDITOR="Editor de textos"
FSEARCH="FSearch"
PANELS="Paneles Laterales"
M_MAIN="Menú principal"
M_SETTINGS="Menú de configuración"
PLACES="Lugares (izquierda)"
RIGHT="Ajustes (derecha)"
LOCK="Bloquear pantalla"
EXIT="Salir "
REMOVE="Eliminar este menú del panel"
;;
*)
APPS="Applications"
FILEMNGR="File Manager"
BROWSER="WWW browser"
TERMINAL="Terminal"
EDITOR="Text Editor"
FSEARCH="FSearch"
PANELS="Menu/SidePanels"
M_MAIN="Main Menu"
M_SETTINGS="Settings Menu"
PLACES="Places Sidepanel (Left)"
RIGHT="Help/Settings Sidepanel (Right)"
LOCK="Lock screen"
EXIT="Exit Dialog"
REMOVE="Remove this menu from panel"
;;
esac
if [ $1 == "-s" ]; then
. $HOME/.config/mabox/mabox.conf
jgmenu_theme=${jgmenu_theme:-obtheme}
case $jgmenu_theme in
default)
export color_norm_fg="#FFFFFF "
;;
obtheme)
export color_title_fg="#FFFFFF "
ob_file=$HOME/.config/openbox/rc.xml
[[ -f $ob_file ]] && wm_theme=$(awk '/<theme>/ {while (getline n) {if (match(n, /<name>/)){l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$ob_file")
while read -r a b c
do
[[ -n "$a" && "$a" != [[:blank:]#]* ]] && export "$a$b$c"
done < $HOME/.config/mabox/jgobthemes/$wm_theme.colorrc
;;
*)
export color_norm_fg="#FFFFFF "
while read -r a b c
do
[[ -n "$a" && "$a" != [[:blank:]#]* ]] && export "$a$b$c"
done < $HOME/.config/mabox/jgobthemes/$jgmenu_theme.colorrc
;;
esac
menu_font_size=${menu_font_size:-9}
menu_font_family=${menu_font_family:-Noto Sans Medium}
jgmenu_font="${menu_font_family} ${menu_font_size}"
fi
out+=("^sep($APPS)")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "W-f" "$FILEMNGR" "exo-open --launch FileManager")")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "W-w" "$BROWSER" "exo-open --launch WebBrowser")")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "W-t" "$TERMINAL" "exo-open --launch TerminalEmulator")")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "W-e" "$EDITOR" geany)")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "W-/" "$FSEARCH" fsearch)")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "W-l" "$LOCK" "betterlockscreen -l")")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "W-x" "$EXIT" "mb-jgtools mblogout")")
out+=("^sep($PANELS)")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "W" "$M_MAIN" "mb-jgtools main")")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "W-s" "$M_SETTINGS" "mb-jgtools settings")")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "C-tab" "$PLACES" "mb-jgtools places")")
out+=("$(printf "<tt>%-10s</tt> %s,%s" "W-tab" "$RIGHT" "mb-jgtools right")")
### RUN
if [ $1 == "-s" ]; then
. /usr/bin/pipemenu-standalone.cfg
MENU_PADDING_TOP=0
MENU_HALIGN="center"
MENU_VALIGN="center"
jgmenu_icon_size=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' "^sep()"
printf '%s\n' "$REMOVE,mb-setvar places_keyspipe=false"