mb-jgtools/bin/mb-jgtools
2020-07-22 17:02:26 +02:00

738 lines
24 KiB
Bash
Executable File

#!/bin/bash
. $HOME/.config/mabox/mabox.conf
jgmenu_theme=${jgmenu_theme:-obtheme}
jgmenu_use_icons=${jgmenu_use_icons:-true}
case $jgmenu_theme in
default)
export color_norm_fg="#FFFFFF "
;;
obtheme)
export color_title_fg="#FFFFFF "
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")
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_norm_fg="#FFFFFF "
;;
esac
. $HOME/.config/mabox/jgmenusize.conf
gtkbookmarks() {
BOOKMARKS="$HOME/.gtk-bookmarks"
if [[ -s "$BOOKMARKS" ]]; then
case $LANG in
pl*)
GTK_BOOKMARKS="Zakładki GTK"
;;
*)
GTK_BOOKMARKS="GTK 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
}
WEBBROWSER="exo-open --launch WebBrowser"
[ $(pidof picom) ] && RADIUS="4"
#SCREENWIDTH=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f1)
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 = lx
stay_alive = 0
hide_back_items = ${HIDE_BACK_ITEMS:-0}
terminal_exec = terminator
terminal_args = -e
tabs = ${TABS:-220}
menu_margin_x = 0
menu_margin_y = 0
menu_width = $JGWIDTH
menu_height_min = ${MENU_HEIGHT_MIN:-0}
menu_height_max = ${MENU_HEIGHT_MAX:-0}
menu_padding_top = ${MENU_PADDING_TOP:-70}
menu_padding_right = ${MENU_PADDING_RIGHT:-2}
menu_padding_bottom = ${MENU_PADDING_BOTTOM:-10}
menu_padding_left = ${MENU_PADDING_LEFT:-2}
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 = 4
item_margin_y = ${item_margin_y:-3}
item_radius = ${item_radius:-2}
item_border = ${item_border:-0}
arrow_string = ${ARROW_STRING:-⮞}
columns = ${COLUMNS:-1}
color_menu_bg = ${color_menu_bg:-#222222 80}
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:-#262626 100}
color_title_fg = ${color_title_fg:-#4D4D4D 100}
color_title_border = ${color_title_border:-#169f6f 100}
color_title_bg = ${color_title_bg:-#262626 100}
color_scroll_ind = ${COLOR_SCROLL_IND:-#504e65 100}
sep_markup = weight="bold" foreground="${color_title_fg% *}"
sep_height = ${sep_height:-5}
font = ${jgmenu_font:-Noto Sans Medium 9}
icon_size = ${jgmenu_icon_size:-0}
icon_theme = ${jgmenu_icon_theme:-Numix-Circle}
EOF
unset font
}
#MENU GŁÓWNE
main() {
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=30
MENU_PADDING_RIGHT=0
MENU_PADDING_BOTTOM=0
MENU_PADDING_LEFT=0
MENU_RADIUS=${RADIUS:-0}
mkconfigfile
jgmenu --config-file=${CONFIG_FILE} 2>/dev/null
}
# PANEL PO PRAWEJ AKTUALIZACE-USTAWIENIA-POMOC
right() {
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
MENU_HALIGN="right"
ITEM_HALIGN="left"
ARROW_STRING=" ⮜ "
TABS="100"
MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2)
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"
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"
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"
SIZE="Rozmiar Menu i Paneli"
TINY="malutki"
SMALL="mały"
NORMAL="normalny"
BIG="duży"
HUGE="wielki"
;;
*)
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"
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"
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"
SIZE="Menu/Sidepanels Size"
TINY="tiny"
SMALL="small"
NORMAL="normal"
BIG="big"
HUGE="huge"
;;
esac
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,15,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/distributor-logo-mabox.png
@text,,70,10,200,20,4,left,top,${color_title_fg% *},#111111,<big>$OSNAME $OSVERSION</big> <sup> $OSCODE</sup>
@text,,70,30,200,20,4,left,top,#666666,#444444,<small>$USER@$HOSTNAME</small>
@icon,,60,$(expr $MENU_HEIGHT_MIN - 153),143,143,4,left,top,,,$HOME/.config/mabox/right.png
@text,,20,50,200,20,4,left,top,#666666,#444444,
#@rect,,40,70,262,20,0,left,top,#666666,#262626,
@text,,84,50,20,20,0,left,top,auto,#222222,<big></big>
@search,,100,50,292,20,4,left,top,auto,#262626,""" <small><i>$TYPE_TO_SEARCH</i></small>"""
. $HOME/.config/mabox/right-prepend.csv
^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($SETTINGS)
$MCC,mcc,distributor-logo-mabox
$SYS_AND_HARDWARE,^root(system),audiocard
$LOOK_AND_FEEL,^root(wyglad),preferences-color
$SIZE,^checkout(menusize),applications-development
^sep($HELP)
$SHORTCUTS,mb-kb --gui &>/dev/null,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(menusize)
^sep($SIZE)
<small><small>$TINY</small></small>,cat /usr/share/mb-jgtools/tiny > ~/.config/mabox/jgmenusize.conf && mb-jgtools right
<small>$SMALL</small>,cat /usr/share/mb-jgtools/small > ~/.config/mabox/jgmenusize.conf && mb-jgtools right
$NORMAL,cat /usr/share/mb-jgtools/normal > ~/.config/mabox/jgmenusize.conf && mb-jgtools right
<big>$BIG</big>,cat /usr/share/mb-jgtools/big > ~/.config/mabox/jgmenusize.conf && mb-jgtools right
<big><big>$HUGE</big></big>,cat /usr/share/mb-jgtools/huge > ~/.config/mabox/jgmenusize.conf && mb-jgtools right
^tag(system)
^sep($SYS_AND_HARDWARE)
$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()
 $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)
^sep($LOOK_AND_FEEL)
$LXAPPEARANCE,lxappearance,preferences-desktop-theme
$NITROGEN,nitrogen,nitrogen
$OBCONF,obconf,obconf
$NOTIFYD,xfce4-notifyd-config,xfce4-notifyd
$PREFERRED_APPS,exo-preferred-applications,preferences-desktop-default-applications
$LIGHTDM,lightdm-gtk-greeter-settings-pkexec,lightdm-gtk-greeter-settings
$POWER_MNGR,xfce4-power-manager-settings,xfce4-power-manager-settings
^sep($MABOX_DESK_ELEM)
Conky,^pipe(jgmenu_run ob --cmd=mabox-conky-pipemenu),desktop-effects
$TINT2,^pipe(jgmenu_run ob --cmd=mabox-tint2-pipemenu),tint2conf
$COMPOSER,^pipe(jgmenu_run ob --cmd='mabox-compositor' --tag='Kompo'),compton
^sep($MABOX_THEMES)
$THEME_MNGR,mb-obthemes,preferences-desktop-theme
^sep()
 $BACK,^back()
^tag(weblinks)
^sep($ONLINE_RES)
^sep(Mabox)
Mabox - pierwsze kroki,exo-open --launch WebBrowser https://pl.maboxlinux.org/przewodnik-uzytkownika/,distributor-logo-mabox
Forum Mabox,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
^sep()
Manjaro PL,exo-open --launch WebBrowser https://manjaro.pl,distributor-logo-manjaro
Forum Manjaro PL,exo-open --launch WebBrowser https://forum.manjaro.pl,distributor-logo-manjaro
^sep(ArchLinux)
ArchWiki,exo-open --launch WebBrowser https://wiki.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(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(Tint2)
Tint2 GitLab,exo-open --launch WebBrowser https://gitlab.com/o9000/tint2,tint2
Tint2 ArchWiki,exo-open --launch WebBrowser https://wiki.archlinux.org/index.php/Tint2,tint2
^sep(Conky)
Conky Doc,exo-open --launch WebBrowser http://conky.sourceforge.net/documentation.html,conky
Conky Github,exo-open --launch WebBrowser https://github.com/brndnmtthws/conky/wiki,conky
Conky ArchWiki,exo-open --launch WebBrowser https://wiki.archlinux.org/index.php/Conky,conky
. $HOME/.config/mabox/online-resources.csv
^sep()
 $BACK,^back()
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
places() {
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
case $LANG in
pl*)
QUICK_NAV="Szybka nawigacja"
HOME_DIR="Katalog Domowy"
ROOTDIR="Katalog główny"
;;
*)
QUICK_NAV="Quick Navigation"
HOME_DIR="Home Directory"
ROOTDIR="Main Directory"
;;
esac
MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2)
JGWIDTH=220
jgmenu_icon_size=0
MENU_PADDING_TOP=70
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,10,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png
@icon,,40,$(expr $MENU_HEIGHT_MIN - 96),143,96,4,left,top,,,$HOME/.config/mabox/tux.svg
@text,,70,10,200,20,4,left,top,${color_title_fg% *},#111111,<big>$OSNAME $OSVERSION</big> <sup> $OSCODE</sup>
@text,,70,30,200,20,4,left,top,#666666,#444444,<small>$USER@$HOSTNAME</small>
@text,,70,50,200,20,4,left,top,#666666,#444444,
. $HOME/.config/mabox/places-prepend.csv
^sep($QUICK_NAV)
$ROOTDIR,^pipe(jgbrowser /)
$HOME_DIR,^pipe(jgbrowser)
$(basename $(xdg-user-dir DESKTOP)),^pipe(jgbrowser $(xdg-user-dir DESKTOP))
$(basename $(xdg-user-dir DOWNLOAD)),^pipe(jgbrowser $(xdg-user-dir DOWNLOAD))
#$(basename $(xdg-user-dir TEMPLATES)),^pipe(jgbrowser $(xdg-user-dir TEMPLATES))
#(basename $(xdg-user-dir PUBLICSHARE)),^pipe(jgbrowser $(xdg-user-dir PUBLICSHARE))
$(basename $(xdg-user-dir DOCUMENTS)),^pipe(jgbrowser $(xdg-user-dir DOCUMENTS))
$(basename $(xdg-user-dir MUSIC)),^pipe(jgbrowser $(xdg-user-dir MUSIC))
$(basename $(xdg-user-dir PICTURES)),^pipe(jgbrowser $(xdg-user-dir PICTURES))
$(basename $(xdg-user-dir VIDEOS)),^pipe(jgbrowser $(xdg-user-dir VIDEOS))
$(gtkbookmarks)
. $HOME/.config/mabox/vboxes.csv
. $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"
;;
*)
CANCEL="Cancel"
;;
esac
JGWIDTH="348"
MENU_PADDING_TOP=221
TABS="250"
jgmenu_item_height=30
jgmenu_icon_size=26
jgmenu_font="Noto Sans Medium 11"
MENU_RADIUS=${RADIUS:-0}
mkconfigfile
#wmctrl -k on
THUMB="$(DISPLAY=:0 scrot -t 340x213 -o $HOME/.config/mabox/mblogout.png -e 'echo $m')"
cat <<EOF > ${MENU_ITEMS}
@icon,,4,4,340,100,4,left,top,,,$THUMB
@icon,,10,20,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png
@text,,180,170,220,20,4,left,top,#EEEEEE,#111111,$OSNAME $OSVERSION <sup> $OSCODE</sup>
@text,,180,190,200,20,4,left,top,#DDDDDD,#DDDDDD,<small>$USER@$HOSTNAME</small>
. $HOME/.config/mabox/exit.csv
^sep()
$CANCEL <small>esc</small>,exit 1
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"
;;
*)
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
JGWIDTH="348"
MENU_PADDING_TOP=221
MENU_HALIGN="center"
MENU_VALIGN="center"
TABS="280"
jgmenu_item_height=28
jgmenu_icon_size=0
jgmenu_font='Noto Sans Medium 10'
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,,4,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() {
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=0
MENU_PADDING_RIGHT=0
MENU_PADDING_BOTTOM=0
MENU_PADDING_LEFT=0
jgmenu_icon_size=0
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"
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"
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"
SIZE="Rozmiar Menu i SidePaneli"
TINY="malutki"
SMALL="mały"
NORMAL="normalny"
BIG="duży"
HUGE="wielki"
;;
*)
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"
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"
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"
SIZE="Menu/Sidepanels Size"
TINY="tiny"
SMALL="small"
NORMAL="normal"
BIG="big"
HUGE="huge"
;;
esac
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
^sep( MENU USTAWIEŃ )
$SIZE,^checkout(menusize),applications-development
Conky,^pipe(jgmenu_run ob --cmd=mabox-conky-pipemenu),desktop-effects
$TINT2,^pipe(jgmenu_run ob --cmd=mabox-tint2-pipemenu),tint2conf
$COMPOSER,^pipe(jgmenu_run ob --cmd=mabox-compositor),compton
^tag(menusize)
^sep($SIZE)
<small><small>$TINY</small></small>,cat /usr/share/mb-jgtools/tiny > ~/.config/mabox/jgmenusize.conf && mb-jgtools right
<small>$SMALL</small>,cat /usr/share/mb-jgtools/small > ~/.config/mabox/jgmenusize.conf && mb-jgtools right
$NORMAL,cat /usr/share/mb-jgtools/normal > ~/.config/mabox/jgmenusize.conf && mb-jgtools right
<big>$BIG</big>,cat /usr/share/mb-jgtools/big > ~/.config/mabox/jgmenusize.conf && mb-jgtools right
<big><big>$HUGE</big></big>,cat /usr/share/mb-jgtools/huge > ~/.config/mabox/jgmenusize.conf && mb-jgtools right
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