From e23a3a8fdc3a9fbe1dc0c5e43864c8909fed7c87 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Thu, 14 Jan 2021 19:01:40 +0100 Subject: [PATCH] update --- bin/mb-jgtools | 109 +++++++++++++++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 39 deletions(-) diff --git a/bin/mb-jgtools b/bin/mb-jgtools index 781876c..6a52977 100755 --- a/bin/mb-jgtools +++ b/bin/mb-jgtools @@ -3,6 +3,28 @@ # mb-jgtools: Menu, Sidepanels, Screenshot Tool and Exit Dialog for Mabox # Copyright (C) 2019-2021 Daniel Napora #mb-setvar jgtools_last="\"$*\"" + +### Temporary: deal with new features and nedeed config files +FAV="$HOME/.config/mabox/favorites.csv" +if [ ! -f "$FAV" ]; then + echo "$FAV does not exist." + case $LANG in + pl*) LNGDIR="pl";; + es*) LNGDIR="es";; + *) LNGDIR="en";; + +esac +rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/settings* $HOME/.config/mabox/ +rsync -a /usr/share/mabox/lang/$LNGDIR/.config/jgmenu/*.csv $HOME/.config/jgmenu/ +rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/places* $HOME/.config/mabox/ +rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/*pend* $HOME/.config/mabox/ +rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/favorites.csv $HOME/.config/mabox/ +#rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/exit.csv $HOME/.config/mabox/ + +fi + +# END temporary fix + . $HOME/.config/mabox/mabox.conf unset font unset menu_gradient_pos @@ -64,7 +86,6 @@ OSNAME=$(lsb_release -d | awk '{print $2}') OSVERSION=$(lsb_release -r | awk '{print $2}') OSCODE=$(lsb_release -c | awk '{print $2}') - mkconfigfile() { cat < ${CONFIG_FILE} position_mode = ${POSITION_MODE:-fixed} @@ -81,14 +102,13 @@ menu_margin_x = ${menu_margin_x:-0} menu_margin_y = ${panels_topmargin:-0} sub_spacing = ${submenu_spacing:-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:-2} -menu_padding_left = ${MENU_PADDING_LEFT:-2} +menu_padding_right = ${jgtools_padding:-0} +menu_padding_bottom = ${jgtools_padding:-0} +menu_padding_left = ${jgtools_padding:-0} menu_radius = ${MENU_RADIUS:-0} menu_valign = ${MENU_VALIGN:-top} menu_halign = ${MENU_HALIGN:-left} @@ -103,8 +123,6 @@ item_radius = ${item_radius:-2} item_border = ${item_border:-0} arrow_string = ${ARROW_STRING:-⮞} - - columns = ${COLUMNS:-1} menu_gradient_pos = ${menu_gradient_pos:-none} color_menu_bg = ${color_menu_bg:-#222222 80} @@ -122,7 +140,6 @@ 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} @@ -140,20 +157,35 @@ main() { mb-setvar jgtools_last="\"main ipc\"" CONFIG_FILE=$(mktemp) -MENU_ITEMS=$(mktemp) -trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT +HEADER_FILE=$(mktemp) +trap "rm -f ${CONFIG_FILE} ${HEADER_FILE}" EXIT POSITION_MODE=${1:-pointer} HIDE_BACK_ITEMS=1 -MENU_PADDING_TOP=24 -#MENU_PADDING_RIGHT=0 -#MENU_PADDING_BOTTOM=0 -#MENU_PADDING_LEFT=0 +#MENU_PADDING_TOP=24 +MENU_PADDING_TOP=$(expr $jgtools_padding + 24) + +### write header file to prepend.csv +case $LANG in + pl*) TYPE_TO_SEARCH="Pisz aby wyszukać";; + es*) TYPE_TO_SEARCH="Buscar";; + *) TYPE_TO_SEARCH="type to search";; +esac + +cat < $HOME/.config/jgmenu/prepend.csv +@text,,$(expr $jgtools_padding + 10),$(expr $jgtools_padding + 4),150,20,0,left,top,auto,#000000, +@search,,$(expr $jgtools_padding + 24),$(expr $jgtools_padding + 4),150,20,2,left,top,auto,#000000 0,$TYPE_TO_SEARCH +^sep() +. ~/.config/mabox/favorites.csv +EOF + + [ $jgmenu_use_icons == false ] && jgmenu_icon_size=0 mkconfigfile jgmenu --config-file=${CONFIG_FILE} 2>/dev/null + } # PANEL PO PRAWEJ AKTUALIZACE-USTAWIENIA-POMOC @@ -170,7 +202,8 @@ ITEM_HALIGN="left" ARROW_STRING=" ⮜ " JGWIDTH=40 TABS="100" - +MENU_PADDING_TOP=$(expr $jgtools_padding + 70) +menu_margin_x=${submenu_spacing:-0} panels_topmargin=${panels_topmargin:-0} eval $(xdotool getdisplaygeometry --shell) MENU_HEIGHT_MIN=$(expr $HEIGHT - $panels_topmargin - $panels_topmargin) @@ -324,11 +357,11 @@ esac mkconfigfile cat < ${MENU_ITEMS} -@icon,,10,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/distributor-logo-mabox.png -@text,,65,10,200,20,4,left,top,${color_sel_fg% *},#111111,$OSNAME $OSVERSION $OSCODE -@text,,65,30,200,20,4,left,top,${color_norm_fg% *},#444444,$USER@$HOSTNAME +@icon,,$(expr $jgtools_padding + 10),$(expr $jgtools_padding + 10),48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/distributor-logo-mabox.png +@text,,$(expr $jgtools_padding + 65),$(expr $jgtools_padding + 10),200,20,4,left,top,${color_sel_fg% *},#111111,$OSNAME $OSVERSION $OSCODE +@text,,$(expr $jgtools_padding + 65),$(expr $jgtools_padding + 30),200,20,4,left,top,${color_norm_fg% *},#444444,$USER@$HOSTNAME @icon,,5,$(expr $MENU_HEIGHT_MIN - 180),240,180,4,center,top,,,$BOTTOM_IMG -@search,,80,50,292,20,4,left,top,auto,#262626,""" $TYPE_TO_SEARCH""" +@search,,$(expr $jgtools_padding + 80),$(expr $jgtools_padding + 50),292,20,4,left,top,auto,#262626,""" $TYPE_TO_SEARCH""" . $HOME/.config/mabox/right-prepend.csv @@ -476,13 +509,14 @@ esac #SCRHEIGHT=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2) panels_topmargin=${panels_topmargin:-0} +menu_margin_x=${submenu_spacing:-0} eval $(xdotool getdisplaygeometry --shell) MENU_HEIGHT_MIN=$(expr $HEIGHT - $panels_topmargin - $panels_topmargin) MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN JGWIDTH=40 jgmenu_icon_size=0 -MENU_PADDING_TOP=60 +MENU_PADDING_TOP=$(expr $jgtools_padding + 60) BOTTOM_IMG=${places_bottom_img:-/usr/share/mb-jgtools/mabox_3D_silver.png} #if [[ $places_softwarepipe || $places_sysinfopipe || $places_keyspipe ]];then pipeseparator="^sep($PIPEMENUS)";fi [ $places_softwarepipe == true ] && softwarepipe=" $POPINSTALL,^pipe(jgsoftware-pipe -r)" && pipesep="^sep($PIPEMENUS)" @@ -494,16 +528,16 @@ mkconfigfile cat < ${MENU_ITEMS} -@icon,,10,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png +@icon,,$(expr $jgtools_padding + 10),$(expr $jgtools_padding + 10),48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png @icon,,10,$(expr $MENU_HEIGHT_MIN - 160),240,180,4,center,top,,,$BOTTOM_IMG -@text,,70,10,200,20,4,left,top,${color_sel_fg% *},#111111,$OSNAME $OSVERSION $OSCODE -@text,,70,30,200,20,4,left,top,${color_norm_fg% *},#444444,$USER@$HOSTNAME +@text,,$(expr $jgtools_padding + 70),$(expr $jgtools_padding + 10),200,20,4,left,top,${color_sel_fg% *},#111111,$OSNAME $OSVERSION $OSCODE +@text,,$(expr $jgtools_padding + 70),$(expr $jgtools_padding + 30),200,20,4,left,top,${color_norm_fg% *},#444444,$USER@$HOSTNAME . $HOME/.config/mabox/places-prepend.csv ^sep($QUICK_NAV) - $ROOTDIR,^pipe(jgbrowser /),folder - $HOME_DIR,^pipe(jgbrowser),folder-home + $ROOTDIR,^pipe(jgbrowser /),folder + $HOME_DIR,^pipe(jgbrowser),folder-home $(basename $(xdg-user-dir DOWNLOAD)),^pipe(jgbrowser $(xdg-user-dir DOWNLOAD)),folder-download $(basename $(xdg-user-dir DOCUMENTS)),^pipe(jgbrowser $(xdg-user-dir DOCUMENTS)),folder-documents $(basename $(xdg-user-dir MUSIC)),^pipe(jgbrowser $(xdg-user-dir MUSIC)),folder-music @@ -544,8 +578,8 @@ case $LANG in *) CANCEL="Cancel";; esac -JGWIDTH="348" -MENU_PADDING_TOP=221 +JGWIDTH=$(expr $jgtools_padding + "348" + $jgtools_padding) +MENU_PADDING_TOP=$(expr $jgtools_padding + 221) TABS="250" jgmenu_item_height=30 jgmenu_icon_size=26 @@ -556,10 +590,10 @@ mkconfigfile #wmctrl -k on THUMB="$(DISPLAY=:0 scrot -t 340x213 -o $HOME/.config/mabox/mblogout.png -e 'echo $m')" cat < ${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,${color_sel_fg% *},${color_sel_bg% *},$OSNAME $OSVERSION $OSCODE -@text,,180,190,200,20,4,left,top,${color_norm_fg% *},#DDDDDD,$USER@$HOSTNAME +@icon,,$(expr $jgtools_padding + 4),$(expr $jgtools_padding + 4),340,100,4,left,top,,,$THUMB +@icon,,10,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png +@text,,$(expr $jgtools_padding + 180),$(expr $jgtools_padding + 170),220,20,4,left,top,${color_sel_fg% *},${color_sel_bg% *},$OSNAME $OSVERSION $OSCODE +@text,,$(expr $jgtools_padding + 180),$(expr $jgtools_padding + 190),200,20,4,left,top,${color_norm_fg% *},#DDDDDD,$USER@$HOSTNAME . $HOME/.config/mabox/exit.csv ^sep() @@ -615,8 +649,8 @@ case $LANG in CANCEL="Cancel" ;; esac -JGWIDTH="348" -MENU_PADDING_TOP=221 +JGWIDTH=$(expr $jgtools_padding + "348" + $jgtools_padding) +MENU_PADDING_TOP=$(expr $jgtools_padding + 221) MENU_HALIGN="center" MENU_VALIGN="center" TABS="280" @@ -635,7 +669,7 @@ THUMB="$(DISPLAY=:0 scrot -t 340x213 -o $HOME/.config/mabox/jgscrot.png -e 'echo mkconfigfile cat < ${MENU_ITEMS} -@icon,,4,4,340,100,4,left,top,,,$THUMB +@icon,,$(expr $jgtools_padding + 4),$(expr $jgtools_padding + 4),340,100,4,left,top,,,$THUMB ^sep($SCRNSHOTS)  $FULLSCR,^root(full)  $ACTIVE_WIN,^root(window) @@ -680,11 +714,8 @@ 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 -#PERSISTENT=1 +MENU_PADDING_TOP=${jgtools_padding} + TABS="90" [ $jgmenu_use_icons == false ] && jgmenu_icon_size=0 #jgmenu_icon_size=20