mabox-pipemenus/usr/bin/jgmenusettings-pipe

214 lines
7.2 KiB
Bash
Executable File

#!/bin/bash
. $HOME/.config/mabox/mabox.conf
case $LANG in
pl*)
TITLE="Ustawienia Menu i Paneli"
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="Motyw kolorów"
EDIT_CURRENT="Edytuj aktywny"
FOLLOW_OB="Zgodny z motywem OpenBox"
CHOOSE="Wybierz..."
REMOVE="Usuń to menu z panelu"
;;
es*)
TITLE="Menu/Panel lateral"
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 settings"
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
#out+=("^sep($TITLE)")
case $menu_font_size in
7)
t=""
;;
8)
s=""
;;
9)
n=""
;;
10)
b=""
;;
12)
h=""
;;
*)
;;
esac
out+=("^sep($SIZE)")
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; mb-jgtools settings
$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=2;mb-setvar item_margin_y=2;mb-jgtools settings
$n $NORMAL,mb-setvar menu_font_size=9;mb-setvar jgmenu_item_height=18;mb-setvar jgmenu_icon_size=18;mb-setvar sep_height=2;mb-setvar item_margin_y=2;mb-jgtools settings
$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=4;mb-setvar item_margin_y=3;mb-jgtools settings
$h <big><big>$HUGE</big></big>,mb-setvar menu_font_size=12;mb-setvar jgmenu_item_height=24;mb-setvar jgmenu_icon_size=24;mb-setvar sep_height=5;mb-setvar item_margin_y=3;mb-jgtools settings")
#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'\";mb-jgtools settings")
out2+=("<span size=\"x-large\" font_family=\"Noto Sans Medium\">$nom Noto Sans Medium</span>,mb-setvar \"menu_font_family='Noto Sans Medium'\";mb-jgtools settings")
out2+=("<span size=\"x-large\" font_family=\"JetBrains Mono Regular\">$je JetBrains Mono Regular</span>,mb-setvar \"menu_font_family='JetBrains Mono Regular'\";mb-jgtools settings")
out2+=("<span size=\"x-large\" font_family=\"Autour One\">$au Autour One</span>,mb-setvar \"menu_font_family='Autour One'\";mb-jgtools settings")
out2+=("<span size=\"x-large\" font_family=\"DejaVu Serif\">$de DejaVu Serif</span>,mb-setvar \"menu_font_family='DejaVu Serif'\";mb-jgtools settings")
out2+=("<span size=\"x-large\" font_family=\"Roboto Light\">$ro Roboto Light</span>,mb-setvar \"menu_font_family='Roboto Light'\";mb-jgtools settings")
out2+=("<span size=\"x-large\" font_family=\"Inconsolata\">$in Inconsolata</span>,mb-setvar menu_font_family=Inconsolata;mb-jgtools settings")
########## ICONS
out+=("^sep($ICONS)")
if [ $jgmenu_use_icons == true ]; then
out+=("$HIDE_ICONS,mb-setvar jgmenu_use_icons=false;mb-jgtools settings")
else
out+=("$SHOW_ICONS,mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
fi
out+=("^sep()")
out+=("$SQUARE,mb-setvar jgmenu_icon_theme=Numix-Square;mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
out+=("$CIRCLE,mb-setvar jgmenu_icon_theme=Numix-Circle;mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
if [ -d /usr/share/icons/Sardi-Arc ];then
out+=("^sep()")
out+=("Sardi,mb-setvar jgmenu_icon_theme=Sardi;mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
out+=("Sardi-Orb-Colora,mb-setvar jgmenu_icon_theme=Sardi-Orb-Colora;mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
out+=("Sardi-Flat,mb-setvar jgmenu_icon_theme=Sardi-Flat;mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
out+=("Sardi-Flexible,mb-setvar jgmenu_icon_theme=Sardi-Flexible;mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
out+=("Sardi-Mono,mb-setvar jgmenu_icon_theme=Sardi-Mono;mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
else
out+=("^sep()")
out+=("$INSTALL_SARDI, pamac-installer sardi-icons")
fi
########## THEMES
out+=("^sep($COLOR_SCHEME)")
if [ $jgmenu_theme != obtheme ]; then
out+=("<s>$FOLLOW_OB</s>,mb-setvar jgmenu_theme=obtheme;mb-jgtools settings
^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;mb-jgtools settings
^sep()")
out+=("$EDIT_CURRENT: (<i>${wm_theme// /_}</i>),geany $HOME/.config/mabox/jgobthemes/${wm_theme// /_}.colorrc,geany")
fi
out+=("$CHOOSE,^checkout(motywy)")
out2+=("^tag(motywy)")
for item in "$HOME"/.config/mabox/jgobthemes/*colorrc; do
theme="${item##*/}"
out2+=("${theme%.*},mb-setvar jgmenu_theme=${theme%.*};mb-jgtools settings")
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[@]}"