#!/bin/bash
. $HOME/.config/mabox/mabox.conf
case $LANG in
pl*)
TITLE="Ustawienia Menu i Paneli"
MENU_ITEMS="Elementy Menu"
OWN_COMMANDS="własne komendy"
FAVORITES="Ulubione"
MAINMENU="Menu główne"
LEFTPANEL="Lewy panel"
RIGHTPANEL="Prawy panel"
EXITMENU="Dialog wylogowania"
JGBROWSER="Przeglądarka plików/katalogów"
SHOW_HIDDEN="Wyświetlanie ukrytych plików"
EDIT="Edytuj"
TOP="Góra"
BOTTOM="Dół"
MODULES="Moduły"
RESET="Przywróć domyślne ustawienia"
QUICK_NAV="Szybka nawigacja"
BOOKMARKS="Zakładki GTK"
VBOXES="Maszyny Wirtualne"
PIPEMENUS="Dynamiczne (pipe) menu"
POPINSTALL="Instaluj popularne programy"
SYSINFO="Informacje o systemie"
SHORTCUTS="Skróty klawiszowe"
MENUPANELS="Menu / Panele boczne"
LOOKANDFEEL="Wygląd"
BORDER="Obramowanie"
PADDING="Margines wewnętrzny"
RADIUS="Zaokrąglone rogi"
TOPMARGIN="Margines Paneli Góra/Dół"
SUBSPACING="Odstęp submenu"
ICONS="Ikony"
CIRCLE="Okrągłe ikony (Numix)"
SQUARE="Kwadratowe ikony (Numix)"
SHOW_ICONS="Pokaż ikony"
HIDE_ICONS="Ukryj ikony"
INSTALL_SARDI="Instaluj sardi-icons"
SIZE="Rozmiar i czcionka"
TINY="malutki"
SMALL="mały"
NORMAL="normalny"
BIG="duży"
HUGE="wielki"
FONT_FAMILY="Czcionka"
COLOR_SCHEME="Schemat kolorystyczny"
EDIT_CURRENT="Edytuj aktywny"
FOLLOW_OB="Zgodny z motywem OpenBox"
CHOOSE="Wybierz..."
REMOVE="Usuń to menu z panelu"
;;
es*)
TITLE="Menu/Panel lateral"
MENU_ITEMS="Menu Items"
OWN_COMMANDS="Custom Commands"
FAVORITES="Favoritos"
MAINMENU="Main Menu"
LEFTPANEL="Left panel"
RIGHTPANEL="Right panel"
EXITMENU="Logout Dialog"
JGBROWSER="File/Directory Browser"
SHOW_HIDDEN="Show hidden files"
EDIT="Editar"
TOP="TOP"
BOTTOM="BOTTOM"
MODULES="Modules"
RESET="Reset to default"
QUICK_NAV="Navegación rápida"
BOOKMARKS="GTK Marcadores"
VBOXES="Virtual Machines"
PIPEMENUS="Menu con extras"
POPINSTALL="Instalar Programas populares"
SYSINFO="System information"
SHORTCUTS="Atajos del teclado"
MENUPANELS="Menu / Paneles laterales"
LOOKANDFEEL="Apariencia"
BORDER="Menu Border"
PADDING="Padding"
RADIUS="Rounded Corners"
TOPMARGIN="Panels Top/Bottom Margin"
SUBSPACING="Submenu Spacing"
ICONS="Iconos"
CIRCLE="Circilo iconos (Numix)"
SQUARE="Cuadrado iconos (Numix)"
SHOW_ICONS="Mostrar iconos"
HIDE_ICONS="Ocultar iconos"
INSTALL_SARDI="Instalar sardi-icons"
SIZE="Tamaño de Menu/Panel lateral"
TINY="Diminuto"
SMALL="Pequeño"
NORMAL="Normal"
BIG="Grande"
HUGE="Muy Grande"
FONT_FAMILY="Familia tipográfica"
COLOR_SCHEME="Esquema de colores"
EDIT_CURRENT="Editar el actual"
FOLLOW_OB="Similiar al de Openbox"
CHOOSE="Elegir..."
REMOVE="Eliminar este menú del panel"
;;
*)
TITLE="Menu/Panels settings"
MENU_ITEMS="Menu Items"
OWN_COMMANDS="Custom Commands"
FAVORITES="Favorites"
MAINMENU="Main Menu"
LEFTPANEL="Left Panel "
RIGHTPANEL="Right Panel"
EXITMENU="Logout Dialog"
JGBROWSER="File/Directory Browser"
SHOW_HIDDEN="Show hidden files"
EDIT="Edit"
TOP="Top"
BOTTOM="Bottom"
MODULES="Modules"
RESET="Reset to default"
QUICK_NAV="Quick Navigation"
BOOKMARKS="GTK Bookmarks"
VBOXES="Virtual Machines"
PIPEMENUS="Pipe (dynamic) menus"
POPINSTALL="Install popular apps"
SYSINFO="System information"
SHORTCUTS="Keyboard shortcuts"
MENUPANELS="Menu / Sidepanels"
LOOKANDFEEL="Look and Feel"
BORDER="Menu Border"
PADDING="Padding"
RADIUS="Rounded Corners"
TOPMARGIN="Panels Top/Bottom Margin"
SUBSPACING="Submenu Spacing"
ICONS="Icons"
CIRCLE="Circle icons (Numix)"
SQUARE="Square icons (Numix)"
SHOW_ICONS="Show icons"
HIDE_ICONS="Hide icons"
INSTALL_SARDI="Install sardi-icons"
SIZE="Menu/Sidepanels Size and Font"
TINY="tiny"
SMALL="small"
NORMAL="normal"
BIG="big"
HUGE="huge"
FONT_FAMILY="Font Family"
COLOR_SCHEME="Color Scheme"
EDIT_CURRENT="Edit current"
FOLLOW_OB="Same as OpenBox theme"
CHOOSE="Choose..."
REMOVE="Remove this menu from panel"
;;
esac
me="mb-jgtools $jgtools_last"
L="mb-jgtools places"
R="mb-jgtools right"
#out+=("^sep($TITLE)")
case $menu_font_size in
7) t="";;
8) s="";;
9) n="";;
10) b="";;
11) h="";;
*);;
esac
## NOWE ....
#out+=("^sep()")
out+=("^sep($MENU_ITEMS)")
out+=("^sep()")
out+=("$MAINMENU,^checkout(mainmenu_edit)")
out+=("$LEFTPANEL,^checkout(left_edit)")
out+=("$RIGHTPANEL,^checkout(right_edit)")
out+=("$EXITMENU,^checkout(exit_edit)")
out+=("^sep($JGBROWSER)")
[[ $jgbrowser_show_hidden = false ]] && out+=("$SHOW_HIDDEN,mb-setvar jgbrowser_show_hidden=true;$me") || out+=("$SHOW_HIDDEN,mb-setvar jgbrowser_show_hidden=false;$me")
out2+=("^tag(mainmenu_edit)")
out2+=("^sep($MAINMENU)")
out2+=("$EDIT $FAVORITES, geany $HOME/.config/mabox/favorites.csv, geany")
out2+=("^sep(Reset)")
out2+=("$RESET,mb-jgtools reset main")
out2+=("^tag(left_edit)")
out2+=("^sep($LEFTPANEL)")
out2+=("$EDIT $OWN_COMMANDS ($TOP), geany $HOME/.config/mabox/places-prepend.csv, geany")
out2+=("^sep()")
out2+=("^sep($MODULES)")
out2+=("$QUICK_NAV")
out2+=("$BOOKMARKS")
out2+=("$VBOXES")
out2+=("^sep()")
out2+=("^sep($PIPEMENUS)")
[[ $places_softwarepipe = false ]] && out2+=("$POPINSTALL,mb-setvar places_softwarepipe=true;$L") || out2+=("$POPINSTALL,mb-setvar places_softwarepipe=false;$L")
[[ $places_sysinfopipe = false ]] && out2+=("$SYSINFO,mb-setvar places_sysinfopipe=true;$L") || out2+=("$SYSINFO,mb-setvar places_sysinfopipe=false;$L")
[[ $places_keyspipe = false ]] && out2+=("$SHORTCUTS,mb-setvar places_keyspipe=true;$L") || out2+=("$SHORTCUTS,mb-setvar places_keyspipe=false;$L")
[[ $places_menusettingspipe = false ]] && out2+=("$MENUPANELS,mb-setvar places_menusettingspipe=true;$L") || out2+=("$MENUPANELS,mb-setvar places_menusettingspipe=false;$L")
out2+=("^sep()")
out2+=("$EDIT $OWN_COMMANDS ($BOTTOM), geany $HOME/.config/mabox/places-append.csv, geany")
out2+=("^sep(Reset)")
out2+=("$RESET,mb-jgtools reset left")
out2+=("^tag(right_edit)")
out2+=("^sep($RIGHTPANEL)")
out2+=("$EDIT $OWN_COMMANDS ($TOP), geany $HOME/.config/mabox/right-prepend.csv, geany")
out2+=("$EDIT $OWN_COMMANDS ($BOTTOM), geany $HOME/.config/mabox/right-append.csv, geany")
out2+=("^sep(Reset)")
out2+=("$RESET,mb-jgtools reset right")
out2+=("^tag(exit_edit)")
out2+=("^sep($EXITMENU)")
out2+=("$EDIT $EXITMENU, geany $HOME/.config/mabox/exit.csv, geany")
out2+=("^sep(Reset)")
out2+=("$RESET,mb-jgtools reset logout")
##
out+=("^sep()")
out+=("^sep($LOOKANDFEEL)")
out+=("$BORDER [ ${jgtools_border:-0} ],^checkout(mborder)")
out+=("$PADDING [ ${jgtools_padding:-0} ],^checkout(mpadding)")
out+=("$RADIUS [ ${jgtools_radius:-0} ],^checkout(mradius)")
out+=("$TOPMARGIN [ ${panels_topmargin:-0} ],^checkout(topmargin)")
out+=("$SUBSPACING [ ${submenu_spacing:-0} ],^checkout(subspacing)")
out2+=("^tag(mborder)")
#for i in 0 1 2 3 4; do out2+=("${i},mb-setvar jgtools_border=${i};$me");done
for i in 0 1 2 3 4; do out2+=("$(printf "%3s,%s" "$i" "mb-setvar jgtools_border=${i};$me")");done
out2+=("^tag(mpadding)")
#for i in 0 1 2 3 4; do out2+=("${i},mb-setvar jgtools_border=${i};$me");done
for i in 0 2 4 6 8 10 12 14 16 18 20; do out2+=("$(printf "%3s,%s" "$i" "mb-setvar jgtools_padding=${i};$me")");done
out2+=("^tag(mradius)")
for i in 0 1 2 3 4 6 8 12 14 16 18 20; do out2+=("$(printf "%3s,%s" "$i" "mb-setvar jgtools_radius=${i};$me")");done
out2+=("^tag(topmargin)")
for i in 0 20 30 40 50 60 80 100; do out2+=("$(printf "%4s,%s" "$i" "mb-setvar panels_topmargin=${i};$me")");done
#for i in 0 20 30 40 50 60 80 100; do out2+=("${i},mb-setvar panels_topmargin=${i};$me");done
out2+=("^tag(subspacing)")
for i in -8 -6 -4 -2 0 1 2 4 6 8 10; do out2+=("$(printf "%4s,%s" "$i" "mb-setvar submenu_spacing=${i};$me")");done
#for i in -8 -6 -4 -2 0 1 2 3 4 5 6; do out2+=("${i},mb-setvar submenu_spacing=${i};$me");done
out+=("^sep($SIZE)")
out+=(" $t $TINY,mb-setvar menu_font_size=7;mb-setvar jgmenu_item_height=14;mb-setvar jgmenu_icon_size=14;mb-setvar sep_height=1;mb-setvar item_margin_y=1;$me
$s $SMALL,mb-setvar menu_font_size=8;mb-setvar jgmenu_item_height=16;mb-setvar jgmenu_icon_size=16;mb-setvar sep_height=1;mb-setvar item_margin_y=1;$me
$n $NORMAL,mb-setvar menu_font_size=9;mb-setvar jgmenu_item_height=18;mb-setvar jgmenu_icon_size=18;mb-setvar sep_height=1;mb-setvar item_margin_y=1;$me
$b $BIG,mb-setvar menu_font_size=10;mb-setvar jgmenu_item_height=20;mb-setvar jgmenu_icon_size=20;mb-setvar sep_height=1;mb-setvar item_margin_y=1;$me
$h $HUGE,mb-setvar menu_font_size=11;mb-setvar jgmenu_item_height=22;mb-setvar jgmenu_icon_size=22;mb-setvar sep_height=2;mb-setvar item_margin_y=2;$me")
#out+=("^sep($FONT_FAMILY)")
######### FONT FAMILY
out+=("^sep()")
out+=("$FONT_FAMILY,^checkout(fonty)")
case $menu_font_family in
"Noto Sans Light") nol="";;
"Noto Sans Medium") nom="";;
Jet*) je="";;
Aut*) au="";;
Deja*) de="";;
Robo*) ro="";;
Inco*) in="";;
*);;
esac
out2+=("^tag(fonty)")
out2+=("^sep($FONT_FAMILY)")
out2+=("$nol Noto Sans Light,mb-setvar \"menu_font_family='Noto Sans Light'\";$me")
out2+=("$nom Noto Sans Medium,mb-setvar \"menu_font_family='Noto Sans Medium'\";$me")
out2+=("$je JetBrains Mono Regular,mb-setvar \"menu_font_family='JetBrains Mono Regular'\";$me")
out2+=("$au Autour One,mb-setvar \"menu_font_family='Autour One'\";$me")
out2+=("$de DejaVu Serif,mb-setvar \"menu_font_family='DejaVu Serif'\";$me")
out2+=("$ro Roboto Light,mb-setvar \"menu_font_family='Roboto Light'\";$me")
out2+=("$in Inconsolata,mb-setvar menu_font_family=Inconsolata;$me")
########## ICONS
out+=("^sep($ICONS)")
if [ $jgmenu_use_icons == true ]; then
out+=("$HIDE_ICONS,mb-setvar jgmenu_use_icons=false;$me")
else
out+=("$SHOW_ICONS,mb-setvar jgmenu_use_icons=true;$me")
fi
out+=("^sep()")
out+=("$SQUARE,mb-setvar jgmenu_icon_theme=Numix-Square;mb-setvar jgmenu_use_icons=true;$me")
out+=("$CIRCLE,mb-setvar jgmenu_icon_theme=Numix-Circle;mb-setvar jgmenu_use_icons=true;$me")
if [ -d /usr/share/icons/Sardi-Arc ];then
out+=("^sep()")
out+=("Sardi,^checkout(sardi)")
out2+=("^tag(sardi)")
out2+=("Sardi,mb-setvar jgmenu_icon_theme=Sardi;mb-setvar jgmenu_use_icons=true;$me")
out2+=("Sardi-Orb-Colora,mb-setvar jgmenu_icon_theme=Sardi-Orb-Colora;mb-setvar jgmenu_use_icons=true;$me")
out2+=("Sardi-Flat,mb-setvar jgmenu_icon_theme=Sardi-Flat;mb-setvar jgmenu_use_icons=true;$me")
out2+=("Sardi-Flexible,mb-setvar jgmenu_icon_theme=Sardi-Flexible;mb-setvar jgmenu_use_icons=true;$me")
out2+=("Sardi-Mono,mb-setvar jgmenu_icon_theme=Sardi-Mono;mb-setvar jgmenu_use_icons=true;$me")
else
out+=("^sep()")
out+=("$INSTALL_SARDI, pamac-installer sardi-icons")
fi
########## THEMES
out+=("^sep($COLOR_SCHEME)")
if [ $jgmenu_theme != obtheme ]; then
out+=("$FOLLOW_OB,mb-setvar jgmenu_theme=obtheme;$me
^sep()")
out+=("$CHOOSE,^checkout(motywy)
^sep()")
out+=("$EDIT_CURRENT: ($jgmenu_theme),geany $HOME/.config/mabox/jgobthemes/$jgmenu_theme.colorrc,geany")
else
ob_file=$HOME/.config/openbox/rc.xml
[[ -f $ob_file ]] && wm_theme=$(awk '// {while (getline n) {if (match(n, //)){l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$ob_file")
out+=("$FOLLOW_OB,mb-setvar jgmenu_theme=obtheme;$me
^sep()")
out+=("$CHOOSE,^checkout(motywy)
^sep()")
out+=("$EDIT_CURRENT: (${wm_theme// /_}),geany $HOME/.config/mabox/jgobthemes/${wm_theme// /_}.colorrc,geany")
fi
out2+=("^tag(motywy)")
for item in "$HOME"/.config/mabox/jgobthemes/*colorrc; do
theme="${item##*/}"
out2+=("${theme%.*},mb-setvar jgmenu_theme=${theme%.*};$me")
done
### 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 < ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
if [ $1 == "-r" ]; then
printf '%s\n' "^sep()"
printf '%s\n' "$REMOVE,mb-setvar places_menusettingspipe=false"
fi
printf '%s\n' "${out2[@]}"