mabox-pipemenus/usr/bin/jgmenusettings-pipe

214 lines
7.2 KiB
Plaintext
Raw Normal View History

2020-09-07 16:55:43 +02:00
#!/bin/bash
. $HOME/.config/mabox/mabox.conf
case $LANG in
pl*)
TITLE="Ustawienia Menu i Paneli"
ICONS="Ikony"
2020-10-01 11:48:08 +02:00
CIRCLE="Okrągłe ikony (Numix)"
SQUARE="Kwadratowe ikony (Numix)"
2020-09-07 16:55:43 +02:00
SHOW_ICONS="Pokaż ikony"
HIDE_ICONS="Ukryj ikony"
2020-10-01 11:48:08 +02:00
INSTALL_SARDI="Instaluj sardi-icons"
2020-09-07 16:55:43 +02:00
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..."
2020-09-22 13:11:45 +02:00
REMOVE="Usuń to menu z panelu"
2020-09-07 16:55:43 +02:00
;;
es*)
TITLE="Menu/Panel lateral"
2020-09-10 14:58:34 +02:00
ICONS="Iconos"
2020-10-01 11:48:08 +02:00
CIRCLE="Circilo iconos (Numix)"
SQUARE="Cuadrado iconos (Numix)"
2020-09-10 14:58:34 +02:00
SHOW_ICONS="Mostrar iconos"
HIDE_ICONS="Ocultar iconos"
2020-10-01 11:48:08 +02:00
INSTALL_SARDI="Instalar sardi-icons"
2020-09-07 16:55:43 +02:00
SIZE="Tamaño de Menu/Panel lateral"
TINY="Diminuto"
SMALL="Pequeño"
NORMAL="Normal"
BIG="Grande"
HUGE="Muy Grande"
2020-09-10 14:58:34 +02:00
FONT_FAMILY="Familia tipográfica"
COLOR_SCHEME="Esquema de colores"
2020-09-27 22:41:13 +02:00
EDIT_CURRENT="Editar el actual"
FOLLOW_OB="Similiar al de Openbox"
CHOOSE="Elegir..."
2020-09-22 13:11:45 +02:00
REMOVE="Eliminar este menú del panel"
2020-09-07 16:55:43 +02:00
;;
*)
TITLE="Menu settings"
ICONS="Icons"
2020-10-01 11:48:08 +02:00
CIRCLE="Circle icons (Numix)"
SQUARE="Square icons (Numix)"
2020-09-07 16:55:43 +02:00
SHOW_ICONS="Show icons"
HIDE_ICONS="Hide icons"
2020-10-01 11:48:08 +02:00
INSTALL_SARDI="Install sardi-icons"
2020-09-07 16:55:43 +02:00
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..."
2020-09-22 13:11:45 +02:00
REMOVE="Remove this menu from panel"
2020-09-07 16:55:43 +02:00
;;
esac
#out+=("^sep($TITLE)")
case $menu_font_size in
7)
t=""
;;
8)
s=""
;;
9)
n=""
;;
10)
b=""
;;
12)
h=""
;;
*)
;;
esac
out+=("^sep($SIZE)")
2020-10-01 11:48:08 +02:00
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")
2020-09-07 16:55:43 +02:00
#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()")
2020-09-10 14:58:34 +02:00
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")
2020-10-01 11:48:08 +02:00
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")
2020-09-07 16:55:43 +02:00
2020-10-01 11:48:08 +02:00
fi
2020-09-07 16:55:43 +02:00
########## THEMES
out+=("^sep($COLOR_SCHEME)")
2020-09-07 16:55:43 +02:00
if [ $jgmenu_theme != obtheme ]; then
out+=("<s>$FOLLOW_OB</s>,mb-setvar jgmenu_theme=obtheme;mb-jgtools settings
^sep()")
2020-09-07 16:55:43 +02:00
out+=("$EDIT_CURRENT: (<i>$jgmenu_theme</i>),geany $HOME/.config/mabox/jgobthemes/$jgmenu_theme.colorrc,geany")
2020-09-10 14:58:34 +02:00
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")
2020-09-07 16:55:43 +02:00
fi
out+=("$CHOOSE,^checkout(motywy)")
2020-09-07 16:55:43 +02:00
out2+=("^tag(motywy)")
2020-09-07 16:55:43 +02:00
for item in "$HOME"/.config/mabox/jgobthemes/*colorrc; do
theme="${item##*/}"
out2+=("${theme%.*},mb-setvar jgmenu_theme=${theme%.*};mb-jgtools settings")
done
2020-09-15 22:35:22 +02:00
### RUN
2020-09-07 16:55:43 +02:00
2020-09-15 22:35:22 +02:00
if [ $1 == "-s" ]; then
2020-09-22 13:11:45 +02:00
. /usr/bin/pipemenu-standalone.cfg
2020-09-15 22:35:22 +02:00
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
2020-09-07 16:55:43 +02:00
printf '%s\n' "${out[@]}"
2020-09-22 13:11:45 +02:00
if [ $1 == "-r" ]; then
printf '%s\n' "^sep()"
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_menusettingspipe=false"
fi
2020-09-07 16:55:43 +02:00
printf '%s\n' "${out2[@]}"