mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Add -combi-display-format (#1570)
Implement a new option -combi-display-format (analogous to -drun-display-format) that allows to change position appearance of the mode name in the combi entries.
This commit is contained in:
parent
64062b2a94
commit
50b85ba954
6 changed files with 39 additions and 1 deletions
|
@ -133,6 +133,7 @@ Settings config = {
|
|||
.plugin_path = PLUGIN_PATH,
|
||||
.max_history_size = 25,
|
||||
.combi_hide_mode_prefix = FALSE,
|
||||
.combi_display_format = "{mode} {text}",
|
||||
|
||||
.matching_negate_char = '-',
|
||||
|
||||
|
|
|
@ -544,6 +544,20 @@ To get one merge view, of `window`,`run`, and `ssh`:
|
|||
**NOTE**: The i3 window manager dislikes commas in the command when specifying an exec command.
|
||||
For that case, `#` can be used as a separator.
|
||||
|
||||
`-combi-display-format`
|
||||
|
||||
The format string for entries in the `combi` dialog:
|
||||
|
||||
* **mode**: the mode display name
|
||||
* **text**: the entry text
|
||||
|
||||
Pango markup can be used to formatting the output.
|
||||
|
||||
Default: {mode} {text}
|
||||
|
||||
Note: This setting is ignored if `combi-hide-mode-prefix` is eanbled.
|
||||
|
||||
|
||||
### History and Sorting
|
||||
|
||||
`-disable-history`
|
||||
|
|
|
@ -120,6 +120,8 @@ rofi.scroll-method: 0
|
|||
! rofi.max-history-size: 25
|
||||
! "Hide the prefix mode prefix on the combi view." Set from: Default
|
||||
! rofi.combi-hide-mode-prefix: false
|
||||
! "Combi format string. (Supports: mode, text)" Set from: Default
|
||||
! rofi.combi-display-format: {mode} {text}
|
||||
! "Set the character used to negate the matching. ('\0' to disable)" Set from: Default
|
||||
! rofi.matching-negate-char: -
|
||||
! "Directory where history and temporary files are stored." Set from: Default
|
||||
|
|
|
@ -154,6 +154,8 @@ typedef struct {
|
|||
/** Maximum history length per mode. */
|
||||
unsigned int max_history_size;
|
||||
gboolean combi_hide_mode_prefix;
|
||||
/** Combi format display */
|
||||
char *combi_display_format;
|
||||
|
||||
char matching_negate_char;
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "mode-private.h"
|
||||
#include "widgets/textbox.h"
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <pango/pango.h>
|
||||
#include <theme.h>
|
||||
|
@ -225,8 +226,20 @@ static char *combi_mgrv(const Mode *sw, unsigned int selected_line, int *state,
|
|||
selected_line - pd->starts[i],
|
||||
state, attr_list, TRUE);
|
||||
const char *dname = mode_get_display_name(pd->switchers[i].mode);
|
||||
|
||||
if (!config.combi_hide_mode_prefix) {
|
||||
retv = g_strdup_printf("%s %s", dname, str);
|
||||
if (!(*state & MARKUP)) {
|
||||
char *tmp = str;
|
||||
str = g_markup_escape_text(tmp, -1);
|
||||
g_free(tmp);
|
||||
*state |= MARKUP;
|
||||
}
|
||||
|
||||
retv = helper_string_replace_if_exists(
|
||||
config.combi_display_format,
|
||||
"{mode}", dname,
|
||||
"{text}", str,
|
||||
NULL);
|
||||
g_free(str);
|
||||
|
||||
if (attr_list != NULL) {
|
||||
|
|
|
@ -356,6 +356,12 @@ static XrmOption xrmOptions[] = {
|
|||
NULL,
|
||||
"Hide the prefix mode prefix on the combi view.",
|
||||
CONFIG_DEFAULT},
|
||||
{xrm_String,
|
||||
"combi-display-format",
|
||||
{.str = &config.combi_display_format},
|
||||
NULL,
|
||||
"Combi format string. (Supports: mode, text)",
|
||||
CONFIG_DEFAULT},
|
||||
{xrm_Char,
|
||||
"matching-negate-char",
|
||||
{.charc = &config.matching_negate_char},
|
||||
|
|
Loading…
Reference in a new issue