Hello community, here is the log from the commit of package jgmenu for openSUSE:Factory checked in at 2019-03-13 16:41:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/jgmenu (Old) and /work/SRC/openSUSE:Factory/.jgmenu.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "jgmenu" Wed Mar 13 16:41:42 2019 rev:3 rq:684551 version:2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/jgmenu/jgmenu.changes 2019-02-25 17:59:01.698197761 +0100 +++ /work/SRC/openSUSE:Factory/.jgmenu.new.28833/jgmenu.changes 2019-03-13 16:41:45.174667628 +0100 @@ -1,0 +2,19 @@ +Wed Mar 13 07:44:45 UTC 2019 - [email protected] + +- Update to 2.2.: + * Fix --hide-on-startup bug + * Add 'obtheme' module which: + + Reads content of in openbox's rc.xml + + Finds and parses the associated openbox-3/themerc file + + Sets the corresponding jgmenurc key/value pairs + * Improvements to 'init' module: + * add --apply-obtheme (as a wrapper for the new obtheme module) + * use pmenu if ob does not exist for lab themes + * add "missing" option to interactive mode + * do not launch jgmenu on theme change + * only backup when needed + * Add config options color_title_{fg,bg,border} (where title refers + to a separator with text) + * tests/helper/Makefile: disable ASAN by default (issue #84) + +------------------------------------------------------------------- Old: ---- v2.1.tar.gz New: ---- v2.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ jgmenu.spec ++++++ --- /var/tmp/diff_new_pack.PAZh7B/_old 2019-03-13 16:41:45.698667241 +0100 +++ /var/tmp/diff_new_pack.PAZh7B/_new 2019-03-13 16:41:45.698667241 +0100 @@ -17,7 +17,7 @@ Name: jgmenu -Version: 2.1 +Version: 2.2 Release: 0 Summary: Small X11 menu intended to be used with openbox and tint2 License: GPL-2.0-only @@ -65,7 +65,7 @@ %files %license LICENSE -%doc README.md TODO +%doc README.md %{_bindir}/%{name}* %{_datadir}/applications/%{name}.desktop %{_datadir}/icons/hicolor/*/apps/%{name}.??g ++++++ v2.1.tar.gz -> v2.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/.gitignore new/jgmenu-2.2/.gitignore --- old/jgmenu-2.1/.gitignore 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/.gitignore 2019-03-12 23:30:10.000000000 +0100 @@ -6,6 +6,7 @@ jgmenu-socket jgmenu-i18n jgmenu-greeneye +jgmenu-obtheme README.html config.mk valgrind.log diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/INSTALL.md new/jgmenu-2.2/INSTALL.md --- old/jgmenu-2.1/INSTALL.md 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/INSTALL.md 2019-03-12 23:30:10.000000000 +0100 @@ -12,6 +12,7 @@ | [BunsenLabs](http://eu.pkg.bunsenlabs.org/debian/pool/main/j/jgmenu/) | apt-get install jgmenu |  | | [Mageia Cauldron](http://madb.mageia.org/package/show/application/0/release/cauldron/name/jgmenu) | urpmi jgmenu |  | | [Manjaro]() | pacman -S jgmenu |  | +| [OpenSUSE](https://build.opensuse.org/package/show/openSUSE:Factory/jgmenu) | |  | | [Slackware](https://slackbuilds.org/repository/14.2/desktop/jgmenu/) | slackpkg install jgmenu |  | | [Void](https://github.com/void-linux/void-packages/tree/master/srcpkgs/jgmenu) | xbps-install -S jgmenu |  | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/Makefile new/jgmenu-2.2/Makefile --- old/jgmenu-2.1/Makefile 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/Makefile 2019-03-12 23:30:10.000000000 +0100 @@ -34,11 +34,13 @@ jgmenu: CFLAGS += `pkg-config cairo pango pangocairo librsvg-2.0 --cflags` jgmenu-ob: CFLAGS += `xml2-config --cflags` jgmenu-lx: CFLAGS += `pkg-config --cflags glib-2.0 libmenu-cache` +jgmenu-obtheme: CFLAGS += `xml2-config --cflags` jgmenu: LIBS += `pkg-config x11 xrandr cairo pango pangocairo librsvg-2.0 --libs` jgmenu: LIBS += -pthread -lpng jgmenu-ob: LIBS += `xml2-config --libs` jgmenu-lx: LIBS += `pkg-config --libs glib-2.0 libmenu-cache` +jgmenu-obtheme: LIBS += `xml2-config --libs` LDFLAGS += $(LIBS) @@ -60,7 +62,8 @@ SCRIPTS_LIBEXEC = src/jgmenu-init.sh src/jgmenu-pmenu.py \ src/jgmenu-unity-hack.py src/jgmenu-config.py -PROGS_LIBEXEC = jgmenu-ob jgmenu-socket jgmenu-i18n jgmenu-greeneye +PROGS_LIBEXEC = jgmenu-ob jgmenu-socket jgmenu-i18n jgmenu-greeneye \ + jgmenu-obtheme # wrap in ifneq to ensure we respect user defined NO_LX=1 ifneq ($(NO_LX),1) @@ -87,6 +90,7 @@ endif jgmenu-i18n: jgmenu-i18n.o i18n.o hashmap.o util.o sbuf.o jgmenu-greeneye: jgmenu-greeneye.o compat.o util.o sbuf.o +jgmenu-obtheme: jgmenu-obtheme.o util.o sbuf.o compat.o $(PROGS): $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) @@ -110,9 +114,6 @@ @install -d $(DESTDIR)$(datarootdir)/applications/ @install -m644 ./data/jgmenu.svg $(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps/ @install -m644 ./data/jgmenu.desktop $(DESTDIR)$(datarootdir)/applications/ -ifeq ($(NO_LX),1) - @echo "info: lx module not included as libmenu-cache >=1.1.0 not found" -endif # We are not brave enough to uninstall in /usr/, /usr/local/ etc uninstall: @@ -162,6 +163,11 @@ @for l in $(REQUIRED_LIBS); do \ pkg-config $${l} || echo "fatal: require ($${l})"; \ done + @if ! pkg-config "libmenu-cache >= 1.1.0" "glib-2.0"; then \ + echo " - Cannot install lx module as build dependencies are missing"; \ + echo " libmenu-cache >= 1.1.0 and glib-2.0 are needed"; \ + echo " This will not prevent you from running jgmenu"; \ + fi @touch checkdeps print-%: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/NEWS.md new/jgmenu-2.2/NEWS.md --- old/jgmenu-2.1/NEWS.md 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/NEWS.md 2019-03-12 23:30:10.000000000 +0100 @@ -6,6 +6,7 @@ ## Recent releases +[v2.2](docs/relnotes/2.2.txt) [v2.1](docs/relnotes/2.1.txt) [v2.0](docs/relnotes/2.0.txt) [v1.6](docs/relnotes/1.6.txt) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/TODO new/jgmenu-2.2/TODO --- old/jgmenu-2.1/TODO 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/TODO 1970-01-01 01:00:00.000000000 +0100 @@ -1,19 +0,0 @@ -See https://github.com/johanmalm/jgmenu/wiki/Roadmap.md for further details - -Minor changes (0-3 months) --------------------------- - -init: - - don't restart jgmenu on setting theme - - add command to amend (and possibly --dry-run) - -greeneye: - - shorten searchbox so that the ...s do not clash with the icon - -ob: set ^tag() to command rather than name to reduce risk of duplication - -Trim argv-buf fields on parse - -pmenu: handle .desktop override $XDG_DATA_DIRS without showing duplicates - -jgmenu - warn if strange command line argument is given diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/TODO.md new/jgmenu-2.2/TODO.md --- old/jgmenu-2.1/TODO.md 1970-01-01 01:00:00.000000000 +0100 +++ new/jgmenu-2.2/TODO.md 2019-03-12 23:30:10.000000000 +0100 @@ -0,0 +1,20 @@ +See https://github.com/johanmalm/jgmenu/wiki/Roadmap.md for further details + +Minor changes (0-3 months) +-------------------------- + +- write a library (e.g. set.o) to set config variables in jgmenurc +- init: move greeneye icon lines to the C code +- tests/: xpm: put all tests within expect_success {} +- lx: write unit test for lx - check that <layout> works properly +- lx: cope with desktop-file without exec field +- greeneye: shorten searchbox so that the ...s do not clash with the icon +- Support moving between columns in multi-column mode +- Trim argv-buf fields on parse +- apps: keep track of filename +- jgmenu - warn if unknown command line argument is given +- init: remove all margin_* settings from themes +- ob: set ^tag() to command rather than name to reduce risk of duplication +- Clear any Codacy and ASAN warnings. +- Restructure variable diagram in jgmenu(1) +- Update 'implementation' file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/debian/changelog new/jgmenu-2.2/debian/changelog --- old/jgmenu-2.1/debian/changelog 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/debian/changelog 2019-03-12 23:30:10.000000000 +0100 @@ -1,5 +1,5 @@ -jgmenu (2.1-1) UNRELEASED; urgency=medium +jgmenu (2.2-1) UNRELEASED; urgency=medium * New upstream release - -- Johan Malm <[email protected]> Fri, 22 Feb 2019 21:02:08 +0000 + -- Johan Malm <[email protected]> Tue, 12 Mar 2019 22:28:02 +0000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/docs/manual/jgmenu.1 new/jgmenu-2.2/docs/manual/jgmenu.1 --- old/jgmenu-2.1/docs/manual/jgmenu.1 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/docs/manual/jgmenu.1 2019-03-12 23:30:10.000000000 +0100 @@ -1,6 +1,6 @@ .\" Automatically generated by Pandoc 2.6 .\" -.TH "JGMENU" "1" "19 Feb, 2019" "" "" +.TH "JGMENU" "1" "12 Mar, 2019" "" "" .hy .SH NAME .PP @@ -1047,7 +1047,27 @@ .PP color_sep_fg = \f[B]color\f[R] (default #ffffff 20) .PP -\ \ \ \ Colour of seperator +\ \ \ \ Colour of seperators without text +.PP +color_title_fg = \f[B]color\f[R] (default #eeeeee 50) +.PD 0 +.P +.PD +color_title_bg = \f[B]color\f[R] (default #000000 0) +.PD 0 +.P +.PD +color_title_border = \f[B]color\f[R] (default #000000 0) +.PP +\ \ \ \ Foreground (=font), background and border colours of separators +.PD 0 +.P +.PD +\ \ \ \ with text (also known as `title') +.PD 0 +.P +.PD +\ \ \ \ The font colour can be overriden by `sep_markup' .PP color_scroll_ind = \f[B]color\f[R] (default #eeeeee 40) .PP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/docs/manual/jgmenu.1.md new/jgmenu-2.2/docs/manual/jgmenu.1.md --- old/jgmenu-2.1/docs/manual/jgmenu.1.md 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/docs/manual/jgmenu.1.md 2019-03-12 23:30:10.000000000 +0100 @@ -1,6 +1,6 @@ % JGMENU(1) % Johan Malm -% 19 Feb, 2019 +% 12 Mar, 2019 # NAME @@ -503,7 +503,15 @@ color_sep_fg = __color__ (default #ffffff 20) - Colour of seperator + Colour of seperators without text + +color_title_fg = __color__ (default #eeeeee 50) +color_title_bg = __color__ (default #000000 0) +color_title_border = __color__ (default #000000 0) + + Foreground (=font), background and border colours of separators + with text (also known as 'title') + The font colour can be overriden by 'sep_markup' color_scroll_ind = __color__ (default #eeeeee 40) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/docs/relnotes/2.2.txt new/jgmenu-2.2/docs/relnotes/2.2.txt --- old/jgmenu-2.1/docs/relnotes/2.2.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/jgmenu-2.2/docs/relnotes/2.2.txt 2019-03-12 23:30:10.000000000 +0100 @@ -0,0 +1,28 @@ +jgmenu v2.2 release notes +========================= + +Updates since v2.1 +------------------ + + * Fix --hide-on-startup bug + + * Add 'obtheme' module which: + + - Reads content of <theme><name></name></theme> in openbox's rc.xml + - Finds and parses the associated openbox-3/themerc file + - Sets the corresponding jgmenurc key/value pairs + + Thanks to @hhhorb for suggesting this + + * Improvements to 'init' module: + + - add --apply-obtheme (as a wrapper for the new obtheme module) + - use pmenu if ob does not exist for lab themes + - add "missing" option to interactive mode + - do not launch jgmenu on theme change + - only backup when needed + + * Add config options color_title_{fg,bg,border} (where title refers + to a separator with text) + + * tests/helper/Makefile: disable ASAN by default (issue #84) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/examples/README new/jgmenu-2.2/examples/README --- old/jgmenu-2.1/examples/README 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/examples/README 2019-03-12 23:30:10.000000000 +0100 @@ -3,9 +3,6 @@ Most example scripts need to be run from the examples/ directory. -Categories ----------- - ex0* are for testing purposes. - They are intended to be used by invoking `make && make ex` from the top level directory whilst coding @@ -14,9 +11,6 @@ properties. - They may change over time depending on what the devs need. -ex1* are showcases for jgmenu with tint2 - - These will stop any running instances of tint2 and jgmenu - Specific files -------------- @@ -24,6 +18,3 @@ ex02 Tests separators, scroll, pgup/pgdown, etc. ex03 Tests long text, at-pointer ex04 Tests icon positioning and icon theme inheritance --- -ex10 Demo of all tint2rc config files in /usr/share/tint2 -ex11 Vanilla tint2rc with button - no jgmenurc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/scripts/version-gen.sh new/jgmenu-2.2/scripts/version-gen.sh --- old/jgmenu-2.1/scripts/version-gen.sh 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/scripts/version-gen.sh 2019-03-12 23:30:10.000000000 +0100 @@ -8,7 +8,7 @@ # Change "default_version" before doing a `git tag -a ...` # -default_version="2.1" +default_version="2.2" v=$(git describe --dirty --abbrev=1 2>/dev/null) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/src/config.c new/jgmenu-2.2/src/config.c --- old/jgmenu-2.1/src/config.c 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/src/config.c 2019-03-12 23:30:10.000000000 +0100 @@ -83,6 +83,9 @@ parse_hexstr("#eeeeee 100", config.color_sel_fg); parse_hexstr("#eeeeee 8", config.color_sel_border); parse_hexstr("#ffffff 20", config.color_sep_fg); + parse_hexstr("#eeeeee 50", config.color_title_fg); + parse_hexstr("#000000 0", config.color_title_bg); + parse_hexstr("#000000 0", config.color_title_border); parse_hexstr("#eeeeee 40", config.color_scroll_ind); config.csv_name_format = NULL; /* Leave as NULL (see in fmt.c) */ @@ -296,6 +299,12 @@ parse_hexstr(value, config.color_sel_border); } else if (!strcmp(option, "color_sep_fg")) { parse_hexstr(value, config.color_sep_fg); + } else if (!strcmp(option, "color_title_fg")) { + parse_hexstr(value, config.color_title_fg); + } else if (!strcmp(option, "color_title_bg")) { + parse_hexstr(value, config.color_title_bg); + } else if (!strcmp(option, "color_title_border")) { + parse_hexstr(value, config.color_title_border); } else if (!strcmp(option, "color_scroll_ind")) { parse_hexstr(value, config.color_scroll_ind); } else if (!strcmp(option, "csv_name_format")) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/src/config.h new/jgmenu-2.2/src/config.h --- old/jgmenu-2.1/src/config.h 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/src/config.h 2019-03-12 23:30:10.000000000 +0100 @@ -74,6 +74,9 @@ double color_sel_fg[4]; double color_sel_border[4]; double color_sep_fg[4]; + double color_title_fg[4]; + double color_title_bg[4]; + double color_title_border[4]; double color_scroll_ind[4]; char *csv_name_format; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/src/jgmenu-init.sh new/jgmenu-2.2/src/jgmenu-init.sh --- old/jgmenu-2.1/src/jgmenu-init.sh 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/src/jgmenu-init.sh 2019-03-12 23:30:10.000000000 +0100 @@ -218,6 +218,7 @@ } append_items () { + backup_config_files append__sep append__lock append__exit @@ -307,6 +308,7 @@ } prepend_items () { + backup_config_files prepend__add_terminal prepend__add_browser prepend__add_file_manager @@ -318,8 +320,6 @@ then say "info: creating config file 'jgmenurc'" jgmenu_run config create --file "${config_file}" - else - jgmenu_run config amend --file "${config_file}" --dryrun fi } @@ -410,6 +410,7 @@ print_available_themes | jgmenu --vsimple --center --no-spawn 2>/dev/null } +# not currently used restart_jgmenu () { say "Restarting jgmenu..." killall jgmenu >/dev/null 2>&1 @@ -485,8 +486,6 @@ } neon__setup_theme () { - rm -f ${prepend_file} - rm -f ${append_file} if ! test -d "/usr/share/icons/breeze" then warn "warn: icon theme 'breeze' is required to complete this theme" @@ -501,51 +500,51 @@ # not all systems support openbox menus if ! test -e ~/.config/openbox/menu.xml then - echo "set csv_cmd=pmenu" - #TODO: jgmenu_run config set csv_cmd pmenu + printf "\n%s\n" "csv_cmd = pmenu" >"${config_file}" fi } set_theme () { test $# -eq 0 && die "set_theme(): no theme specified" + backup_config_files rm -f "${prepend_file}" "${append_file}" case "$1" in archlabs_1803) jgmenurc_archlabs_1803 - restart_jgmenu ;; bunsenlabs_hydrogen) jgmenurc_bunsenlabs_hydrogen bunsenlabs__setup_theme - restart_jgmenu ;; bunsenlabs_helium) jgmenurc_bunsenlabs_helium bunsenlabs__setup_theme - restart_jgmenu ;; neon) jgmenurc_neon neon__setup_theme - restart_jgmenu ;; greeneye) create_icon_greeneye jgmenu_run greeneye --widgets >"${prepend_file}" jgmenu_run greeneye --config >"${config_file}" - restart_jgmenu ;; esac } +apply_obtheme () { + backup_config_files + jgmenu_run obtheme "${config_file}" >>"${config_file}" +} + check_nr_backups () { nr=$(ls -1 ~/.config/jgmenu/backup/ 2>/dev/null | wc -l) test "$nr" -gt 100 && warn "\ you have more than 100 backup files - consider removing a few" } -backup_jgmenurc () { +backup_config_files () { local files_to_backup="${HOME}/.config/jgmenu/jgmenurc \ ${HOME}/.config/jgmenu/prepend.csv \ ${HOME}/.config/jgmenu/append.csv" @@ -589,11 +588,14 @@ print_commands () { printf "%b" "\ *** commands ***\n\ -c, check = run a number of jgmenu related checks on system\n\ -t, theme = create config files based on templates\n\ -p, prepend = add items at top of root-menu (e.g. web browser and terminal)\n\ -a, append = add items at bottom of root-menu (e.g. lock and exit)\n\ -q, quit = quit init process\n" +a, append = add items at bottom of root-menu (e.g. lock and exit)\n\ +c, check = run a number of jgmenu related checks on system\n\ +h, help = show this message +m, missing = add any missing config options to config file\n\ +o, obtheme = apply openbox theme +p, prepend = add items at top of root-menu (e.g. web browser and terminal)\n\ +q, quit = quit init process\n\ +t, theme = create config files based on templates\n" } prompt () { @@ -602,23 +604,30 @@ printf "%b" "What now> " read -r cmd case "$cmd" in + append|a) + append_items + ;; check|c) analyse ;; - theme|t) - set_theme "$(get_theme)" + help|h) + print_commands + ;; + missing|m) + backup_config_files + jgmenu_run config amend --file "${config_file}" + ;; + obtheme|o) + apply_obtheme ;; prepend|p) prepend_items ;; - append|a) - append_items - ;; quit|q) return 1 ;; - help|h) - print_commands + theme|t) + set_theme "$(get_theme)" ;; clear) clear ;; @@ -648,6 +657,10 @@ config_file="${1#--config-file=}" ;; --theme=*) theme="${1#--theme=}" ;; + --apply-obtheme) + apply_obtheme + exit 0 + ;; --list-themes) print_available_themes exit 0 @@ -671,7 +684,6 @@ shift done -backup_jgmenurc test -z "${theme}" || { set_theme "$theme" ; exit 0 ; } initial_checks if test "${interactive}" = "t" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/src/jgmenu-obtheme.c new/jgmenu-2.2/src/jgmenu-obtheme.c --- old/jgmenu-2.1/src/jgmenu-obtheme.c 1970-01-01 01:00:00.000000000 +0100 +++ new/jgmenu-2.2/src/jgmenu-obtheme.c 2019-03-12 23:30:10.000000000 +0100 @@ -0,0 +1,179 @@ +/* + * jgmenu-obtheme.c + * + * Copyright (C) Johan Malm 2019 + * + * Parses openbox theme and outputs config file key/value pairs for colours + */ + +#include <stdio.h> +#include <string.h> +#include <libxml/parser.h> +#include <libxml/tree.h> +#include <sys/stat.h> + +#include "util.h" +#include "sbuf.h" +#include "compat.h" + +static char obtheme[80]; + +static char *rcxml_files[] = { + "~/.config/openbox/rc.xml", "/etc/xdg/openbox/rc.xml", NULL +}; + +static char *theme_paths[] = { + "~/.themes/", "/usr/share/themes/", NULL +}; + +static void process_line(char *line) +{ + /* menu colours */ + if (!strncmp(line, "menu.items.bg.color:", 20)) { + printf("color_menu_bg = %s 100\n", strstrip(line + 20)); + } else if (!strncmp(line, "menu.items.bg.border.color:", 34)) { + printf("color_sel_border = %s 100\n", strstrip(line + 34)); + printf("item_border = 1\n"); + } else if (!strncmp(line, "menu.items.text.color:", 22)) { + printf("color_norm_fg = %s 100\n", strstrip(line + 22)); + + /* borders */ + } else if (!strncmp(line, "menu.border.color:", 18)) { + printf("color_menu_border = %s 100\n", strstrip(line + 18)); + } else if (!strncmp(line, "menu.border.width:", 18)) { + printf("menu_border = %s\n", strstrip(line + 18)); + + /* selected item */ + } else if (!strncmp(line, "menu.items.active.bg.color:", 27)) { + printf("color_sel_bg = %s 100\n", strstrip(line + 27)); + } else if (!strncmp(line, "menu.items.active.text.color:", 29)) { + printf("color_sel_fg = %s 100\n", strstrip(line + 29)); + + /* separators */ + } else if (!strncmp(line, "menu.title.bg.color:", 20)) { + printf("color_title_bg = %s 100\n", strstrip(line + 20)); + } else if (!strncmp(line, "menu.title.bg.border.color:", 27)) { + printf("color_title_border = %s 100\n", strstrip(line + 27)); + } else if (!strncmp(line, "menu.title.text.color:", 22)) { + printf("color_title_fg = %s 100\n", strstrip(line + 22)); + printf("sep_markup =\n"); + } else if (!strncmp(line, "menu.title.text.justify:", 24)) { + printf("sep_halign = %s\n", strstrip(line + 24)); + } else if (!strncmp(line, "menu.separator.color:", 21)) { + printf("color_sep_fg = %s 100\n", strstrip(line + 21)); + + /* general */ + } else if (!strncmp(line, "*.text.justify:", 15)) { + printf("sep_halign = %s\n", strstrip(line + 15)); + } else if (!strncmp(line, "menu.overlap:", 13)) { + printf("sub_spacing = %d\n", -1 * atoi(line + 13)); + } +} + +static void process_themerc(const char *filename) +{ + FILE *fp; + char line[4096]; + char *p; + + fp = fopen(filename, "r"); + if (!fp) { + warn("could not open file %s", filename); + return; + } + while (fgets(line, sizeof(line), fp)) { + if (line[0] == '\0') + continue; + p = strrchr(line, '\n'); + if (!p) { + warn("line too long"); + continue; + } + *p = '\0'; + process_line((char *)strstrip(line)); + } + fclose(fp); +} + +static void xml_tree_walk(xmlNode *node) +{ + xmlNode *n; + static int insidetheme; + + for (n = node; n && n->name; n = n->next) { + if (!strcasecmp((char *)n->name, "theme")) { + insidetheme = 1; + xml_tree_walk(n->children); + return; + } + if (!strcasecmp((char *)n->name, "name")) { + if (!insidetheme) + continue; + strlcpy(obtheme, (const char *)xmlNodeGetContent(n), + sizeof(obtheme)); + return; + } + xml_tree_walk(n->children); + } +} + +static void get_obtheme_from_rcxml(const char *filename) +{ + xmlDoc *d; + + d = xmlReadFile(filename, NULL, 0); + if (!d) + die("error reading file '%s'\n", filename); + xml_tree_walk(xmlDocGetRootElement(d)); + xmlFreeDoc(d); + xmlCleanupParser(); +} + +static int find_themerc(struct sbuf *filename) +{ + struct stat sb; + int i; + + for (i = 0; theme_paths[i]; i++) { + sbuf_cpy(filename, theme_paths[i]); + sbuf_expand_tilde(filename); + sbuf_addstr(filename, obtheme); + sbuf_addstr(filename, "/openbox-3/themerc"); + if (!stat(filename->buf, &sb)) + return 0; + } + return -1; +} + +static int find_rcxml(struct sbuf *filename) +{ + struct stat sb; + int i; + + for (i = 0; rcxml_files[i]; i++) { + sbuf_cpy(filename, rcxml_files[i]); + sbuf_expand_tilde(filename); + if (!stat(filename->buf, &sb)) + return 0; + } + return -1; +} + +int main(int argc, char **argv) +{ + struct sbuf filename; + + sbuf_init(&filename); + LIBXML_TEST_VERSION + + if (find_rcxml(&filename) < 0) + die("cannot find rc.xml"); + get_obtheme_from_rcxml(filename.buf); + info("detected theme '%s' from file '%s'", obtheme, filename.buf); + if (find_themerc(&filename) < 0) + die("cannot find openbox theme file 'themerc'"); + info("found '%s'", filename.buf); + process_themerc(filename.buf); + xfree(filename.buf); + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/src/jgmenu.c new/jgmenu-2.2/src/jgmenu.c --- old/jgmenu-2.1/src/jgmenu.c 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/src/jgmenu.c 2019-03-12 23:30:10.000000000 +0100 @@ -465,8 +465,14 @@ text_x_coord += config.item_padding_x; else if (config.sep_halign == RIGHT) text_x_coord -= config.item_padding_x; + ui_draw_rectangle(p->area.x, p->area.y, p->area.w, + p->area.h, config.item_radius, 0.0, 1, + config.color_title_bg); + ui_draw_rectangle(p->area.x, p->area.y, p->area.w, + p->area.h, config.item_radius, 1.0, 0, + config.color_title_border); ui_insert_text(s.buf, text_x_coord, p->area.y, p->area.h, p->area.w, - config.color_sep_fg, config.sep_halign); + config.color_title_fg, config.sep_halign); xfree(s.buf); } @@ -2188,6 +2194,9 @@ if (sigaction(SIGUSR1, &sa, NULL) == -1) die("sigaction"); + if (config.hide_on_startup) + hide_menu(); + for (;;) { FD_ZERO(&readfds); FD_SET(x11_fd, &readfds); @@ -2593,12 +2602,10 @@ init_empty_item(); update_filtered_list(); init_menuitem_coordinates(); - if (config.hide_on_startup) { + if (config.hide_on_startup) info("menu started in 'hidden' mode; show by `jgmenu_run`"); - hide_menu(); - } else { + else XMapRaised(ui->dpy, ui->w[ui->cur].win); - } draw_menu(); atexit(cleanup); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jgmenu-2.1/tests/helper/Makefile new/jgmenu-2.2/tests/helper/Makefile --- old/jgmenu-2.1/tests/helper/Makefile 2019-02-22 22:03:16.000000000 +0100 +++ new/jgmenu-2.2/tests/helper/Makefile 2019-03-12 23:30:10.000000000 +0100 @@ -1,8 +1,10 @@ CC = @echo ' CC '$@;gcc CFLAGS = -g -Wall +ifdef ASAN ASAN_FLAGS = -O0 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic CFLAGS += $(ASAN_FLAGS) LDFLAGS += $(ASAN_FLAGS) -fuse-ld=gold +endif RM = rm -f src = ../../src/
