left panel modules can be disabled

master
Daniel Napora 2021-02-06 14:46:30 +01:00
parent 9d0248a466
commit 589f29c4c1
1 changed files with 63 additions and 64 deletions

View File

@ -2,28 +2,6 @@
# #
# mb-jgtools: Menu, Sidepanels, Screenshot Tool and Exit Dialog for Mabox # mb-jgtools: Menu, Sidepanels, Screenshot Tool and Exit Dialog for Mabox
# Copyright (C) 2019-2021 Daniel Napora <napcok@gmail.com> # 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 . $HOME/.config/mabox/mabox.conf
unset font unset font
@ -63,20 +41,24 @@ jgmenu_font="${menu_font_family} ${menu_font_size}"
gtkbookmarks() { gtkbookmarks() {
BOOKMARKS="$HOME/.gtk-bookmarks" if [ $places_bookmarks == true ]; then
if [[ -s "$BOOKMARKS" ]]; then BOOKMARKS="$HOME/.gtk-bookmarks"
case $LANG in if [[ -s "$BOOKMARKS" ]]; then
pl*) GTK_BOOKMARKS="Zakładki";; case $LANG in
es*) GTK_BOOKMARKS="Marcadores" ;; pl*) GTK_BOOKMARKS="Zakładki";;
*) GTK_BOOKMARKS="Bookmarks" ;; es*) GTK_BOOKMARKS="Marcadores" ;;
esac *) GTK_BOOKMARKS="Bookmarks" ;;
while read -r line esac
do while read -r line
uri=$(echo $line | cut -b 8- | cut -d' ' -f1 | sed 's/%20/ /g') do
dirs+=(" ${line#* },^pipe(jgbrowser \"${uri}\")") uri=$(echo $line | cut -b 8- | cut -d' ' -f1 | sed 's/%20/ /g')
done <"$BOOKMARKS" dirs+=(" ${line#* },^pipe(jgbrowser \"${uri}\")")
printf "%b\n" "^sep($GTK_BOOKMARKS)" done <"$BOOKMARKS"
printf '%s\n' "${dirs[@]}" printf "%b\n" "^sep($GTK_BOOKMARKS)"
printf '%s\n' "${dirs[@]}"
fi
else
printf ""
fi fi
} }
@ -449,8 +431,10 @@ $UGUIDE
^sep() ^sep()
⮜ $BACK,^back() ⮜ $BACK,^back()
^tag(weblinks) ^tag(weblinks)
^sep($ONLINE_RES) #^sep($ONLINE_RES)
^sep() ^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) ^sep(Manjaro)
Stable Updates,exo-open --launch WebBrowser https://forum.manjaro.org/c/announcements/stable-updates/,distributor-logo-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 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) CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(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 case $LANG in
pl*) pl*)
@ -505,6 +490,7 @@ case $LANG in
SYSINFO="Informacje o systemie" SYSINFO="Informacje o systemie"
SHORTCUTS="Skróty klawiszowe" SHORTCUTS="Skróty klawiszowe"
MENUPANELS="Ustawienia Menu/Paneli" MENUPANELS="Ustawienia Menu/Paneli"
TINT2SETTINGS="Ustawienia panelu Tint2"
SSH_CONN="Połącz po SSH" SSH_CONN="Połącz po SSH"
;; ;;
es*) es*)
@ -516,6 +502,7 @@ case $LANG in
SYSINFO="System information" SYSINFO="System information"
SHORTCUTS="Atajos del teclado" SHORTCUTS="Atajos del teclado"
MENUPANELS="Menu/Paneles laterales" MENUPANELS="Menu/Paneles laterales"
TINT2SETTINGS="Tint2 panel settings"
SSH_CONN="Conexiones SSH" SSH_CONN="Conexiones SSH"
;; ;;
*) *)
@ -527,13 +514,11 @@ case $LANG in
SYSINFO="System information" SYSINFO="System information"
SHORTCUTS="Keyboard shortcuts" SHORTCUTS="Keyboard shortcuts"
MENUPANELS="Menu/Sidepanels settings" MENUPANELS="Menu/Sidepanels settings"
TINT2SETTINGS="Tint2 panel settings"
SSH_CONN="SSH connections" SSH_CONN="SSH connections"
;; ;;
esac 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} panels_topmargin=${panels_topmargin:-0}
menu_margin_x=${submenu_spacing:-0} menu_margin_x=${submenu_spacing:-0}
@ -545,25 +530,13 @@ MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN
JGWIDTH=40 JGWIDTH=40
jgmenu_icon_size=0 jgmenu_icon_size=0
MENU_PADDING_TOP=$(expr $jgtools_padding + 60) 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 #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)"
[ $places_sysinfopipe == true ] && sysinfopipe="<big></big> $SYSINFO,^pipe(jgsysinfo-pipe -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_keyspipe == true ] && keyspipe="<big></big> $SHORTCUTS,^pipe(jgkeys-pipe -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_menusettingspipe == true ] && menusettingspipe="<big></big> $MENUPANELS,^pipe(jgmenusettings-pipe -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_sshpipe == true ] && sshpipe="<big></big> $SSH_CONN,^pipe(jgssh -r)" && pipesep="^sep($PIPEMENUS)"
mkconfigfile
cat <<EOF > ${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,<big>$OSNAME $OSVERSION</big> <sup><i>$OSCODE</i></sup>
@text,,$(expr $jgtools_padding + 70),$(expr $jgtools_padding + 30),200,20,4,left,top,auto,#444444,<small>$USER@$HOSTNAME</small>
. $HOME/.config/mabox/places-prepend.csv
#QUICK NAV
[ -v places_quicknav ] && : || mb-setvar places_quicknav=true
if [ $places_quicknav == true ];then
cat <<EOF > ${QNAV}
^sep($QUICK_NAV) ^sep($QUICK_NAV)
<tt><big>襁</big></tt> $ROOTDIR,^pipe(jgbrowser /),folder <tt><big>襁</big></tt> $ROOTDIR,^pipe(jgbrowser /),folder
<tt><big><b>~</b></big></tt> $HOME_DIR,^pipe(jgbrowser),folder-home <tt><big><b>~</b></big></tt> $HOME_DIR,^pipe(jgbrowser),folder-home
@ -572,22 +545,48 @@ cat <<EOF > ${MENU_ITEMS}
<big> </big> $(basename $(xdg-user-dir MUSIC)),^pipe(jgbrowser $(xdg-user-dir MUSIC)),folder-music <big> </big> $(basename $(xdg-user-dir MUSIC)),^pipe(jgbrowser $(xdg-user-dir MUSIC)),folder-music
<big> </big> $(basename $(xdg-user-dir PICTURES)),^pipe(jgbrowser $(xdg-user-dir PICTURES)),folder-pictures <big> </big> $(basename $(xdg-user-dir PICTURES)),^pipe(jgbrowser $(xdg-user-dir PICTURES)),folder-pictures
<big> </big> $(basename $(xdg-user-dir VIDEOS)),^pipe(jgbrowser $(xdg-user-dir VIDEOS)),folder-video <big> </big> $(basename $(xdg-user-dir VIDEOS)),^pipe(jgbrowser $(xdg-user-dir VIDEOS)),folder-video
EOF
else
QNAV=""
fi
# PIPEMENUS
[ $places_menusettingspipe == true ] && menusettingspipe="<big></big> $MENUPANELS,^pipe(jgmenusettings-pipe -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_tint2pipe == true ] && tint2pipe="<big>襁</big> $TINT2SETTINGS,^pipe(jgtint2-pipe -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_sysinfopipe == true ] && sysinfopipe="<big></big> $SYSINFO,^pipe(jgsysinfo-pipe -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_keyspipe == true ] && keyspipe="<big></big> $SHORTCUTS,^pipe(jgkeys-pipe -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_sshpipe == true ] && sshpipe="<big></big> $SSH_CONN,^pipe(jgssh -r)" && pipesep="^sep($PIPEMENUS)"
[ $places_softwarepipe == true ] && softwarepipe="<big></big> $POPINSTALL,^pipe(jgsoftware-pipe -r)" && pipesep="^sep($PIPEMENUS)"
# VBOXES
[ $places_vboxes == true ] && vboxes=". $HOME/.config/mabox/vboxes.csv" || vboxes=""
mkconfigfile
cat <<EOF > ${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,<big>$OSNAME $OSVERSION</big> <sup><i>$OSCODE</i></sup>
@text,,$(expr $jgtools_padding + 70),$(expr $jgtools_padding + 30),200,20,4,left,top,auto,#444444,<small>$USER@$HOSTNAME</small>
. $HOME/.config/mabox/places-prepend.csv
. ${QNAV}
$(gtkbookmarks) $(gtkbookmarks)
$pipesep $pipesep
$menusettingspipe $menusettingspipe
$tint2pipe
$sysinfopipe $sysinfopipe
$keyspipe $keyspipe
$sshpipe $sshpipe
$softwarepipe $softwarepipe
. $HOME/.config/mabox/vboxes.csv
${vboxes}
. $HOME/.config/mabox/places-append.csv . $HOME/.config/mabox/places-append.csv
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
} }