mabox-pipemenus/usr/bin/jgmenusettings-pipe

349 lines
13 KiB
Bash
Executable File

#!/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"
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"
VBOXES="Maszyny Wirtualne"
PIPEMENUS="Dynamiczne <i>(pipe)</i> menu"
POPINSTALL="Instaluj popularne programy"
SYSINFO="Informacje o systemie"
SHORTCUTS="Skróty klawiszowe"
MENUPANELS="Menu / Panele boczne"
LOOKANDFEEL="Wygląd"
BORDER="Obramowanie"
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"
MAINMENU="Main Menu"
LEFTPANEL="Left panel"
RIGHTPANEL="Right panel"
EXITMENU=""
JGBROWSER=""
SHOW_HIDDEN="Show hidden files"
EDIT="Editar"
TOP="TOP"
BOTTOM="BOTTOM"
MODULES="Modules"
RESET="Reset to default"
QUICK_NAV="Navegación rápida"
BOOKMARKS="Marcadores"
VBOXES=""
PIPEMENUS="Menu con extras"
POPINSTALL="Instalar Programas populares"
SYSINFO="System information"
SHORTCUTS="Atajos del teclado"
MENUPANELS="Menu / Paneles laterales"
LOOKANDFEEL="Apariencia"
BORDER="Menu Border"
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"
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="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"
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"
M=""
#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+=("<i><s>$SHOW_HIDDEN</s></i>,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 $MENU_ITEMS, geany $HOME/.config/jgmenu/prepend.csv, geany")
out2+=("^sep()")
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+=("M..")
out2+=("^sep()")
out2+=("^sep($PIPEMENUS)")
[[ $places_softwarepipe = false ]] && out2+=("<i><s>$POPINSTALL</s></i>,mb-setvar places_softwarepipe=true;$L") || out2+=("$POPINSTALL,mb-setvar places_softwarepipe=false;$L")
[[ $places_sysinfopipe = false ]] && out2+=("<i><s>$SYSINFO</s></i>,mb-setvar places_sysinfopipe=true;$L") || out2+=("$SYSINFO,mb-setvar places_sysinfopipe=false;$L")
[[ $places_keyspipe = false ]] && out2+=("<i><s>$SHORTCUTS</s></i>,mb-setvar places_keyspipe=true;$L") || out2+=("$SHORTCUTS,mb-setvar places_keyspipe=false;$L")
[[ $places_menusettingspipe = false ]] && out2+=("<i><s>$MENUPANELS</s></i>,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()")
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()")
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()")
out2+=("$RESET,mb-jgtools reset logout")
out2+=(". $HOME/.config/mabox/exit.csv")
##
out+=("^sep()")
out+=("^sep($LOOKANDFEEL)")
out+=("$BORDER [ <b>${jgtools_border:-0}</b> ],^checkout(mborder)")
out+=("$TOPMARGIN [ <b>${panels_topmargin:-0}</b> ],^checkout(topmargin)")
out+=("$SUBSPACING [ <b>${submenu_spacing:-0}</b> ],^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 "<tt>%3s</tt>,%s" "$i" "mb-setvar jgtools_border=${i};$me")");done
out2+=("^tag(topmargin)")
for i in 0 20 30 40 50 60 80 100; do out2+=("$(printf "<tt>%4s</tt>,%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 3 4 5 6; do out2+=("$(printf "<tt>%4s</tt>,%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(<i>$SIZE</i>)")
out+=(" $t <small><small>$TINY</small></small>,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>$SMALL</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>$BIG</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 <big><big>$HUGE</big></big>,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+=("<span size=\"x-large\" font_family=\"Noto Sans Light\">$nol Noto Sans Light</span>,mb-setvar \"menu_font_family='Noto Sans Light'\";$me")
out2+=("<span size=\"x-large\" font_family=\"Noto Sans Medium\">$nom Noto Sans Medium</span>,mb-setvar \"menu_font_family='Noto Sans Medium'\";$me")
out2+=("<span size=\"x-large\" font_family=\"JetBrains Mono Regular\">$je JetBrains Mono Regular</span>,mb-setvar \"menu_font_family='JetBrains Mono Regular'\";$me")
out2+=("<span size=\"x-large\" font_family=\"Autour One\">$au Autour One</span>,mb-setvar \"menu_font_family='Autour One'\";$me")
out2+=("<span size=\"x-large\" font_family=\"DejaVu Serif\">$de DejaVu Serif</span>,mb-setvar \"menu_font_family='DejaVu Serif'\";$me")
out2+=("<span size=\"x-large\" font_family=\"Roboto Light\">$ro Roboto Light</span>,mb-setvar \"menu_font_family='Roboto Light'\";$me")
out2+=("<span size=\"x-large\" font_family=\"Inconsolata\">$in Inconsolata</span>,mb-setvar menu_font_family=Inconsolata;$me")
########## ICONS
out+=("^sep(<i>$ICONS</i>)")
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(<i>$COLOR_SCHEME</i>)")
if [ $jgmenu_theme != obtheme ]; then
out+=("<s>$FOLLOW_OB</s>,mb-setvar jgmenu_theme=obtheme;$me
^sep()")
out+=("$CHOOSE,^checkout(motywy)
^sep()")
out+=("$EDIT_CURRENT: (<i>$jgmenu_theme</i>),geany $HOME/.config/mabox/jgobthemes/$jgmenu_theme.colorrc,geany")
else
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")
out+=("$FOLLOW_OB,mb-setvar jgmenu_theme=obtheme;$me
^sep()")
out+=("$CHOOSE,^checkout(motywy)
^sep()")
out+=("$EDIT_CURRENT: (<i>${wm_theme// /_}</i>),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 <<EOF > ${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' "<i>$REMOVE</i>,mb-setvar places_menusettingspipe=false"
fi
printf '%s\n' "${out2[@]}"