diff --git a/bin/mb-jgtools b/bin/mb-jgtools index ad6ce01..4899cc2 100755 --- a/bin/mb-jgtools +++ b/bin/mb-jgtools @@ -2,28 +2,6 @@ # # 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 @@ -63,20 +41,24 @@ jgmenu_font="${menu_font_family} ${menu_font_size}" gtkbookmarks() { -BOOKMARKS="$HOME/.gtk-bookmarks" -if [[ -s "$BOOKMARKS" ]]; then -case $LANG in - pl*) GTK_BOOKMARKS="Zakładki";; - es*) GTK_BOOKMARKS="Marcadores" ;; - *) GTK_BOOKMARKS="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[@]}" +if [ $places_bookmarks == true ]; then + BOOKMARKS="$HOME/.gtk-bookmarks" + if [[ -s "$BOOKMARKS" ]]; then + case $LANG in + pl*) GTK_BOOKMARKS="Zakładki";; + es*) GTK_BOOKMARKS="Marcadores" ;; + *) GTK_BOOKMARKS="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 +else +printf "" fi } @@ -449,8 +431,10 @@ $UGUIDE ^sep() ⮜ $BACK,^back() ^tag(weblinks) -^sep($ONLINE_RES) -^sep() +#^sep($ONLINE_RES) +^sep(Mabox Linux) +Mabox Website,exo-open --launch WebBrowser https://maboxlinux.org/,distributor-logo-mabox +Mabox Forum,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 @@ -493,7 +477,8 @@ mb-setvar jgtools_last="\"places\"" CONFIG_FILE=$(mktemp) MENU_ITEMS=$(mktemp) -trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT +QNAV=$(mktemp) +trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS} ${QNAV}" EXIT case $LANG in pl*) @@ -505,6 +490,7 @@ case $LANG in SYSINFO="Informacje o systemie" SHORTCUTS="Skróty klawiszowe" MENUPANELS="Ustawienia Menu/Paneli" + TINT2SETTINGS="Ustawienia panelu Tint2" SSH_CONN="Połącz po SSH" ;; es*) @@ -516,6 +502,7 @@ case $LANG in SYSINFO="System information" SHORTCUTS="Atajos del teclado" MENUPANELS="Menu/Paneles laterales" + TINT2SETTINGS="Tint2 panel settings" SSH_CONN="Conexiones SSH" ;; *) @@ -527,13 +514,11 @@ case $LANG in SYSINFO="System information" SHORTCUTS="Keyboard shortcuts" MENUPANELS="Menu/Sidepanels settings" + TINT2SETTINGS="Tint2 panel settings" SSH_CONN="SSH connections" ;; esac -#MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2) -# eksperyment -#SCRHEIGHT=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2) panels_topmargin=${panels_topmargin:-0} menu_margin_x=${submenu_spacing:-0} @@ -545,25 +530,13 @@ MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN JGWIDTH=40 jgmenu_icon_size=0 MENU_PADDING_TOP=$(expr $jgtools_padding + 60) -BOTTOM_IMG=${places_bottom_img:-/usr/share/mb-jgtools/mabox_3D_silver.png} +#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)" -[ $places_sysinfopipe == true ] && sysinfopipe=" $SYSINFO,^pipe(jgsysinfo-pipe -r)" && pipesep="^sep($PIPEMENUS)" -[ $places_keyspipe == true ] && keyspipe=" $SHORTCUTS,^pipe(jgkeys-pipe -r)" && pipesep="^sep($PIPEMENUS)" -[ $places_menusettingspipe == true ] && menusettingspipe=" $MENUPANELS,^pipe(jgmenusettings-pipe -r)" && pipesep="^sep($PIPEMENUS)" -[ $places_sshpipe == true ] && sshpipe=" $SSH_CONN,^pipe(jgssh -r)" && pipesep="^sep($PIPEMENUS)" -mkconfigfile - - - -cat < ${MENU_ITEMS} -@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,,$(expr $jgtools_padding + 70),$(expr $jgtools_padding + 10),200,20,4,left,top,auto,#111111,$OSNAME $OSVERSION $OSCODE -@text,,$(expr $jgtools_padding + 70),$(expr $jgtools_padding + 30),200,20,4,left,top,auto,#444444,$USER@$HOSTNAME - -. $HOME/.config/mabox/places-prepend.csv +#QUICK NAV +[ -v places_quicknav ] && : || mb-setvar places_quicknav=true +if [ $places_quicknav == true ];then +cat < ${QNAV} ^sep($QUICK_NAV) $ROOTDIR,^pipe(jgbrowser /),folder ~ $HOME_DIR,^pipe(jgbrowser),folder-home @@ -572,22 +545,48 @@ cat < ${MENU_ITEMS} $(basename $(xdg-user-dir MUSIC)),^pipe(jgbrowser $(xdg-user-dir MUSIC)),folder-music $(basename $(xdg-user-dir PICTURES)),^pipe(jgbrowser $(xdg-user-dir PICTURES)),folder-pictures $(basename $(xdg-user-dir VIDEOS)),^pipe(jgbrowser $(xdg-user-dir VIDEOS)),folder-video +EOF +else +QNAV="" +fi + +# PIPEMENUS +[ $places_menusettingspipe == true ] && menusettingspipe=" $MENUPANELS,^pipe(jgmenusettings-pipe -r)" && pipesep="^sep($PIPEMENUS)" +[ $places_tint2pipe == true ] && tint2pipe=" $TINT2SETTINGS,^pipe(jgtint2-pipe -r)" && pipesep="^sep($PIPEMENUS)" +[ $places_sysinfopipe == true ] && sysinfopipe=" $SYSINFO,^pipe(jgsysinfo-pipe -r)" && pipesep="^sep($PIPEMENUS)" +[ $places_keyspipe == true ] && keyspipe=" $SHORTCUTS,^pipe(jgkeys-pipe -r)" && pipesep="^sep($PIPEMENUS)" +[ $places_sshpipe == true ] && sshpipe=" $SSH_CONN,^pipe(jgssh -r)" && pipesep="^sep($PIPEMENUS)" +[ $places_softwarepipe == true ] && softwarepipe=" $POPINSTALL,^pipe(jgsoftware-pipe -r)" && pipesep="^sep($PIPEMENUS)" + +# VBOXES +[ $places_vboxes == true ] && vboxes=". $HOME/.config/mabox/vboxes.csv" || vboxes="" + + +mkconfigfile + +cat < ${MENU_ITEMS} +@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,,$(expr $jgtools_padding + 70),$(expr $jgtools_padding + 10),200,20,4,left,top,auto,#111111,$OSNAME $OSVERSION $OSCODE +@text,,$(expr $jgtools_padding + 70),$(expr $jgtools_padding + 30),200,20,4,left,top,auto,#444444,$USER@$HOSTNAME + +. $HOME/.config/mabox/places-prepend.csv +. ${QNAV} + $(gtkbookmarks) $pipesep $menusettingspipe +$tint2pipe $sysinfopipe $keyspipe $sshpipe $softwarepipe -. $HOME/.config/mabox/vboxes.csv - - - +${vboxes} . $HOME/.config/mabox/places-append.csv - EOF + jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null }