Hello community, here is the log from the commit of package rofi-calc for openSUSE:Factory checked in at 2020-09-24 16:14:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rofi-calc (Old) and /work/SRC/openSUSE:Factory/.rofi-calc.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rofi-calc" Thu Sep 24 16:14:49 2020 rev:10 rq:836452 version:1.9 Changes: -------- --- /work/SRC/openSUSE:Factory/rofi-calc/rofi-calc.changes 2020-08-14 09:34:08.784423551 +0200 +++ /work/SRC/openSUSE:Factory/.rofi-calc.new.4249/rofi-calc.changes 2020-09-24 16:15:10.140954127 +0200 @@ -1,0 +2,6 @@ +Thu Sep 24 07:01:44 UTC 2020 - Michael Vetter <[email protected]> + +- Update to 1.9: + * Add options to specify output hints (#59) + +------------------------------------------------------------------- Old: ---- v1.8.tar.gz New: ---- v1.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rofi-calc.spec ++++++ --- /var/tmp/diff_new_pack.kSxWWm/_old 2020-09-24 16:15:12.164956151 +0200 +++ /var/tmp/diff_new_pack.kSxWWm/_new 2020-09-24 16:15:12.172956160 +0200 @@ -17,7 +17,7 @@ Name: rofi-calc -Version: 1.8 +Version: 1.9 Release: 0 Summary: Calculator for rofi License: MIT ++++++ v1.8.tar.gz -> v1.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rofi-calc-1.8/.gitignore new/rofi-calc-1.9/.gitignore --- old/rofi-calc-1.8/.gitignore 2020-08-13 05:38:06.000000000 +0200 +++ new/rofi-calc-1.9/.gitignore 2020-09-24 01:44:03.000000000 +0200 @@ -13,3 +13,5 @@ config.* build/ compile_commands.json +.vscode +*.code-workspace diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rofi-calc-1.8/CHANGELOG.md new/rofi-calc-1.9/CHANGELOG.md --- old/rofi-calc-1.8/CHANGELOG.md 2020-08-13 05:38:06.000000000 +0200 +++ new/rofi-calc-1.9/CHANGELOG.md 2020-09-24 01:44:03.000000000 +0200 @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] - ReleaseDate +- Add options to specify output hints [#59](https://github.com/svenstaro/rofi-calc/pull/59) (thanks @sa5gap) ## [1.8] - 2020-08-13 - Enable qalc's Unicode mode by default diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rofi-calc-1.8/README.md new/rofi-calc-1.9/README.md --- old/rofi-calc-1.8/README.md 2020-08-13 05:38:06.000000000 +0200 +++ new/rofi-calc-1.9/README.md 2020-09-24 01:44:03.000000000 +0200 @@ -65,43 +65,50 @@ - Use the `-no-unicode` option to disable `qalc`'s Unicode mode. - Use the `-calc-command` option to specify a shell command to execute which will be interpolated with the following keys: -* `{expression}`: the left-side of the equation (currently not available when using `-terse`) -* `{result}`: the right of the equation + * `{expression}`: the left-side of the equation (currently not available when using `-terse`) + * `{result}`: the right of the equation -The following example copies the result to the clipboard upon pressing the key combination defined by `-kb-accept-custom` -(by default Control+Return). -NOTE: `{result}` should be quoted since it may contain characters that your shell would otherwise interpret: + The following example copies the result to the clipboard upon pressing the key combination defined by `-kb-accept-custom` + (by default Control+Return). + NOTE: `{result}` should be quoted since it may contain characters that your shell would otherwise interpret: - rofi -show calc -modi calc -no-show-match -no-sort -calc-command "echo -n '{result}' | xclip" + rofi -show calc -modi calc -no-show-match -no-sort -calc-command "echo -n '{result}' | xclip" -It's convenient to bind it to a key combination in i3. For instance, you could use: +- It's convenient to bind it to a key combination in i3. For instance, you could use: - bindsym $mod+c exec --no-startup-id "rofi -show calc -modi calc -no-show-match -no-sort > /dev/null" + bindsym $mod+c exec --no-startup-id "rofi -show calc -modi calc -no-show-match -no-sort > /dev/null" -To disable the bold font applied to the results by default, you can use the flag `-no-bold` and run rofi like: +- To disable the bold font applied to the results by default, you can use the flag `-no-bold` and run rofi like: - rofi -show calc -modi calc -no-show-match -no-sort -no-bold + rofi -show calc -modi calc -no-show-match -no-sort -no-bold -To disable the history, use `-no-history`: +- To disable the history, use `-no-history`: - rofi -show calc -modi calc -no-show-match -no-sort -no-history + rofi -show calc -modi calc -no-show-match -no-sort -no-history -To enable thousand separators in the output (e.g. `5 * 12 = 6,000`, rather than `6000`) add the following to `~/.config/qalculate/qalc.cfg` +- To enable thousand separators in the output (e.g. `5 * 12 = 6,000`, rather than `6000`) add the following to `~/.config/qalculate/qalc.cfg` -> For `,` separator: + - For `,` separator: - digit_grouping=2 + digit_grouping=2 -> For space separator: + - For space separator: - digit_grouping=1 + digit_grouping=1 -To use a different output format for numeric representations (for instance, some locales use `,` instead of `.` as a decimal separator), -set `LC_NUMERIC` to a different value like this: +- To use a different output format for numeric representations (for instance, some locales use `,` instead of `.` as a decimal separator), + set `LC_NUMERIC` to a different value like this: - LC_NUMERIC=de_DE.UTF-8 rofi -show calc -modi calc -no-show-match -no-sort + LC_NUMERIC=de_DE.UTF-8 rofi -show calc -modi calc -no-show-match -no-sort + +- To set a different default locale, set your `LC_MONETARY` variable: -Make sure the locale is actually available on your system! + LC_MONETARY=de_DE.UTF-8 rofi -show calc -modi calc -no-show-match -no-sort + + Make sure the locale is actually available on your system! + +- Use the `-hint-result` option to specify the text of the hint before result. +- Use the `-hint-welcome` option to specify the welcome text. ## Development diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rofi-calc-1.8/src/calc.c new/rofi-calc-1.9/src/calc.c --- old/rofi-calc-1.8/src/calc.c 2020-08-13 05:38:06.000000000 +0200 +++ new/rofi-calc-1.9/src/calc.c 2020-09-24 01:44:03.000000000 +0200 @@ -42,7 +42,9 @@ typedef struct { char* cmd; - char* last_result; + char *hint_result; + char *hint_welcome; + char *last_result; GPtrArray* history; } CALCModePrivateData; @@ -67,6 +69,13 @@ // Terse option #define TERSE_OPTION "-terse" +// Option to specify result hint +#define HINT_RESULT "-hint-result" +#define HINT_RESULT_STR "Result: " + +// Option to specify welcome hint +#define HINT_WELCOME "-hint-welcome" +#define HINT_WELCOME_STR "Calculator" // The following keys can be specified in `CALC_COMMAND_FLAG` and // will be replaced with the left-hand side and right-hand side of @@ -232,6 +241,14 @@ pd->cmd = g_strdup(cmd); } + pd->hint_result = find_arg_str(HINT_RESULT, &cmd) + ? g_strdup(cmd) + : HINT_RESULT_STR; + + pd->hint_welcome = find_arg_str(HINT_WELCOME, &cmd) + ? g_strdup(cmd) + : HINT_WELCOME_STR; + if (find_arg(NO_HISTORY_OPTION) == -1) { // Load old history if it exists. GError *error = NULL; @@ -536,10 +553,15 @@ if (is_error_string(pd->last_result)) { return g_markup_printf_escaped("<span foreground='PaleVioletRed'>%s</span>", pd->last_result); } - if (find_arg(NO_BOLD_OPTION) == -1) - return g_markup_printf_escaped("Result: <b>%s</b>", pd->last_result); - else - return g_markup_printf_escaped("Result: %s", pd->last_result); + + if (*pd->last_result) { + if (find_arg(NO_BOLD_OPTION) == -1) + return g_markup_printf_escaped("%s<b>%s</b>", pd->hint_result, pd->last_result); + else + return g_markup_printf_escaped("%s%s", pd->hint_result, pd->last_result); + } else { + return g_markup_printf_escaped("%s", pd->hint_welcome); + } } Mode mode =
