mabox-lxde/bin/lxde-jgtools

940 lines
31 KiB
Plaintext
Raw Normal View History

2021-09-13 01:35:53 +02:00
#!/bin/bash -l
#
# lxde-jgtools: Menu, Sidepanels, Screenshot Tool and Exit Dialog for Mabox LXDE
# Copyright (C) 2019-2021 Daniel Napora <napcok@gmail.com>
. $HOME/.config/mabox/mabox.conf
unset font
unset menu_gradient_pos
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/lxde-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")
if [ ! -f "$HOME/.config/mabox/jgobthemes/${wm_theme// /_}.colorrc" ]; then
obtheme2jgmenu
fi
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_title_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}"
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
gtkbookmarks() {
if [ $places_bookmarks == true ]; then
BOOKMARKS="$HOME/.gtk-bookmarks"
if [[ -s "$BOOKMARKS" ]]; then
case $LANG in
pl*) GTK_BOOKMARKS="Zakładki";;
es*) GTK_BOOKMARKS="Marcadores" ;;
*) GTK_BOOKMARKS="Bookmarks" ;;
esac
while read -r line
do
uri=$(echo $line | cut -b 8- | cut -d' ' -f1 | sed 's/%20/ /g')
dirs+=(" ${line#* },^pipe(jgbrowser \"${uri}\")")
done <"$BOOKMARKS"
printf "%b\n" "^sep($GTK_BOOKMARKS)"
printf '%s\n' "${dirs[@]}"
fi
else
printf ""
fi
}
WEBBROWSER="exo-open --launch WebBrowser"
OSNAME=$(lsb_release -d | awk '{print $2}')
OSVERSION=$(lsb_release -r | awk '{print $2}')
OSCODE=$(lsb_release -c | awk '{print $2}')
mkconfigfile() {
cat <<EOF > ${CONFIG_FILE}
position_mode = ${POSITION_MODE:-fixed}
csv_cmd = apps
stay_alive = 0
hide_back_items = ${HIDE_BACK_ITEMS:-0}
terminal_exec = terminator
terminal_args = -e
tabs = ${TABS:-220}
menu_border = ${jgtools_border:-0}
# MENU MARGIN
menu_margin_x = ${menu_margin_x:-0}
menu_margin_y = ${MENU_MARGIN_Y:-0}
sub_spacing = ${submenu_spacing:-0}
menu_width = ${JGWIDTH:-40}
menu_height_min = ${MENU_HEIGHT_MIN:-0}
menu_height_max = ${MENU_HEIGHT_MAX:-0}
menu_padding_top = ${MENU_PADDING_TOP:-70}
menu_padding_right = ${jgtools_padding:-0}
menu_padding_bottom = ${jgtools_padding:-0}
menu_padding_left = ${jgtools_padding:-0}
menu_radius = ${MENU_RADIUS:-0}
menu_valign = ${MENU_VALIGN:-top}
menu_halign = ${MENU_HALIGN:-left}
item_height = ${jgmenu_item_height:-20}
item_halign = ${ITEM_HALIGN:-left}
item_padding_x = 4
item_margin_x = ${item_margin_x:-0}
item_margin_y = ${item_margin_y:-2}
item_radius = ${item_radius:-2}
item_border = ${item_border:-0}
arrow_string = ${ARROW_STRING:-⮞}
columns = ${COLUMNS:-1}
menu_gradient_pos = ${menu_gradient_pos:-none}
color_menu_bg = ${color_menu_bg:-#222222 80}
color_menu_bg_to = ${color_menu_bg_to:- #000000 100}
color_menu_border = ${color_menu_border:-#2f9b85 100}
color_norm_bg = ${color_norm_bg:-#000000 0}
color_norm_fg = ${color_norm_fg:-#CCCCCC 100}
color_sel_bg = ${color_sel_bg:-#169f6f 60}
color_sel_fg = ${color_sel_fg:-#f8f8f8 100}
color_sel_border = ${color_sel_border:-#504e65 100}
color_sep_fg = ${color_sep_fg:-#4D4D4D 100}
color_sep_bg = ${color_sep_bg:-#169f6f 100}
color_title_fg = ${color_title_fg:-#4D4D4D 100}
color_title_border = ${color_title_border:-#169f6f 100}
color_title_bg = ${color_title_bg:-#169f6f 100}
color_scroll_ind = ${color_scroll_ind:-#504e65 100}
sep_markup = weight="bold" foreground="${color_title_fg% *}"
sep_halign = ${sep_halign:-center}
sep_height = ${sep_height:-5}
font = ${jgmenu_font:-Noto Sans Medium 9}
icon_size = ${jgmenu_icon_size:-18}
icon_theme = ${jgmenu_icon_theme:-Numix-Square}
EOF
unset font
unset menu_gradient_pos
}
#MENU GŁÓWNE
main() {
mb-setvar jgtools_last="\"main ipc\""
CONFIG_FILE=$(mktemp)
trap "rm -f ${CONFIG_FILE}" EXIT
POSITION_MODE=${1:-pointer}
HIDE_BACK_ITEMS=1
#MENU_PADDING_TOP=24
MENU_PADDING_TOP=$((jgtools_padding + 24))
panels_topmargin=0
case $LANG in
pl*) TYPE_TO_SEARCH="Pisz aby Wyszukać"
APPS="Programy"
KEYS="Skroty klawiszowe"
SCREENSHOT="Zrzut ekranu"
LOCKSCR="Zablokuj ekran"
EXIT="Wyjscie..."
HELP="Pomoc"
UGUIDE="Przewodnik Mabox (online)"
SETTINGS="ustawienia"
;;
es*) TYPE_TO_SEARCH="Buscar"
APPS="Aplicationes"
KEYS="Atajos del teclado"
SCREENSHOT="Capturar Pantalla"
LOCKSCR="Bloquear pantalla"
EXIT="Salir..."
HELP="Ayuda"
UGUIDE="Mabox User Guide (online)"
SETTINGS="settings";;
*) TYPE_TO_SEARCH="Type to Search"
APPS="Applications"
KEYS="Keybindings"
SCREENSHOT="Screenshot"
LOCKSCR="Lock screen"
EXIT="Exit..."
HELP="Help"
UGUIDE="Mabox Users Guide (online)"
SETTINGS="settings";;
esac
#apps_in_submenu=true
rm -f ~/.config/jgmenu/append.csv
if [[ $apps_in_submenu == true ]]
then
cat <<EOF > $HOME/.config/jgmenu/prepend.csv
@text,,$((jgtools_padding + 24)),$((jgtools_padding + 4)),150,20,0,left,top,auto,#000000,<span size="large"></span>
@search,,$((jgtools_padding + 38)),$((jgtools_padding + 4)),150,20,2,left,top,auto,#000000 0,<i>$TYPE_TO_SEARCH</i>
^sep()
. ~/.config/mabox/lxde-favorites.csv
$APPS,^checkout(lx-apps),applications-other
^sep()
$KEYS, mbhelper -s,key_bindings
^sep()
$SCREENSHOT,mb-jgtools screenshot,emblem-photos
^sep()
$LOCKSCR,mbscreenlocker,system-lock-screen
^sep()
$EXIT,mb-jgtools mblogout,system-shutdown
^tag($SETTINGS)
. ~/.config/mabox/lxde-settings.csv
^sep($HELP)
$UGUIDE,^checkout(userguide),distributor-logo-mabox
Mabox Forum,exo-open --launch WebBrowser https://forum.maboxlinux.org/,distributor-logo-mabox
^tag(userguide)
. /usr/share/mb-jgtools/userguide.csv
. ~/.config/mabox/lxde-settings_tags.csv
^tag(lx-apps)"
EOF
else
cat <<EOF > $HOME/.config/jgmenu/prepend.csv
@text,,$((jgtools_padding + 24)),$((jgtools_padding + 4)),150,20,0,left,top,auto,#000000,<span size="large"></span>
@search,,$((jgtools_padding + 38)),$((jgtools_padding + 4)),150,20,2,left,top,auto,#000000 0,<i>$TYPE_TO_SEARCH</i>
^sep()
. ~/.config/mabox/lxde-favorites.csv
EOF
cat <<EOF > $HOME/.config/jgmenu/append.csv
^sep()
$KEYS, mbhelper -s,key_bindings
^sep()
$SCREENSHOT,mb-jgtools screenshot,emblem-photos
^sep()
$LOCKSCR,mbscreenlocker,system-lock-screen
^sep()
$EXIT,mb-jgtools mblogout,system-shutdown
^tag($SETTINGS)
. ~/.config/mabox/lxde-settings.csv
^sep($HELP)
$UGUIDE,^checkout(userguide),distributor-logo-mabox
MaboxForum,exo-open --launch WebBrowser https://forum.maboxlinux.org/,distributor-logo-mabox
^tag(userguide)
. /usr/share/mb-jgtools/userguide.csv
. ~/.config/mabox/lxde-settings_tags.csv
EOF
fi
[ $jgmenu_use_icons == false ] && jgmenu_icon_size=0
mkconfigfile
jgmenu --config-file=${CONFIG_FILE} 2>/dev/null
}
# PANEL PO PRAWEJ AKTUALIZACE-USTAWIENIA-POMOC
right() {
mb-setvar jgtools_last="\"right\""
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
[ $jgmenu_use_icons == false ] && jgmenu_icon_size=0
#BOTTOM_IMG=${right_bottom_img:-/usr/share/mb-jgtools/mabox_3D_gold.png}
MENU_HALIGN="right"
ITEM_HALIGN="left"
ARROW_STRING=" ⮜ "
JGWIDTH=40
TABS="100"
MENU_PADDING_TOP=$((jgtools_padding + 62))
menu_margin_x=${submenu_spacing:-0}
#panels_topmargin=${panels_topmargin:-0}
#### Compact or full height
if [[ $panels_heightpos == "full" ]]; then
eval $(xdotool getdisplaygeometry --shell)
MENU_HEIGHT_MIN="$HEIGHT"
MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN
MENU_RADIUS="0"
menu_margin_x="0"
elif [[ $panels_heightpos == "top" ]]; then
MENU_VALIGN="top"
MENU_MARGIN_Y=${panels_topmargin:-0}
elif [[ $panels_heightpos == "bottom" ]]; then
MENU_VALIGN="bottom"
MENU_MARGIN_Y=${panels_topmargin:-0}
else
MENU_VALIGN="center"
fi
case $LANG in
pl*)
TYPE_TO_SEARCH="pisz, aby wyszukać"
SOFT_MANAGEMENT="Zarządzanie oprogramowaniem"
PAMAC_UPDATE="Aktualizacja systemu (Pamac)"
CLI_UPDATE="Aktualizacja systemu (cli)"
PAMAC="Menadżer pakietów - Pamac"
RENEW_KEYS="Odnawianie kluczy"
MIRROR_RANK="Ranking mirrorów"
SETTINGS="Ustawienia"
MCC="Centrum Sterowania Mabox"
SYS_AND_HARDWARE="System i sprzęt"
LOOK_AND_FEEL="Wygląd i zachowanie"
HELP="Pomoc"
SHORTCUTS="Skróty klawiszowe"
ONLINE_RES="Zasoby online"
OTHER="Inne"
SCREENSHOT="Zrzut ekranu"
BACK="wróć"
FAST="Szybko"
ALL="Wszystkie"
GEOIP="Najbliższe"
MSM="Menadżer Ustawień Manjaro"
LOCALE_SETTINGS="Język i formaty"
LANGUAGE_PACKAGES="Pakiety językowe"
KERNEL="Jądro systemowe"
USER_ACCOUNTS="Konta użytkowników"
TIME_DATE="Data i Czas"
KEYBOARD="Ustawienia klawiatury"
HARDWARE="Konfiguracja sprzętowa"
ARANDR="Rozdzielczość ekranu"
SYSINFO_TITLE="Sys info"
SYSINFO="Informacje o systemie"
LXAPPEARANCE="Wystrój i ikony"
NITROGEN="Wybór tapety"
OBCONF="Menadżer konfiguracji OpenBox"
NOTIFYD="Konfiguracja powiadomień"
PREFERRED_APPS="Preferowane aplikacje"
LIGHTDM="Ustawienia Menedżera logowania"
POWER_MNGR="Ustawienia zasilania"
MABOX_DESK_ELEM="Elementy pulpitu Mabox"
TINT2="Panele Tint2"
COMPOSER="Kompozytor"
MABOX_THEMES="Predefiniowane konfiguracje pulpitu"
THEME_MNGR="Menadżer schematów"
UGUIDE_TITLE="Przewodnik Użytkownika Mabox"
UGUIDE=". /usr/share/mb-jgtools/userguide_PL.csv"
;;
es*)
TYPE_TO_SEARCH="Buscar"
SOFT_MANAGEMENT="Agregar/Quitar Software"
PAMAC_UPDATE="Actualizar el sistema(Tienda)"
CLI_UPDATE="Actualizar en la terminal (cli)"
PAMAC="Tienda de software"
RENEW_KEYS="Actualizar atajos de teclado"
MIRROR_RANK="Actualizar repositorios"
SETTINGS="Ajustes"
MCC="Centro de Control Mabox"
SYS_AND_HARDWARE="Sistema y Hardware"
LOOK_AND_FEEL="Apariencia"
HELP="Ayuda"
SHORTCUTS="Atajos del teclado"
ONLINE_RES="Recursos en línea"
OTHER="Otros"
SCREENSHOT="Captura Pantalla"
BACK="atrás"
FAST="Repositorios rápidos"
ALL="Todos los repositorios"
GEOIP="Repositorios locales"
MSM="Gastor de Configuración de Manjaro"
LOCALE_SETTINGS="Ajustes de idioma"
LANGUAGE_PACKAGES="Paquetes de idioma"
KERNEL="Núcleo"
USER_ACCOUNTS="Cuentas de usuario"
TIME_DATE="Hora y Fecha"
KEYBOARD="Ajustes del teclado"
HARDWARE="Configuración Hardware"
ARANDR="Resolución de pantalla"
SYSINFO_TITLE="Resumen sistema"
SYSINFO="Información de sistema"
LXAPPEARANCE="Temas e íconos"
NITROGEN="Fondos de pantalla"
OBCONF="Configuración de Openbox"
NOTIFYD="Notificaciones"
PREFERRED_APPS="Aplicaciones Preferidas"
LIGHTDM="Gestor de Inicio de sesión"
POWER_MNGR="Ajustes de energía"
MABOX_DESK_ELEM="Escritorio Mabox"
TINT2="Paneles Tint2"
COMPOSER="Compositor gráfico"
MABOX_THEMES="Temas Mabox"
THEME_MNGR="Gestor de Temas"
UGUIDE_TITLE="Mabox User Guide"
UGUIDE=". /usr/share/mb-jgtools/userguide.csv"
;;
*)
TYPE_TO_SEARCH="type to search"
SOFT_MANAGEMENT="Software management"
PAMAC_UPDATE="System update (Pamac)"
CLI_UPDATE="System update (cli)"
PAMAC="Pamac"
RENEW_KEYS="Renew keys"
MIRROR_RANK="Mirror ranking"
SETTINGS="Settings"
MCC="Mabox Control Center"
SYS_AND_HARDWARE="System and Hardware"
LOOK_AND_FEEL="Look and Feel"
HELP="Help"
SHORTCUTS="Keyboard Shortcuts"
ONLINE_RES="Online Resources"
OTHER="Other"
SCREENSHOT="Screenshot Tool"
BACK="back"
FAST="Fasttrack"
ALL="All"
GEOIP="Geoip"
MSM="Manjaro Settings Manager"
LOCALE_SETTINGS="Locale Settings"
LANGUAGE_PACKAGES="Language Packages"
KERNEL="Kernel"
USER_ACCOUNTS="User Accounts"
TIME_DATE="Time and Date"
KEYBOARD="Keyboard Settings"
HARDWARE="Hardware Configuration"
ARANDR="Screen resolution"
SYSINFO_TITLE="Sys info"
SYSINFO="System information"
LXAPPEARANCE="Themes and icons"
NITROGEN="Wallpaper"
OBCONF="Openbox Configuration Manager"
NOTIFYD="Notifycations"
PREFERRED_APPS="Preffered Applications"
LIGHTDM="Login Manager Settings"
POWER_MNGR="Power Manager"
MABOX_DESK_ELEM="Mabox Desktop"
TINT2="Tint2 Panel(s)"
COMPOSER="Composer"
MABOX_THEMES="Mabox Themes"
THEME_MNGR="Theme Manager"
UGUIDE_TITLE="Mabox User Guide"
UGUIDE=". /usr/share/mb-jgtools/userguide.csv"
;;
esac
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding + 2)),$((jgtools_padding + 2)),48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/distributor-logo-mabox.png
#@text,,$((jgtools_padding + 57)),$((jgtools_padding + 2)),200,20,4,left,top,auto,#111111,<big>$OSNAME $OSVERSION</big> <sup><b>LXDE</b></sup>
@text,,$((jgtools_padding + 57)),$((jgtools_padding + 2)),200,20,4,left,top,auto,#111111,<big>$OSNAME</big><sup> <b>LXDE</b></sup> <small>(pre-alpha)</small>
@text,,$((jgtools_padding + 57)),$((jgtools_padding + 22)),200,20,4,left,top,auto,#444444,<small>$USER@$HOSTNAME</small>
#@icon,,5,$(expr $MENU_HEIGHT_MIN - 180),240,180,4,center,top,,,$BOTTOM_IMG
@search,,$((gtools_padding + 72)),$((jgtools_padding + 42)),292,20,4,left,top,auto,#262626,"""<big></big> <small><i>$TYPE_TO_SEARCH</i></small>"""
. $HOME/.config/mabox/right-prepend.csv
^sep($SETTINGS)
$MCC,mcc,distributor-logo-mabox
^sep()
$SYS_AND_HARDWARE,^root(system),audiocard
$LOOK_AND_FEEL,^root(wyglad),preferences-color
^sep($SOFT_MANAGEMENT)
$PAMAC_UPDATE,pamac-manager --updates,system-upgrade
$CLI_UPDATE,^term(sudo pacman -Syyu),openterm
$PAMAC,pamac-manager,pamac
$RENEW_KEYS,^term(sudo pacman -Sy archlinux-keyring manjaro-keyring mabox-keyring),keysync
$MIRROR_RANK,^root(mirrory),download
^sep($HELP)
$UGUIDE_TITLE,^root(userguide),distributor-logo-mabox
Mabox Forum,exo-open --launch WebBrowser https://forum.maboxlinux.org,distributor-logo-mabox
#$SHORTCUTS,^pipe(jgkeys-pipe),key_bindings
$SHORTCUTS,mbhelper -s,key_bindings
$ONLINE_RES,^root(weblinks),web-browser
^sep($OTHER)
$SCREENSHOT,mb-jgtools screenshot,emblem-photos
. $HOME/.config/mabox/right-append.csv
. $HOME/.config/mabox/exit.csv
^tag(system)
^sep($SETTINGS)
$MCC,mcc,distributor-logo-mabox
^sep($SYS_AND_HARDWARE)
$MSM,manjaro-settings-manager,distributor-logo-manjaro
^sep()
$LOCALE_SETTINGS,manjaro-settings-manager -m msm_locale,chronometer
$LANGUAGE_PACKAGES,manjaro-settings-manager -m msm_language_packages,globe
$KERNEL,manjaro-settings-manager -m msm_kernel,distributor-logo-linux
$USER_ACCOUNTS,manjaro-settings-manager -m msm_users,system-config-users
$TIME_DATE,manjaro-settings-manager -m msm_timedate,system-config-date
$KEYBOARD,manjaro-settings-manager -m msm_keyboard,preferences-desktop-keyboard
$HARDWARE,manjaro-settings-manager -m msm_mhwd,preferences-desktop-peripherals-directory
^sep()
$ARANDR,arandr,monitor
^sep($SYSINFO_TITLE)
$SYSINFO,^pipe(jgsysinfo-pipe),distributor-logo-linux
CPU-X,cpu-x,cpu-x
⮜ $BACK,^back()
^tag(mirrory)
$FAST <small>pacman-mirrors -f5</small>,^term(sudo pacman-mirrors -f5)
$ALL <small>pacman-mirrors -i -c all</small>,^term(sudo pacman-mirrors -i -c all)
$GEOIP <small>pacman-mirrors -i --geoip</small>,^term(sudo pacman-mirrors -i --geoip)
^sep()
⮜ $BACK,^back()
^tag(wyglad)
. ~/.config/mabox/settings.csv
^sep()
⮜ $BACK,^back()
. ~/.config/mabox/settings_tags.csv
^tag(userguide)
$UGUIDE
^sep()
⮜ $BACK,^back()
^tag(weblinks)
#^sep($ONLINE_RES)
^sep(Mabox Linux)
Mabox Website,exo-open --launch WebBrowser https://maboxlinux.org/,distributor-logo-mabox
Mabox Forum,exo-open --launch WebBrowser https://forum.maboxlinux.org/,distributor-logo-mabox
^sep(Manjaro)
Stable Updates,exo-open --launch WebBrowser https://forum.manjaro.org/c/announcements/stable-updates/,distributor-logo-manjaro
Manjaro Wiki,exo-open --launch WebBrowser https://wiki.manjaro.org,distributor-logo-manjaro
Manjaro Forum,exo-open --launch WebBrowser https://forum.manjaro.org,distributor-logo-manjaro
Branch Compare,exo-open --launch WebBrowser https://manjaro.org/branch-compare/,distributor-logo-manjaro
^sep(ArchLinux)
ArchWiki,exo-open --launch WebBrowser https://wiki.archlinux.org/,distributor-logo-archlinux
Manual pages indexing service,exo-open --launch WebBrowser https://man.archlinux.org/,distributor-logo-archlinux
^sep(Openbox)
OpenBox,exo-open --launch WebBrowser http://openbox.org/wiki/Help:Contents,openbox
OpenBox ArchWiki,exo-open --launch WebBrowser https://wiki.archlinux.org/index.php/Openbox,openbox
^sep(LXDE)
LXDE Forum,exo-open --launch WebBrowser https://forum.lxde.org/,desktop-environment-lxde
LXDE Wiki,exo-open --launch WebBrowser https://wiki.lxde.org/,desktop-environment-lxde
LXDE Blog,exo-open --launch WebBrowser https://blog.lxde.org/,desktop-environment-lxde
^sep(Jgmenu)
Jgmenu homesite,exo-open --launch WebBrowser https://jgmenu.github.io/,jgmenu
Jgmenu GitHub,exo-open --launch WebBrowser https://github.com/johanmalm/jgmenu,jgmenu
^sep(Terminator)
Terminator GitHub,exo-open --launch WebBrowser https://gnome-terminator.github.io/,terminator
Terminator Docs,exo-open --launch WebBrowser https://gnome-terminator.readthedocs.io/en/latest/,terminator
#. $HOME/.config/mabox/online-resources.csv
^sep()
⮜ $BACK,^back()
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
places() {
mb-setvar jgtools_last="\"places\""
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
QNAV=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS} ${QNAV}" EXIT
case $LANG in
pl*)
QUICK_NAV="Szybka nawigacja"
HOME_DIR="Katalog Domowy"
ROOTDIR="Katalog główny"
PIPEMENUS="Narzędzia"
POPINSTALL="Instaluj popularne programy"
SYSINFO="Informacje o systemie"
SHORTCUTS="Skróty klawiszowe"
MENUPANELS="Ustawienia Menu/Paneli"
TINT2SETTINGS="Ustawienia panelu Tint2"
CONKYSETTINGS="Ustawienia Conky"
SSH_CONN="Połącz po SSH"
DESKMNGR="Desktop Session Manager"
DESKTOPS="Pulpity i Okna"
DESKGRID="DesktopGrid"
WALLCHANGER="Tapeta"
LOCKSCREEN="Blokada Ekranu"
MBHELPER="Paleta komend (<b>super+F1</b>)"
;;
es*)
QUICK_NAV="Navegación rápida"
HOME_DIR="Carpeta personal"
ROOTDIR="Directorio raíz"
PIPEMENUS="Menu con extras"
POPINSTALL="Instalar Programas populares"
SYSINFO="System information"
SHORTCUTS="Atajos del teclado"
MENUPANELS="Menu/Paneles laterales"
TINT2SETTINGS="Tint2 panel settings"
CONKYSETTINGS="Conky settings"
SSH_CONN="Conexiones SSH"
DESKMNGR="Desktop Session Manager"
DESKTOPS="Desktops and Windows"
DESKGRID="Desktop Grid"
WALLCHANGER="Wallpaper"
LOCKSCREEN="Screen Locker"
MBHELPER="Cmd palette (<b>super-F1</b>)"
;;
*)
QUICK_NAV="Quick Navigation"
HOME_DIR="Home Directory"
ROOTDIR="Main Directory"
PIPEMENUS="Mabox Tools"
POPINSTALL="Install popular apps"
SYSINFO="System information"
SHORTCUTS="Keyboard shortcuts"
MENUPANELS="Menu/Sidepanels settings"
TINT2SETTINGS="Tint2 panel settings"
CONKYSETTINGS="Conky settings"
SSH_CONN="SSH connections"
DESKMNGR="Desktop Session Manager"
DESKTOPS="Desktops and Windows"
DESKGRID="DesktopGrid"
WALLCHANGER="Wallpaper"
LOCKSCREEN="Screen Locker"
MBHELPER="Cmd palette (<b>super-F1</b>)"
;;
esac
#panels_topmargin=${panels_topmargin:-0}
menu_margin_x=${submenu_spacing:-0}
[ $panels_topmargin == 0 ] && menu_margin_x=0
#### Compact or full height
if [[ $panels_heightpos == "full" ]]; then
eval $(xdotool getdisplaygeometry --shell)
MENU_HEIGHT_MIN="$HEIGHT"
MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN
MENU_RADIUS="0"
menu_margin_x="0"
elif [[ $panels_heightpos == "top" ]]; then
MENU_VALIGN="top"
MENU_MARGIN_Y=${panels_topmargin:-0}
elif [[ $panels_heightpos == "bottom" ]]; then
MENU_VALIGN="bottom"
MENU_MARGIN_Y=${panels_topmargin:-0}
else
MENU_VALIGN="center"
fi
JGWIDTH=40
jgmenu_icon_size=0
MENU_PADDING_TOP=$((jgtools_padding + 52))
#BOTTOM_IMG=${places_bottom_img:-/usr/share/mb-jgtools/mabox_3D_silver.png}
#if [[ $places_softwarepipe || $places_sysinfopipe || $places_keyspipe ]];then pipeseparator="^sep($PIPEMENUS)";fi
#QUICK NAV
[ -v places_quicknav ] && : || mb-setvar places_quicknav=true
if [ $places_quicknav == true ];then
cat <<EOF > ${QNAV}
^sep($QUICK_NAV)
<tt><big>襁</big></tt> $ROOTDIR,^pipe(jgbrowser /),folder
<tt><big><b>~</b></big></tt> $HOME_DIR,^pipe(jgbrowser),folder-home
<big> </big> $(basename $(xdg-user-dir DOWNLOAD)),^pipe(jgbrowser $(xdg-user-dir DOWNLOAD)),folder-download
<big> </big> $(basename $(xdg-user-dir DOCUMENTS)),^pipe(jgbrowser $(xdg-user-dir DOCUMENTS)),folder-documents
<big>  </big> $(basename $(xdg-user-dir MUSIC)),^pipe(jgbrowser $(xdg-user-dir MUSIC)),folder-music
<big> </big> $(basename $(xdg-user-dir PICTURES)),^pipe(jgbrowser $(xdg-user-dir PICTURES)),folder-pictures
<big> </big> $(basename $(xdg-user-dir VIDEOS)),^pipe(jgbrowser $(xdg-user-dir VIDEOS)),folder-video
EOF
else
QNAV=""
fi
# PIPEMENUS
[ $places_menusettingspipe == true ] && menusettingspipe="<big>襁</big> $MENUPANELS,^pipe(jgmenusettings-pipe -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_sysinfopipe == true ] && sysinfopipe="<big></big> $SYSINFO,^pipe(jgsysinfo-pipe -r)" && pipesep="^sep($PIPEMENUS)"
#[ $places_keyspipe == true ] && keyspipe="<big></big> $SHORTCUTS,^pipe(jgkeys-pipe -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_sshpipe == true ] && sshpipe="<big></big> $SSH_CONN,^pipe(jgssh -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_softwarepipe == true ] && softwarepipe="<big></big> $POPINSTALL,^pipe(jgsoftware-pipe -r)" && pipesep="^sep($PIPEMENUS)"
[[ $places_jgdeskmngr == true || -z ${places_jgdeskmngr} ]] && jgdeskmngr="<big></big> $DESKMNGR,^pipe(jgdeskmngr -r)" && pipesep="^sep($PIPEMENUS)"
[[ $places_jgdesktops == true || -z ${places_jgdesktops} ]] && jgdesktops="<big></big> $DESKTOPS,^pipe(jgdesktops -r)" && pipesep="^sep($PIPEMENUS)"
[[ $places_jgdeskgrid == true || -z ${places_jgdeskgrid} ]] && jgdeskgrid="<big></big> $DESKGRID,^pipe(jgdeskgrid -r)" && pipesep="^sep($PIPEMENUS)"
[[ $places_jgwallpaperchanger == true || -z ${places_jgwallpaperchanger} ]] && jgwallpaperchanger="<big></big> $WALLCHANGER,^pipe(jgwallpaperchanger -r)" && pipesep="^sep($PIPEMENUS)"
[[ $places_jglockscreen == true || -z ${places_jglockscreen} ]] && jglockscreen="<big></big> $LOCKSCREEN,^pipe(jglockscreen -r)" && pipesep="^sep($PIPEMENUS)"
# VBOXES
[[ $places_vboxes == true ]] && vboxes=". $HOME/.config/mabox/vboxes.csv" || vboxes=""
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding + 2)),$((jgtools_padding + 2)),48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png
#@icon,,10,$((MENU_HEIGHT_MIN - 160)),240,180,4,center,top,,,$BOTTOM_IMG
@text,,$((jgtools_padding + 57)),$((jgtools_padding + 2)),200,20,4,left,top,auto,#111111,<big>$OSNAME $OSVERSION</big> <sup><b>LXDE</b></sup>
@text,,$((jgtools_padding + 57)),$((jgtools_padding + 22)),200,20,4,left,top,auto,#444444,<small>$USER@$HOSTNAME</small>
. $HOME/.config/mabox/places-prepend.csv
. ${QNAV}
$(gtkbookmarks)
$pipesep
<big></big> $MBHELPER,mbhelper -s
$menusettingspipe
$jgwallpaperchanger
$jglockscreen
$jgdesktops
$jgdeskmngr
$jgdeskgrid
$sysinfopipe
$sshpipe
$softwarepipe
${vboxes}
. $HOME/.config/mabox/places-append.csv
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
mblogout() {
if [[ -n "$1" ]]
then
POSITION_MODE=${1:-pointer}
else
MENU_HALIGN="center"
MENU_VALIGN="center"
continue
fi
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS};#wmctrl -k off" EXIT
case $LANG in
pl*) CANCEL="Anuluj";;
es*) CANCEL="Cancelar";;
*) CANCEL="Cancel";;
esac
jgtools_padding=${jgtools_padding:-0}
JGWIDTH=$((jgtools_padding + 348 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 221))
TABS="250"
jgmenu_item_height=30
jgmenu_icon_size=26
#jgmenu_font="Noto Sans Medium 11"
mkconfigfile
#wmctrl -k on
THUMB="$(DISPLAY=:0 scrot -t 340x213 -o $HOME/.config/mabox/mblogout.png -e 'echo $m')"
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),340,100,4,left,top,,,$THUMB
@icon,,10,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png
@text,,$((jgtools_padding + 180)),$((jgtools_padding + 170)),220,20,4,left,top,${color_sel_fg% *},${color_sel_bg% *},$OSNAME $OSVERSION <sup> $OSCODE</sup>
@text,,$((jgtools_padding + 180)),$((jgtools_padding + 190)),200,20,4,left,top,${color_norm_fg% *},#DDDDDD,<small>$USER@$HOSTNAME</small>
. $HOME/.config/mabox/exit.csv
^sep()
$CANCEL <small>esc</small>,exit 1,gtk-close
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
screenshot() {
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
case $LANG in
pl*)
SCRNSHOTS="Zrzuty ekranu"
FULLSCR="Pełny ekran"
ACTIVE_WIN="Aktywne okno"
ACTIVE_WIN_NO_DECOR="Aktywne okno (bez dekoracji)"
SELECTED="Zaznaczony obszar lub okno"
NOW="Teraz"
SEC5="Za 5 sekund"
SEC10="Za 10 sekund"
BACK="wróć"
OPEN_SCR_DIR="Otwórz katalog ze zrzutami ekranu"
CANCEL="Anuluj"
;;
es*)
SCRNSHOTS="Captura Pantalla"
FULLSCR="Pantalla completa"
ACTIVE_WIN="Ventana Activa"
ACTIVE_WIN_NO_DECOR="Ventana Activa (sin decoraciones)"
SELECTED="Seleccionar Área o Ventana"
NOW="Ahora"
SEC5="En 5 segundos"
SEC10="En 10 segundos"
BACK="atrás"
OPEN_SCR_DIR="Abrir carpeta de capturas"
CANCEL="Cancelar"
;;
*)
SCRNSHOTS="Screenshot tool"
FULLSCR="Full screen"
ACTIVE_WIN="Active window"
ACTIVE_WIN_NO_DECOR="Active window (no decorations)"
SELECTED="Selected Area or Window"
NOW="Now"
SEC5="In 5 seconds"
SEC10="In 10 seconds"
BACK="back"
OPEN_SCR_DIR="Open screenshot directory"
CANCEL="Cancel"
;;
esac
jgtools_padding=${jgtools_padding:-0}
JGWIDTH=$((jgtools_padding + 348 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 221))
MENU_HALIGN="center"
MENU_VALIGN="center"
TABS="280"
jgmenu_item_height=28
jgmenu_icon_size=0
#MENU_RADIUS=${RADIUS:-0}
[ -d $(xdg-user-dir PICTURES)/screenshots ] || mkdir -p $(xdg-user-dir PICTURES)/screenshots
IMG="$(xdg-user-dir PICTURES)/screenshots/Mabox_%Y-%m-%d-%H-%M-%s.png"
VIEW="'viewnior $IMG'"
THUMB="$(DISPLAY=:0 scrot -t 340x213 -o $HOME/.config/mabox/jgscrot.png -e 'echo $m')"
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),340,100,4,left,top,,,$THUMB
^sep($SCRNSHOTS)
 $FULLSCR,^root(full)
 $ACTIVE_WIN,^root(window)
 $ACTIVE_WIN_NO_DECOR,^root(borderless)
 $SELECTED,scrot -fs $IMG -e $VIEW
