master
Daniel Napora 2020-01-28 23:28:23 +01:00
parent a48237e851
commit 54a48b2dd2
1 changed files with 101 additions and 15 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Get colors from config file # Get colors from config file
. $HOME/.config/mb-jgtools/mb-jgtools.colorrc #. $HOME/.config/mb-jgtools/mb-jgtools.colorrc
JGWIDTH="322" JGWIDTH="322"
@ -16,8 +16,10 @@ KERNEL=$(uname -r)
mkconfigfile() { mkconfigfile() {
cat <<EOF > ${CONFIG_FILE} cat <<EOF > ${CONFIG_FILE}
position_mode = ${POSITION_MODE:-fixed}
csv_cmd = lx
stay_alive = 0 stay_alive = 0
hide_back_items = 0 hide_back_items = ${HIDE_BACK_ITEMS:-0}
terminal_exec = terminator terminal_exec = terminator
terminal_args = -e terminal_args = -e
tabs = ${TABS:-240} tabs = ${TABS:-240}
@ -26,11 +28,11 @@ menu_margin_y = 0
menu_width = $JGWIDTH menu_width = $JGWIDTH
menu_height_min = ${MENU_HEIGHT_MIN:-0} menu_height_min = ${MENU_HEIGHT_MIN:-0}
menu_height_max = ${MENU_HEIGHT_MAX:-0} menu_height_max = ${MENU_HEIGHT_MAX:-0}
menu_padding_top = 90 menu_padding_top = ${MENU_PADDING_TOP:-90}
menu_padding_right = 10 menu_padding_right = ${MENU_PADDING_RIGHT:-10}
menu_padding_bottom = 10 menu_padding_bottom = ${MENU_PADDING_BOTTOM:-10}
menu_padding_left = 10 menu_padding_left = ${MENU_PADDING_LEFT:-10}
menu_radius = 0 menu_radius = ${MENU_RADIUS:-0}
menu_valign = ${MENU_VALIGN:-top} menu_valign = ${MENU_VALIGN:-top}
menu_halign = ${MENU_HALIGN:-0} menu_halign = ${MENU_HALIGN:-0}
@ -41,21 +43,46 @@ columns = ${COLUMNS:-1}
sep_markup = font="Noto Sans Bold 10" foreground="#FFFFFF" sep_markup = font="Noto Sans Bold 10" foreground="#FFFFFF"
font = ${FONT:-Noto Sans Medium 9} font = ${FONT:-Noto Sans Medium 9}
icon_size = 0 icon_size = ${ICON_SIZE:-0}
color_menu_bg = ${COLOR_MENU_BG:-#222222 90} color_menu_bg = ${COLOR_MENU_BG:-#222222 90}
color_menu_border = ${COLOR_MENU_BORDER:-#2f9b85 100} color_menu_border = ${COLOR_MENU_BORDER:-#2f9b85 100}
color_norm_bg = ${COLOR_NORM_BG:-#262626 100} color_norm_bg = ${COLOR_NORM_BG:-#000000 0}
color_norm_fg = ${COLOR_NORM_FG:-#CCCCCC 100} color_norm_fg = ${COLOR_NORM_FG:-#CCCCCC 100}
color_sel_bg = ${COLOR_SEL_BG:-#169f6f 80} color_sel_bg = ${COLOR_SEL_BG:-#169f6f 60}
color_sel_fg = ${COLOR_SEL_FG:-#f8f8f8 100} color_sel_fg = ${COLOR_SEL_FG:-#f8f8f8 100}
color_sel_border = ${COLOR_SEL_BORDER:-#504e65 100} color_sel_border = ${COLOR_SEL_BORDER:-#504e65 100}
color_sep_fg = ${COLOR_SEP_FG:-#2f9b85 100} color_sep_fg = ${COLOR_SEP_FG:-#4D4D4D 100}
color_sep_bg = ${COLOR_SEP_BG:-#262626 100} color_sep_bg = ${COLOR_SEP_BG:-#262626 100}
color_scroll_ind = ${COLOR_SCROLL_IND:-#504e65 100} color_scroll_ind = ${COLOR_SCROLL_IND:-#504e65 100}
EOF EOF
} }
#MENU GŁÓWNE
main() {
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
POSITION_MODE=pointer
HIDE_BACK_ITEMS=1
MENU_PADDING_TOP=30
MENU_PADDING_RIGHT=0
MENU_PADDING_BOTTOM=0
MENU_PADDING_LEFT=0
JGWIDTH=0
ITEM_HEIGHT=20
ICON_SIZE=16
MENU_RADIUS=10
mkconfigfile
#jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
jgmenu --config-file=${CONFIG_FILE} 2>/dev/null
}
# PANEL PO PRAWEJ AKTUALIZACE-USTAWIENIA-POMOC # PANEL PO PRAWEJ AKTUALIZACE-USTAWIENIA-POMOC
right() { right() {
CONFIG_FILE=$(mktemp) CONFIG_FILE=$(mktemp)
@ -91,8 +118,10 @@ cat <<EOF > ${MENU_ITEMS}
^sep(Pomoc) ^sep(Pomoc)
Skróty klawiszowe,^root(shortcuts) Skróty klawiszowe,^root(shortcuts)
^sep(Inne)
 Zrzut ekranu,mb-jgtools screenshot
^sep(Wyjście) ^sep(Wyjście)
@ -194,7 +223,7 @@ MENU_VALIGN="center"
TABS="280" TABS="280"
ITEM_HEIGHT="40" ITEM_HEIGHT="40"
FONT="Noto Sans Medium 12" FONT="Noto Sans Medium 12"
MENU_RADIUS=20
mkconfigfile mkconfigfile
cat <<EOF > ${MENU_ITEMS} cat <<EOF > ${MENU_ITEMS}
@ -208,11 +237,63 @@ cat <<EOF > ${MENU_ITEMS}
 Uruchom ponownie,systemctl reboot  Uruchom ponownie,systemctl reboot
 Wyłącz,systemctl poweroff  Wyłącz,systemctl poweroff
 Zablokuj ekran, betterlockscreen -l  Zablokuj ekran, betterlockscreen -l
 Anuluj <span fgcolor="#222222" bgcolor="#BBBBBB" size="x-small"> <sup>esc</sup> </span>,exit 1  Anuluj <small>esc</small>,exit 1
EOF EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null 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
#Lokalne zmienne;
JGWIDTH="340"
MENU_PADDING_TOP=10
MENU_HALIGN="center"
MENU_VALIGN="center"
TABS="280"
ITEM_HEIGHT="25"
FONT="Noto Sans Medium 10"
MENU_RADIUS=10
IMG="$(xdg-user-dir PICTURES)/Mabox_%Y-%m-%d-%H:%M:%s.png"
VIEW="'viewnior $IMG'"
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
^sep(Zrzut ekranu)
 Pełny ekran,^root(full)
 Aktywne okno,^root(window)
 Aktywne okno (bez dekoracji),^root(borderless)
 Zaznaczony obszar lub okno,scrot -s $IMG -e $VIEW
 Multimonitor, scrot -m $IMG -e $VIEW
^sep()
 Anuluj <small>esc</small>,exit 1
^tag(full)
^sep(Pełny ekran )
 Teraz,scrot $IMG -e $VIEW
 Za 5 sekund,scrot -d 5 $IMG -e $VIEW
 Za 10 sekund,scrot -d 10 $IMG -e $VIEW
 wróć,^back()
^tag(window)
^sep(Aktywne Okno )
 Teraz,scrot -d 1 -u -b $IMG -e $VIEW
 Za 5 sekund,scrot -d 5 -u -b $IMG -e $VIEW
 Za 10 sekund,scrot -d 10 -u -b $IMG -e $VIEW
 wróć,^back()
^tag(borderless)
^sep(Aktywne Okno - bez dekoracji)
 Teraz,scrot -d 1 -u $IMG -e $VIEW
 Za 5 sekund,scrot -d 5 -u $IMG -e $VIEW
 Za 10 sekund,scrot -d 10 -u $IMG -e $VIEW
 wróć,^back()
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
panels() { panels() {
CONFIG_FILE=$(mktemp) CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp) MENU_ITEMS=$(mktemp)
@ -241,6 +322,7 @@ cat <<EOF > ${MENU_ITEMS}
 coś tu będzie,  coś tu będzie,
 System panel,mb-jgtools right  System panel,mb-jgtools right
 Wylogowanie,mb-jgtools mblogout  Wylogowanie,mb-jgtools mblogout
Zrzuty ekranu,mb-jgtools screenshot
EOF EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
@ -275,23 +357,27 @@ CON='\e[?25h' #Cursor On |
#--------------------------------------------------------------------+ #--------------------------------------------------------------------+
case "$1" in case "$1" in
main) main;;
right) right;; right) right;;
mblogout) mblogout;; mblogout) mblogout;;
places) places;; places) places;;
screenshot) screenshot;;
panels) panels;; panels) panels;;
*) *)
echo -e " echo -e "
${GRN}Kolekcja narzędzi dla Mabox-a stworzonych na bazie Jgmenu ${GRN}Kolekcja narzędzi dla Mabox-a stworzonych z pomocą Jgmenu
Użycie: Użycie:
${DEF} $(basename "$0")${YLW} [${RED} OPCJA${YLW} ] ${DEF} $(basename "$0")${YLW} [${RED} OPCJA${YLW} ]
${GRN} Opcje: ${GRN} Opcje:
${YLW} >${RED} main ${YLW} -${DEF} main menu - replaces OB menu
${YLW} >${RED} panels ${YLW} -${DEF} all panel access ${YLW} >${RED} panels ${YLW} -${DEF} all panel access
${YLW} >${RED} right ${YLW} -${DEF} run right panel ${YLW} >${RED} right ${YLW} -${DEF} run right panel
${YLW} >${RED} places ${YLW} -${DEF} places menu ${YLW} >${RED} places ${YLW} -${DEF} places menu
${YLW} >${RED} mblogout ${YLW} -${DEF} run logout script ${YLW} >${RED} mblogout ${YLW} -${DEF} run logout script
${YLW} >${RED} screenshot ${YLW} -${DEF} run screenshot script
" >&2 " >&2
exit 1 exit 1
;; ;;