Menu/Sidepanels settings improvements

master
Daniel Napora 2021-01-12 01:28:26 +01:00
parent f0bdd9edc8
commit ac43f738b4
2 changed files with 114 additions and 82 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Daniel Napora 2020 <napcok@gmail.com>
. $HOME/.config/mabox/mabox.conf
# Read a directory to an array and sort it directories first.
case $LANG in
pl*)
DIRECTORIES="Katalogi"
@ -53,13 +53,14 @@ else
done
fi
printf "%b\n" "^sep(<small><i>${DIRECTORY:-/}</i></small>)"
printf "%b\n" " $OPENDIR,${JGMENU_RESOURCE_OPENER} \"${DIRECTORY:-/}\""
printf "%b\n" " $OPENTERM,exo-open --launch TerminalEmulator --working-directory=\"${DIRECTORY:-/}\""
printf "%b\n" " $OPENDIR,${JGMENU_RESOURCE_OPENER} \"${DIRECTORY:-/}\""
printf "%b\n" "<big></big> $OPENTERM,exo-open --launch TerminalEmulator --working-directory=\"${DIRECTORY:-/}\""
#printf "%b\n" " $OPENTERM,terminator --working-directory=\"${DIRECTORY:-/}\""
if [ ${#dirs[@]} -ne 0 ]; then
printf "%b\n" "^sep($DIRECTORIES)"
printf '%s\n' "${dirs[@]}"
printf "%b\n" "^sep($DIRECTORIES <small>(${#dirs[@]})</small>)"
printf "%s\n" "${dirs[@]}"
fi
if [ ${#files[@]} -ne 0 ]; then
printf "%b\n" "^sep($FILES)"
printf '%s\n' "${files[@]}"
printf "%b\n" "^sep($FILES <small>(${#files[@]})</small>)"
printf "%s\n" "${files[@]}"
fi

View File

@ -1,22 +1,18 @@
#!/bin/bash
#!/bin/bash -l
#
# mb-jgtools: Menu, Sidepanels, Screenshot Tool and Exit Dialog for Mabox
# Copyright (C) 2019-2020 Daniel Napora <napcok@gmail.com>
# Copyright (C) 2019-2021 Daniel Napora <napcok@gmail.com>
mb-setvar jgtools_last="\"$*\""
. $HOME/.config/mabox/mabox.conf
## TEMPORARY SETTINGS MENU FIX
if [ -z "$menu_font_family" ]; then
case $LANG in
pl*)
rsync -a /usr/share/mabox/lang/pl/.config/mabox/settings* $HOME/.config/mabox/
;;
es*)
rsync -a /usr/share/mabox/lang/es/.config/mabox/settings* $HOME/.config/mabox/
;;
*)
rsync -a /usr/share/mabox/lang/en/.config/mabox/settings* $HOME/.config/mabox/
;;
pl*) rsync -a /usr/share/mabox/lang/pl/.config/mabox/settings* $HOME/.config/mabox/ ;;
es*) rsync -a /usr/share/mabox/lang/es/.config/mabox/settings* $HOME/.config/mabox/ ;;
*) rsync -a /usr/share/mabox/lang/en/.config/mabox/settings* $HOME/.config/mabox/ ;;
esac
mb-setvar menu_font_family='Noto Sans Medium'
mb-setvar menu_font_size=9
@ -61,15 +57,9 @@ gtkbookmarks() {
BOOKMARKS="$HOME/.gtk-bookmarks"
if [[ -s "$BOOKMARKS" ]]; then
case $LANG in
pl*)
GTK_BOOKMARKS="Zakładki"
;;
es*)
GTK_BOOKMARKS="Marcadores"
;;
*)
GTK_BOOKMARKS="Bookmarks"
;;
pl*) GTK_BOOKMARKS="Zakładki";;
es*) GTK_BOOKMARKS="Marcadores" ;;
*) GTK_BOOKMARKS="Bookmarks" ;;
esac
while read -r line
do
@ -94,15 +84,20 @@ OSCODE=$(lsb_release -c | awk '{print $2}')
mkconfigfile() {
cat <<EOF > ${CONFIG_FILE}
position_mode = ${POSITION_MODE:-fixed}
csv_cmd = lx
csv_cmd = apps
stay_alive = 0
hide_back_items = ${HIDE_BACK_ITEMS:-0}
terminal_exec = terminator
terminal_args = -e
tabs = ${TABS:-220}
menu_border = ${menu_border:-0}
menu_margin_x = 0
menu_margin_y = 0
menu_border = ${jgtools_border:-0}
# MENU MARGIN
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}
@ -110,21 +105,26 @@ menu_padding_top = ${MENU_PADDING_TOP:-70}
menu_padding_right = ${MENU_PADDING_RIGHT:-2}
menu_padding_bottom = ${MENU_PADDING_BOTTOM:-10}
menu_padding_left = ${MENU_PADDING_LEFT:-2}
menu_radius = ${MENU_RADIUS:-0}
menu_radius = ${MENU_RADIUS:-4}
menu_valign = ${MENU_VALIGN:-top}
menu_halign = ${MENU_HALIGN:-left}
item_height = ${jgmenu_item_height:-20}
item_halign = ${ITEM_HALIGN:-left}
item_padding = 4
item_padding_x = 4
item_margin_x = ${item_margin_x:-0}
item_margin_y = ${item_margin_y:-3}
item_radius = ${item_radius:-2}
item_border = ${item_border:-0}
arrow_string = ${ARROW_STRING:-⮞}
columns = ${COLUMNS:-1}
columns = ${COLUMNS:-1}
menu_gradient_pos = ${menu_gradient_pos:- none}
color_menu_bg = ${color_menu_bg:-#222222 80}
color_menu_bg_to = ${color_menu_bg_to:- #000000 100}
color_menu_border = ${color_menu_border:-#2f9b85 100}
color_norm_bg = ${color_norm_bg:-#000000 0}
color_norm_fg = ${color_norm_fg:-#CCCCCC 100}
@ -181,9 +181,13 @@ BOTTOM_IMG=${right_bottom_img:-/usr/share/mb-jgtools/mabox_3D_gold.png}
MENU_HALIGN="right"
ITEM_HALIGN="left"
ARROW_STRING=" ⮜ "
JGWIDTH=250
JGWIDTH=40
TABS="100"
MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2)
#MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2)
##experyment
SCRHEIGHT=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2)
MENU_HEIGHT_MIN=$(expr $SCRHEIGHT - $panels_topmargin - $panels_topmargin)
MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN
case $LANG in
pl*)
@ -334,9 +338,9 @@ mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,15,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/distributor-logo-mabox.png
@text,,70,10,200,20,4,left,top,${color_title_fg% *},#111111,<big>$OSNAME $OSVERSION</big> <sup> <i>$OSCODE</i></sup>
@text,,70,30,200,20,4,left,top,#666666,#444444,<small>$USER@$HOSTNAME</small>
@icon,,5,$(expr $MENU_HEIGHT_MIN - 190),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>
@icon,,5,$(expr $MENU_HEIGHT_MIN - 180),240,180,4,center,top,,,$BOTTOM_IMG
@search,,100,50,292,20,4,left,top,auto,#262626,"""<big></big> <small><i>$TYPE_TO_SEARCH</i></small>"""
. $HOME/.config/mabox/right-prepend.csv
@ -408,11 +412,13 @@ $UGUIDE
⮜ $BACK,^back()
^tag(weblinks)
^sep($ONLINE_RES)
^sep()
^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
Manjaro Forum,exo-open --launch WebBrowser https://forum.manjaro.org,distributor-logo-manjaro
Branch Compare,exo-open --launch WebBrowser https://manjaro.org/branch-compare/,distributor-logo-manjaro
^sep(ArchLinux)
ArchWiki,exo-open --launch WebBrowser https://wiki.archlinux.org/,distributor-logo-archlinux
^sep(Openbox)
@ -476,45 +482,54 @@ case $LANG in
;;
esac
MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2)
JGWIDTH=250
#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_HEIGHT_MIN=$(expr $SCRHEIGHT - $panels_topmargin - $panels_topmargin)
MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN
JGWIDTH=40
jgmenu_icon_size=0
MENU_PADDING_TOP=55
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_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)"
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,10,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png
@icon,,10,$(expr $MENU_HEIGHT_MIN - 190),240,180,4,center,top,,,$BOTTOM_IMG
@text,,70,10,200,20,4,left,top,${color_title_fg% *},#111111,<big>$OSNAME $OSVERSION</big> <sup><i>$OSCODE</i></sup>
@text,,70,30,200,20,4,left,top,#666666,#444444,<small>$USER@$HOSTNAME</small>
@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>
. $HOME/.config/mabox/places-prepend.csv
^sep($QUICK_NAV)
<b>/</b> <i>($ROOTDIR)</i>,^pipe(jgbrowser /)
<b>~</b> <i>($HOME_DIR)</i>,^pipe(jgbrowser)
~/$(basename $(xdg-user-dir DOWNLOAD)),^pipe(jgbrowser $(xdg-user-dir DOWNLOAD))
~/$(basename $(xdg-user-dir DOCUMENTS)),^pipe(jgbrowser $(xdg-user-dir DOCUMENTS))
~/$(basename $(xdg-user-dir MUSIC)),^pipe(jgbrowser $(xdg-user-dir MUSIC))
~/$(basename $(xdg-user-dir PICTURES)),^pipe(jgbrowser $(xdg-user-dir PICTURES))
~/$(basename $(xdg-user-dir VIDEOS)),^pipe(jgbrowser $(xdg-user-dir VIDEOS))
<big>襁</big> $ROOTDIR,^pipe(jgbrowser /),folder
<big></big> $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
<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
$(gtkbookmarks)
. $HOME/.config/mabox/vboxes.csv
$pipesep
$softwarepipe
$sysinfopipe
$menusettingspipe
$keyspipe
$menusettingspipe
. $HOME/.config/mabox/places-append.csv
EOF
@ -535,15 +550,9 @@ MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS};#wmctrl -k off" EXIT
case $LANG in
pl*)
CANCEL="Anuluj"
;;
es*)
CANCEL="Cancelar"
;;
*)
CANCEL="Cancel"
;;
pl*) CANCEL="Anuluj";;
es*) CANCEL="Cancelar";;
*) CANCEL="Cancel";;
esac
JGWIDTH="348"
@ -561,8 +570,8 @@ THUMB="$(DISPLAY=:0 scrot -t 340x213 -o $HOME/.config/mabox/mblogout.png -e 'ech
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,#EEEEEE,#111111,$OSNAME $OSVERSION <sup> $OSCODE</sup>
@text,,180,190,200,20,4,left,top,#DDDDDD,#DDDDDD,<small>$USER@$HOSTNAME</small>
@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>
. $HOME/.config/mabox/exit.csv
^sep()
@ -685,6 +694,7 @@ MENU_PADDING_TOP=0
MENU_PADDING_RIGHT=0
MENU_PADDING_BOTTOM=0
MENU_PADDING_LEFT=0
#PERSISTENT=1
TABS="90"
[ $jgmenu_use_icons == false ] && jgmenu_icon_size=0
#jgmenu_icon_size=20
@ -692,7 +702,6 @@ TABS="90"
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
. ~/.config/mabox/settings.csv
. ~/.config/mabox/settings_tags.csv
@ -700,21 +709,43 @@ EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
update() {
reset() {
case $LANG in
pl*)
rsync -a /usr/share/mabox/lang/pl/.config/mabox/settings* $HOME/.config/mabox/
;;
#rsync -a /usr/share/mabox/lang/pl/.config/mabox/settings* $HOME/.config/mabox/
LNGDIR="pl";;
es*)
rsync -a /usr/share/mabox/lang/es/.config/mabox/settings* $HOME/.config/mabox/
;;
#rsync -a /usr/share/mabox/lang/es/.config/mabox/settings* $HOME/.config/mabox/
LNGDIR="es";;
*)
rsync -a /usr/share/mabox/lang/en/.config/mabox/settings* $HOME/.config/mabox/
;;
#rsync -a /usr/share/mabox/lang/en/.config/mabox/settings* $HOME/.config/mabox/
LNGDIR="en";;
esac
mb-setvar places_softwarepipe=true
mb-setvar places_sysinfopipe=true
mb-setvar places_menusettingspipe=true
#echo "$LNGDIR $1"
case $1 in
all*)
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/settings* $HOME/.config/mabox/
;;
main*)
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/jgmenu/*.csv $HOME/.config/jgmenu/
;;
left*)
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/places* $HOME/.config/mabox/
;;
right*)
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/right* $HOME/.config/mabox/
;;
logout*)
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/exit.csv $HOME/.config/mabox/
;;
*)
echo dupa
;;
esac
#mb-setvar places_softwarepipe=true
#mb-setvar places_sysinfopipe=true
#mb-setvar places_keyspipe=true
#mb-setvar places_menusettingspipe=true
}
#--------------------------------------------------------------------+
@ -752,7 +783,7 @@ case "$1" in
settings) settings "$2";;
screenshot) screenshot;;
places) places;;
update) update;;
reset) reset "$2";;
*)
echo -e "
${GRN}Kolekcja narzędzi dla Mabox-a stworzonych z pomocą Jgmenu
@ -768,7 +799,7 @@ ${YLW} >${RED} right ${YLW} -${DEF} right panel
${YLW} >${RED} places ${YLW} -${DEF} places - left sidepanel
${YLW} >${RED} mblogout ${YLW} -${DEF} run logout script
${YLW} >${RED} screenshot ${YLW} -${DEF} run screenshot script
${YLW} >${RED} update ${YLW} -${DEF} update settings
${YLW} >${RED} reset ${YLW} -${DEF} reset or update settings to (new) defaults
" >&2
exit 1
;;