#  Multimonitor, scrot -m $IMG -e $VIEW
^sep()
 $OPEN_SCR_DIR,xdg-open $(xdg-user-dir PICTURES)/screenshots
^sep()
 $CANCEL <small>esc</small>,exit 1
^tag(full)
^sep($FULLSCR )
 $NOW,scrot $IMG -e $VIEW
 $SEC5,scrot -d 5 $IMG -e $VIEW
 $SEC10,scrot -d 10 $IMG -e $VIEW
^sep()
⮜ $BACK,^back()
^tag(window)
^sep($ACTIVE_WIN )
 $NOW,scrot -d 1 -u -b $IMG -e $VIEW
 $SEC5,scrot -d 5 -u -b $IMG -e $VIEW
 $SEC10,scrot -d 10 -u -b $IMG -e $VIEW
^sep()
⮜ $BACK,^back()
^tag(borderless)
^sep($ACTIVE_WIN_NO_DECOR)
 $NOW,scrot -d 1 -u $IMG -e $VIEW
 $SEC5,scrot -d 5 -u $IMG -e $VIEW
 $SEC10,scrot -d 10 -u $IMG -e $VIEW
^sep()
⮜ $BACK,^back()
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
settings() {
mb-setvar jgtools_last="\"settings ipc\""
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
POSITION_MODE=${1:-pointer}
HIDE_BACK_ITEMS=1
MENU_PADDING_TOP=${jgtools_padding:-0}
TABS="90"
[ $jgmenu_use_icons == false ] && jgmenu_icon_size=0
#jgmenu_icon_size=20
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
. ~/.config/mabox/lxde-settings.csv
. ~/.config/mabox/lxde-settings_tags.csv
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
#--------------------------------------------------------------------+
#Color picker, usage: printf $BLD$CUR$RED$BBLU'Hello World!'$DEF |
#-------------------------+--------------------------------+---------+
# Text color | Background color | |
#-----------+-------------+--------------+-----------------+ |
# Base color|Lighter shade| Base color | Lighter shade | |
#-----------+-------------+--------------+-----------------+ |
BLK='\e[30m'; blk='\e[90m'; BBLK='\e[40m'; bblk='\e[100m' #| Black |
RED='\e[31m'; red='\e[91m'; BRED='\e[41m'; bred='\e[101m' #| Red |
GRN='\e[32m'; grn='\e[92m'; BGRN='\e[42m'; bgrn='\e[102m' #| Green |
YLW='\e[33m'; ylw='\e[93m'; BYLW='\e[43m'; bylw='\e[103m' #| Yellow |
BLU='\e[34m'; blu='\e[94m'; BBLU='\e[44m'; bblu='\e[104m' #| Blue |
MGN='\e[35m'; mgn='\e[95m'; BMGN='\e[45m'; bmgn='\e[105m' #| Magenta |
CYN='\e[36m'; cyn='\e[96m'; BCYN='\e[46m'; bcyn='\e[106m' #| Cyan |
WHT='\e[37m'; wht='\e[97m'; BWHT='\e[47m'; bwht='\e[107m' #| White |
#----------------------------------------------------------+---------+
# Effects |
#--------------------------------------------------------------------+
DEF='\e[0m' #Default color and effects |
BLD='\e[1m' #Bold\brighter |
DIM='\e[2m' #Dim\darker |
CUR='\e[3m' #Italic font |
UND='\e[4m' #Underline |
INV='\e[7m' #Inverted |
COF='\e[?25l' #Cursor Off |
CON='\e[?25h' #Cursor On |
#--------------------------------------------------------------------+
case "$1" in
main) main "$2";;
right) right;;
mblogout) mblogout "$2";;
settings) settings "$2";;
screenshot) screenshot;;
places) places;;
*)
echo -e "
${GRN}Kolekcja narzędzi dla Mabox-a stworzonych z pomocą Jgmenu
Użycie:
${DEF} $(basename "$0")${YLW} [${RED} OPCJA${YLW} ]
${GRN} Opcje:
${YLW} >${RED} main ${YLW} -${DEF} main menu - replaces OB menu
${YLW} >${RED} settings ${YLW} -${DEF} settings menu
${YLW} >${RED} right ${YLW} -${DEF} right panel
${YLW} >${RED} places ${YLW} -${DEF} places - left sidepanel
${YLW} >${RED} mblogout ${YLW} -${DEF} run logout script
${YLW} >${RED} screenshot ${YLW} -${DEF} run screenshot script
" >&2
exit 1
;;
esac
exit 0