import mb-jgtools

master
Daniel Napora 2020-01-21 23:00:04 +01:00
parent c7cd35a838
commit 7beb9f2dac
1 changed files with 300 additions and 0 deletions

300
bin/mb-jgtools 100755
View File

@ -0,0 +1,300 @@
#!/bin/bash
# Get colors from config file
. $HOME/.config/mb-jgtools/mb-jgtools.colorrc
JGWIDTH="322"
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}')
KERNEL=$(uname -r)
mkconfigfile() {
cat <<EOF > ${CONFIG_FILE}
stay_alive = 0
hide_back_items = 0
terminal_exec = terminator
terminal_args = -e
tabs = ${TABS:-240}
menu_margin_x = $POSX
menu_margin_y = 0
menu_width = $JGWIDTH
menu_height_min = ${MENU_HEIGHT_MIN:-0}
menu_height_max = ${MENU_HEIGHT_MAX:-0}
menu_padding_top = 90
menu_padding_right = 10
menu_padding_bottom = 10
menu_padding_left = 10
menu_radius = 0
menu_valign = ${MENU_VALIGN:-top}
menu_halign = ${MENU_HALIGN:-0}
item_height = ${ITEM_HEIGHT:-25}
item_halign = left
columns = ${COLUMNS:-1}
sep_markup = font="Noto Sans Bold 10" foreground="#FFFFFF"
font = ${FONT:-Noto Sans Medium 9}
icon_size = 0
color_menu_bg = ${COLOR_MENU_BG:-#222222 90}
color_menu_border = ${COLOR_MENU_BORDER:-#2f9b85 100}
color_norm_bg = ${COLOR_NORM_BG:-#262626 100}
color_norm_fg = ${COLOR_NORM_FG:-#CCCCCC 100}
color_sel_bg = ${COLOR_SEL_BG:-#169f6f 80}
color_sel_fg = ${COLOR_SEL_FG:-#f8f8f8 100}
color_sel_border = ${COLOR_SEL_BORDER:-#504e65 100}
color_sep_fg = ${COLOR_SEP_FG:-#2f9b85 100}
color_sep_bg = ${COLOR_SEP_BG:-#262626 100}
color_scroll_ind = ${COLOR_SCROLL_IND:-#504e65 100}
EOF
}
# PANEL PO PRAWEJ AKTUALIZACE-USTAWIENIA-POMOC
right() {
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
((POSX = SCREENWIDTH - JGWIDTH))
MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2)
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,10,20,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png
@text,,70,10,200,20,4,left,top,#EEEEEE,#111111,<big>$OSNAME $OSVERSION</big> <sup> $OSCODE</sup>
@text,,70,30,200,20,4,left,top,#666666,#444444,<small>Jądro:</small> $KERNEL $HOSTTYPE
@text,,70,50,200,20,4,left,top,#666666,#444444,<small>$USER@$HOSTNAME</small>
@rect,,40,70,262,20,0,left,top,#666666,#262626,
@text,,20,70,20,20,0,left,top,#169f6f,#222222,<big></big>
@search,,40,70,292,20,4,left,top,#169f6f,#222222,""" pisz, aby wyszukać"""
^sep(Zarządzanie oprogramowaniem)
Aktualizacja systemu (Pamac),pamac-manager --updates
Aktualizacja systemu (cli),^term(sudo pacman -Syyu)
Menadżer pakietów - Pamac,pamac-manager
Odnawianie kluczy,^term(sudo pacman -Sy archlinux-keyring manjaro-keyring mabox-keyring)
Ranking mirrorów,^checkout(mirrory)
^sep(Ustawienia)
System i sprzęt,^root(system)
Wygląd i zachowanie,^root(wyglad)
^sep(Pomoc)
Skróty klawiszowe,^root(shortcuts)
^sep(Wyjście)
 Wyloguj,openbox --exit
 Uśpij,systemctl suspend
 Hibernuj,systemctl hibernate,
 Uruchom ponownie,systemctl reboot
 Wyłącz,systemctl poweroff
 Zablokuj ekran, betterlockscreen -l
^tag(system)
^sep(System i sprzęt)
Język i formaty,manjaro-settings-manager -m msm_locale,
Pakiety językowe,manjaro-settings-manager -m msm_language_packages,
Jądro systemowe,manjaro-settings-manager -m msm_kernel,
Konta użytkowników,manjaro-settings-manager -m msm_users,
Data i Czas,manjaro-settings-manager -m msm_timedate,
Ustawienia klawiatury,manjaro-settings-manager -m msm_keyboard,
Konfiguracja sprzętowa,manjaro-settings-manager -m msm_mhwd,
 wróć,^back()
^tag(mirrory)
Wszystkie,^term(sudo pacman-mirrors -i -c all)
Najbliższe (wg GEOIP),term(sudo pacman-mirrors -i --geoip)
 wróć,^back()
^tag(wyglad)
^sep(Wygląd i zachowanie)
Wystrój i ikony,lxappearance,
Wybór tapety,nitrogen,
Menadżer konfiguracji OpenBox,obconf,
Kompozytor,^pipe(jgmenu_run ob --cmd='mabox-compositor' --tag='Kompo'),compton
 wróć,^back()
^tag(shortcuts)
^sep(Domyślne skróty klawiszowe)
^sep(Uruchamianie aplikacji)
Terminal W+t,terminator,
Przeglądarka WWW W+w,exo-open --launch WebBrowser,
Menadżer plików W+f,exo-open --launch FileManager,
Edytor tekstu W+e,exo-open --launch TextEditor,
Kontrola głośności <span fgcolor="#222222" bgcolor="#BBBBBB" size="smaller"> W+v </span>,pavucontrol,
włącz/wyłącz Kompozytora <span fgcolor="#222222" bgcolor="#BBBBBB" size="smaller"> W+c </span>,compton_toggle,
Blokuj ekran W+l, betterlockscreen -l,
^sep(Okna)
^sep(Pulpity)
 wróć,^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
MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2)
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,10,20,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png
@text,,70,10,200,20,4,left,top,#EEEEEE,#111111,<big>$OSNAME $OSVERSION</big> <sup> $OSCODE</sup>
@text,,70,30,200,20,4,left,top,#666666,#444444,<small>Jądro:</small> $KERNEL $HOSTTYPE
@text,,70,50,200,20,4,left,top,#666666,#444444,<small>$USER@$HOSTNAME</small>
^sep(Szybka nawigacja)
 Katalog główny,^pipe(jgmenu_run ob --cmd='obbrowser /'
 Katalog domowy,^pipe(jgmenu_run ob --cmd='mabox-places-pipemenu'
 $(basename $(xdg-user-dir DESKTOP)),^pipe(jgmenu_run ob --cmd="mabox-places-pipemenu $(xdg-user-dir DESKTOP)"
 $(basename $(xdg-user-dir DOWNLOAD)),^pipe(jgmenu_run ob --cmd="mabox-places-pipemenu $(xdg-user-dir DOWNLOAD)"
 $(basename $(xdg-user-dir TEMPLATES)),^pipe(jgmenu_run ob --cmd="mabox-places-pipemenu $(xdg-user-dir TEMPLATES)"
 $(basename $(xdg-user-dir PUBLICSHARE)),^pipe(jgmenu_run ob --cmd="mabox-places-pipemenu $(xdg-user-dir PUBLICSHARE)"
 $(basename $(xdg-user-dir DOCUMENTS)),^pipe(jgmenu_run ob --cmd="mabox-places-pipemenu $(xdg-user-dir DOCUMENTS)"
 $(basename $(xdg-user-dir MUSIC)),^pipe(jgmenu_run ob --cmd="mabox-places-pipemenu $(xdg-user-dir MUSIC)"
 $(basename $(xdg-user-dir PICTURES)),^pipe(jgmenu_run ob --cmd="mabox-places-pipemenu $(xdg-user-dir PICTURES)"
 $(basename $(xdg-user-dir VIDEOS)),^pipe(jgmenu_run ob --cmd="'mabox-places-pipemenu' $(xdg-user-dir VIDEOS)"
^sep()
<big></big> Wyszukiwarka plików, fsearch
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
mblogout() {
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
#Lokalne zmienne;
JGWIDTH="340"
MENU_HALIGN="center"
MENU_VALIGN="center"
TABS="280"
ITEM_HEIGHT="40"
FONT="Noto Sans Medium 12"
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,10,20,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png
@text,,70,10,220,20,4,left,top,#EEEEEE,#111111,$OSNAME $OSVERSION <sup> $OSCODE</sup>
@text,,70,30,240,20,4,left,top,#666666,#444444,<small>Jądro: $KERNEL $HOSTTYPE</small>
@text,,70,50,200,20,4,left,top,#666666,#444444,<small>$USER@$HOSTNAME</small>
 Wyloguj,openbox --exit
 Uśpij,systemctl suspend
 Hibernuj,systemctl hibernate
 Uruchom ponownie,systemctl reboot
 Wyłącz,systemctl poweroff
 Zablokuj ekran, betterlockscreen -l
Anuluj <span fgcolor="#222222" bgcolor="#BBBBBB" size="x-small"> <sup>esc</sup> </span>,exit 1
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
panels() {
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
#Lokalne zmienne;
JGWIDTH="500"
MENU_HALIGN="center"
MENU_VALIGN="center"
MENU_HEIGHT_MIN="210"
MENU_HEIGHT_MAX="210"
TABS="280"
ITEM_HEIGHT="50"
FONT="Noto Sans Medium 12"
COLUMNS="2"
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,10,20,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png
@text,,70,10,220,20,4,left,top,#EEEEEE,#111111,$OSNAME $OSVERSION <sup> $OSCODE</sup>
@text,,70,30,240,20,4,left,top,#666666,#444444,<small>Jądro: $KERNEL $HOSTTYPE</small>
@text,,70,50,200,20,4,left,top,#666666,#444444,<small>$USER@$HOSTNAME</small>
 Szybka nawigacja,mb-jgtools places
 coś tu będzie,
 System panel,mb-jgtools right
 Wylogowanie,mb-jgtools mblogout
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
right) right;;
mblogout) mblogout;;
places) places;;
panels) panels;;
*)
echo -e "
${GRN}Kolekcja narzędzi dla Mabox-a stworzonych na bazie Jgmenu
Użycie:
${DEF} $(basename "$0")${YLW} [${RED} OPCJA${YLW} ]
${GRN} Opcje:
${YLW} >${RED} panels ${YLW} -${DEF} all panel access
${YLW} >${RED} right ${YLW} -${DEF} run right panel
${YLW} >${RED} places ${YLW} -${DEF} places menu
${YLW} >${RED} mblogout ${YLW} -${DEF} run logout script
" >&2
exit 1
;;
esac
exit 0