simplified mkconfiggile

master
Daniel Napora 2021-10-02 23:57:01 +02:00
parent c6f4402835
commit 970bd120bb
3 changed files with 48 additions and 68 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Daniel Napora 2020 <napcok@gmail.com>
. $HOME/.config/mabox/mabox.conf
# Daniel Napora 2020 - 2021 <napcok@gmail.com>
#. "$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##*/}\")")

View File

@ -4,38 +4,15 @@
# Copyright (C) 2019-2021 Daniel Napora <napcok@gmail.com>
. $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 '/<theme>/ {while (getline n) {if (match(n, /<name>/)){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 '/<theme>/ {while (getline n) {if (match(n, /<name>/)){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 <<EOF > ${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,<big>$OSNAME $OSVERSION</big> <sup><i>$OSCODE</i></sup>
@text,,$((jgtools_padding + 65)),$((jgtools_padding + 10)),200,20,4,left,top,auto,#111111,<big>$OSNAME $OSVERSION</big> <sup><i>$OSCODE</i></sup>
@text,,$((jgtools_padding + 65)),$((jgtools_padding + 30)),200,20,4,left,top,auto,#444444,<small>$USER@$HOSTNAME</small>
#@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,"""<big></big> <small><i>$TYPE_TO_SEARCH</i></small>"""
. $HOME/.config/mabox/right-prepend.csv
@ -680,14 +669,13 @@ fi
[[ $places_jglockscreen == true || -z ${places_jglockscreen} ]] && jglockscreen="<big></big> $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 <<EOF > ${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,<big>$OSNAME $OSVERSION</big> <sup><i>$OSCODE</i></sup>
@text,,$((jgtools_padding + 70)),$((jgtools_padding + 30)),200,20,4,left,top,auto,#444444,<small>$USER@$HOSTNAME</small>
@ -710,7 +698,7 @@ $softwarepipe
$tint2pipe
$conkypipe
${vboxes}
#${vboxes}
. $HOME/.config/mabox/places-append.csv
EOF

View File

@ -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 '/<theme>/ {while (getline n) {if (match(n, /<name>/)){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 '/<theme>/ {while (getline n) {if (match(n, /<name>/)){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