This commit is contained in:
Daniel Napora 2021-01-14 19:01:40 +01:00
parent becbf0eb57
commit e23a3a8fdc

View File

@ -3,6 +3,28 @@
# mb-jgtools: Menu, Sidepanels, Screenshot Tool and Exit Dialog for Mabox
# Copyright (C) 2019-2021 Daniel Napora <napcok@gmail.com>
#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 <<EOF > ${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 <<EOF > $HOME/.config/jgmenu/prepend.csv
@text,,$(expr $jgtools_padding + 10),$(expr $jgtools_padding + 4),150,20,0,left,top,auto,#000000,<span size="large"></span>
@search,,$(expr $jgtools_padding + 24),$(expr $jgtools_padding + 4),150,20,2,left,top,auto,#000000 0,<i>$TYPE_TO_SEARCH</i>
^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 <<EOF > ${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,<big>$OSNAME $OSVERSION</big> <sup><i>$OSCODE</i></sup>
@text,,65,30,200,20,4,left,top,${color_norm_fg% *},#444444,<small>$USER@$HOSTNAME</small>
@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,<big>$OSNAME $OSVERSION</big> <sup><i>$OSCODE</i></sup>
@text,,$(expr $jgtools_padding + 65),$(expr $jgtools_padding + 30),200,20,4,left,top,${color_norm_fg% *},#444444,<small>$USER@$HOSTNAME</small>
@icon,,5,$(expr $MENU_HEIGHT_MIN - 180),240,180,4,center,top,,,$BOTTOM_IMG
@search,,80,50,292,20,4,left,top,auto,#262626,"""<big></big> <small><i>$TYPE_TO_SEARCH</i></small>"""
@search,,$(expr $jgtools_padding + 80),$(expr $jgtools_padding + 50),292,20,4,left,top,auto,#262626,"""<big></big> <small><i>$TYPE_TO_SEARCH</i></small>"""
. $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="<big></big> $POPINSTALL,^pipe(jgsoftware-pipe -r)" && pipesep="^sep($PIPEMENUS)"
@ -494,16 +528,16 @@ mkconfigfile
cat <<EOF > ${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,<big>$OSNAME $OSVERSION</big> <sup><i>$OSCODE</i></sup>
@text,,70,30,200,20,4,left,top,${color_norm_fg% *},#444444,<small>$USER@$HOSTNAME</small>
@text,,$(expr $jgtools_padding + 70),$(expr $jgtools_padding + 10),200,20,4,left,top,${color_sel_fg% *},#111111,<big>$OSNAME $OSVERSION</big> <sup><i>$OSCODE</i></sup>
@text,,$(expr $jgtools_padding + 70),$(expr $jgtools_padding + 30),200,20,4,left,top,${color_norm_fg% *},#444444,<small>$USER@$HOSTNAME</small>
. $HOME/.config/mabox/places-prepend.csv
^sep($QUICK_NAV)
<big>襁</big> $ROOTDIR,^pipe(jgbrowser /),folder
<big></big> $HOME_DIR,^pipe(jgbrowser),folder-home
<tt><big>襁</big></tt> $ROOTDIR,^pipe(jgbrowser /),folder
<tt><big></big></tt> $HOME_DIR,^pipe(jgbrowser),folder-home
<big> </big> $(basename $(xdg-user-dir DOWNLOAD)),^pipe(jgbrowser $(xdg-user-dir DOWNLOAD)),folder-download
<big> </big> $(basename $(xdg-user-dir DOCUMENTS)),^pipe(jgbrowser $(xdg-user-dir DOCUMENTS)),folder-documents
<big> </big> $(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 <<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,${color_sel_fg% *},${color_sel_bg% *},$OSNAME $OSVERSION <sup> $OSCODE</sup>
@text,,180,190,200,20,4,left,top,${color_norm_fg% *},#DDDDDD,<small>$USER@$HOSTNAME</small>
@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 <sup> $OSCODE</sup>
@text,,$(expr $jgtools_padding + 180),$(expr $jgtools_padding + 190),200,20,4,left,top,${color_norm_fg% *},#DDDDDD,<small>$USER@$HOSTNAME</small>
. $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 <<EOF > ${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