From 970bd120bb6bd291a1939ebc79a049ae57290335 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Sat, 2 Oct 2021 23:57:01 +0200 Subject: [PATCH] simplified mkconfiggile --- bin/jgbrowser | 9 ++--- bin/mb-jgtools | 58 ++++++++++++------------------ mb-jgtools/pipemenu-standalone.cfg | 49 +++++++++++-------------- 3 files changed, 48 insertions(+), 68 deletions(-) diff --git a/bin/jgbrowser b/bin/jgbrowser index 3e08742..986fd97 100755 --- a/bin/jgbrowser +++ b/bin/jgbrowser @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Daniel Napora 2020 -. $HOME/.config/mabox/mabox.conf +# Daniel Napora 2020 - 2021 +#. "$HOME"/.config/mabox/mabox.conf case $LANG in pl*) @@ -23,14 +23,15 @@ case $LANG in ;; esac -: ${JGMENU_RESOURCE_OPENER=xdg-open} +: "${JGMENU_RESOURCE_OPENER="xdg-open"}" + DIRECTORY=${1:-$HOME} # If '$DIRECTORY' is '/', unset it to avoid '//'. [[ $DIRECTORY == / ]] && DIRECTORY= -if [ $jgbrowser_show_hidden == false ];then +if [ "$jgbrowser_show_hidden" == false ];then for item in "$DIRECTORY"/*; do if [[ -d $item ]]; then dirs+=("${item##*/},^pipe(jgbrowser \"$DIRECTORY/${item##*/}\")") diff --git a/bin/mb-jgtools b/bin/mb-jgtools index 0a9d5a2..be2669e 100755 --- a/bin/mb-jgtools +++ b/bin/mb-jgtools @@ -4,38 +4,15 @@ # Copyright (C) 2019-2021 Daniel Napora . $HOME/.config/mabox/mabox.conf -unset font -unset menu_gradient_pos jgmenu_theme=${jgmenu_theme:-obtheme} -case $jgmenu_theme in - default) - #export color_norm_fg="#FFFFFF " - ;; - obtheme) - #export color_title_fg="#FFFFFF " - ob_file=$HOME/.config/openbox/rc.xml - [[ -f $ob_file ]] && wm_theme=$(awk '// {while (getline n) {if (match(n, //)){l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$ob_file") - if [ ! -f "$HOME/.config/mabox/jgobthemes/${wm_theme// /_}.colorrc" ]; then - obtheme2jgmenu - fi - while read -r a b c - do - [[ -n "$a" && "$a" != [[:blank:]#]* ]] && export "$a$b$c" - done < "$HOME/.config/mabox/jgobthemes/${wm_theme// /_}.colorrc" - ;; - *) - export color_title_fg="#FFFFFF " - while read -r a b c - do - [[ -n "$a" && "$a" != [[:blank:]#]* ]] && export "$a$b$c" - done < $HOME/.config/mabox/jgobthemes/$jgmenu_theme.colorrc - ;; -esac - menu_font_size=${menu_font_size:-9} menu_font_family=${menu_font_family:-Noto Sans Medium} jgmenu_font="${menu_font_family} ${menu_font_size}" + + + + [ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius [ -z $jgmenu_use_borders ] && menu_border=0 @@ -122,7 +99,7 @@ color_title_border = ${color_title_border:-#169f6f 100} color_title_bg = ${color_title_bg:-#169f6f 100} color_scroll_ind = ${color_scroll_ind:-#504e65 100} -sep_markup = weight="bold" foreground="${color_title_fg% *}" +sep_markup = weight="bold" sep_halign = ${sep_halign:-center} sep_height = ${sep_height:-5} font = ${jgmenu_font:-Noto Sans Medium 9} @@ -130,8 +107,22 @@ icon_size = ${jgmenu_icon_size:-18} icon_theme = ${jgmenu_icon_theme:-Numix-Square} EOF -unset font -unset menu_gradient_pos +case $jgmenu_theme in + default) + ;; + obtheme) + ob_file=$HOME/.config/openbox/rc.xml + [[ -f $ob_file ]] && wm_theme=$(awk '// {while (getline n) {if (match(n, //)){l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$ob_file") + if [ ! -f "$HOME/.config/mabox/jgobthemes/${wm_theme// /_}.colorrc" ]; then + obtheme2jgmenu + fi +cat "$HOME/.config/mabox/jgobthemes/${wm_theme// /_}.colorrc" >> $CONFIG_FILE + ;; + *) +cat "$HOME/.config/mabox/jgobthemes/${jgmenu_theme}.colorrc" >> $CONFIG_FILE + ;; +esac + } #MENU GŁÓWNE @@ -436,10 +427,8 @@ mkconfigfile cat < ${MENU_ITEMS} @icon,,$((jgtools_padding + 10)),$((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,,$((jgtools_padding + 65)),$((jgtools_padding + 10)),200,20,4,left,top,auto,#111111,$OSNAME $OSVERSION $OSCODE @text,,$((jgtools_padding + 65)),$((jgtools_padding + 30)),200,20,4,left,top,auto,#444444,$USER@$HOSTNAME -#@icon,,5,$(expr $MENU_HEIGHT_MIN - 180),240,180,4,center,top,,,$BOTTOM_IMG @search,,$((gtools_padding + 80)),$((jgtools_padding + 50)),292,20,4,left,top,auto,#262626,""" $TYPE_TO_SEARCH""" . $HOME/.config/mabox/right-prepend.csv @@ -680,14 +669,13 @@ fi [[ $places_jglockscreen == true || -z ${places_jglockscreen} ]] && jglockscreen=" $LOCKSCREEN,^pipe(jglockscreen -r)" && pipesep="^sep($PIPEMENUS)" # VBOXES -[[ $places_vboxes == true ]] && vboxes=". $HOME/.config/mabox/vboxes.csv" || vboxes="" +#[[ $places_vboxes == true ]] && vboxes=". $HOME/.config/mabox/vboxes.csv" || vboxes="" mkconfigfile cat < ${MENU_ITEMS} @icon,,$((jgtools_padding + 10)),$((jgtools_padding + 10)),48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png -#@icon,,10,$((MENU_HEIGHT_MIN - 160)),240,180,4,center,top,,,$BOTTOM_IMG @text,,$((jgtools_padding + 70)),$((jgtools_padding + 10)),200,20,4,left,top,auto,#111111,$OSNAME $OSVERSION $OSCODE @text,,$((jgtools_padding + 70)),$((jgtools_padding + 30)),200,20,4,left,top,auto,#444444,$USER@$HOSTNAME @@ -710,7 +698,7 @@ $softwarepipe $tint2pipe $conkypipe -${vboxes} +#${vboxes} . $HOME/.config/mabox/places-append.csv EOF diff --git a/mb-jgtools/pipemenu-standalone.cfg b/mb-jgtools/pipemenu-standalone.cfg index acd8694..d8c4a17 100644 --- a/mb-jgtools/pipemenu-standalone.cfg +++ b/mb-jgtools/pipemenu-standalone.cfg @@ -1,27 +1,6 @@ . $HOME/.config/mabox/mabox.conf jgmenu_theme=${jgmenu_theme:-obtheme} -case $jgmenu_theme in - default) - export color_norm_fg="#FFFFFF " - ;; - obtheme) - export color_title_fg="#FFFFFF " - ob_file=$HOME/.config/openbox/rc.xml - [[ -f $ob_file ]] && wm_theme=$(awk '// {while (getline n) {if (match(n, //)){l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$ob_file") - while read -r a b c - do - [[ -n "$a" && "$a" != [[:blank:]#]* ]] && export "$a$b$c" - done < $HOME/.config/mabox/jgobthemes/$wm_theme.colorrc - ;; - *) - export color_norm_fg="#FFFFFF " - while read -r a b c - do - [[ -n "$a" && "$a" != [[:blank:]#]* ]] && export "$a$b$c" - done < $HOME/.config/mabox/jgobthemes/$jgmenu_theme.colorrc - ;; -esac menu_font_size=${menu_font_size:-9} menu_font_family=${menu_font_family:-Noto Sans Medium} jgmenu_font="${menu_font_family} ${menu_font_size}" @@ -39,10 +18,9 @@ menu_border = ${jgtools_border:-0} # MENU MARGIN menu_margin_x = ${menu_margin_x:-0} -menu_margin_y = ${panels_topmargin:-0} +menu_margin_y = ${MENU_MARGIN_Y:-0} sub_spacing = ${submenu_spacing:-0} - menu_width = $JGWIDTH menu_height_min = ${MENU_HEIGHT_MIN:-0} menu_height_max = ${MENU_HEIGHT_MAX:-0} @@ -64,8 +42,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} @@ -83,16 +59,31 @@ 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_markup = weight="bold" +sep_halign = ${sep_halign:-center} sep_height = ${sep_height:-5} font = ${jgmenu_font:-Noto Sans Medium 9} -icon_size = ${jgmenu_icon_size:-16} +icon_size = ${jgmenu_icon_size:-18} icon_theme = ${jgmenu_icon_theme:-Numix-Square} EOF -unset font +case $jgmenu_theme in + default) + ;; + obtheme) + ob_file=$HOME/.config/openbox/rc.xml + [[ -f $ob_file ]] && wm_theme=$(awk '// {while (getline n) {if (match(n, //)){l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$ob_file") + if [ ! -f "$HOME/.config/mabox/jgobthemes/${wm_theme// /_}.colorrc" ]; then + obtheme2jgmenu + fi + cat "$HOME/.config/mabox/jgobthemes/${wm_theme// /_}.colorrc" >> $CONFIG_FILE + ;; + *) + cat "$HOME/.config/mabox/jgobthemes/${jgmenu_theme}.colorrc" >> $CONFIG_FILE + ;; +esac } + CONFIG_FILE=$(mktemp) MENU_ITEMS=$(mktemp) trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT