From 8e092038bd220fa2972a2edab7daf19137f181ee Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Tue, 15 Sep 2020 22:35:22 +0200 Subject: [PATCH] standalone pipemenus (start) --- usr/bin/jgmenusettings-pipe | 18 +++++++ usr/bin/pipemenu-standalone.cfg | 88 +++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 usr/bin/pipemenu-standalone.cfg diff --git a/usr/bin/jgmenusettings-pipe b/usr/bin/jgmenusettings-pipe index 359c12e..1b5bad5 100755 --- a/usr/bin/jgmenusettings-pipe +++ b/usr/bin/jgmenusettings-pipe @@ -163,7 +163,25 @@ for item in "$HOME"/.config/mabox/jgobthemes/*colorrc; do out2+=("${theme%.*},mb-setvar jgmenu_theme=${theme%.*};mb-jgtools settings") done +### RUN +if [ $1 == "-s" ]; then +. $HOME/bin/pipemenu-standalone.cfg + + +MENU_PADDING_TOP=0 +MENU_HALIGN="center" +MENU_VALIGN="center" +jgmenu_icon_size=0 +mkconfigfile + +cat < ${MENU_ITEMS} +$(printf '%s\n' "${out[@]}") +$(printf '%s\n' "${out2[@]}") +EOF +jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null +exit 0 +fi printf '%s\n' "${out[@]}" printf '%s\n' "${out2[@]}" diff --git a/usr/bin/pipemenu-standalone.cfg b/usr/bin/pipemenu-standalone.cfg new file mode 100644 index 0000000..3aa2746 --- /dev/null +++ b/usr/bin/pipemenu-standalone.cfg @@ -0,0 +1,88 @@ +. $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}" + +mkconfigfile() { +cat < ${CONFIG_FILE} +position_mode = ${POSITION_MODE:-fixed} +csv_cmd = lx +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_width = $JGWIDTH +menu_height_min = ${MENU_HEIGHT_MIN:-0} +menu_height_max = ${MENU_HEIGHT_MAX:-0} +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_valign = ${MENU_VALIGN:-top} +menu_halign = ${MENU_HALIGN:-left} + +item_height = ${jgmenu_item_height:-20} +item_halign = ${ITEM_HALIGN:-left} +item_padding = 4 +item_margin_y = ${item_margin_y:-3} +item_radius = ${item_radius:-2} +item_border = ${item_border:-0} +arrow_string = ${ARROW_STRING:-⮞} + +columns = ${COLUMNS:-1} + +color_menu_bg = ${color_menu_bg:-#222222 80} +color_menu_border = ${color_menu_border:-#2f9b85 100} +color_norm_bg = ${color_norm_bg:-#000000 0} +color_norm_fg = ${color_norm_fg:-#CCCCCC 100} +color_sel_bg = ${color_sel_bg:-#169f6f 60} +color_sel_fg = ${color_sel_fg:-#f8f8f8 100} +color_sel_border = ${color_sel_border:-#504e65 100} +color_sep_fg = ${color_sep_fg:-#4D4D4D 100} +color_sep_bg = ${color_sep_bg:-#262626 100} +color_title_fg = ${color_title_fg:-#4D4D4D 100} +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_height = ${sep_height:-5} +font = ${jgmenu_font:-Noto Sans Medium 9} +icon_size = ${jgmenu_icon_size:-16} +icon_theme = ${jgmenu_icon_theme:-Numix-Square} +EOF + +unset font +} +CONFIG_FILE=$(mktemp) +MENU_ITEMS=$(mktemp) +trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT