[Combi] Add hide prefix option.

This commit is contained in:
Dave Davenport 2017-11-07 20:03:42 +01:00
parent 23c04e34fe
commit 4ac428bace
5 changed files with 12 additions and 3 deletions

View File

@ -146,4 +146,5 @@ Settings config = {
.color_window = NULL,
.plugin_path = PLUGIN_PATH,
.max_history_size = 25,
.combi_hide_mode_prefix = FALSE,
};

View File

@ -112,6 +112,8 @@ rofi.scroll-method: 0
! rofi.color-window:
! "Max history size (WARNING: can cause slowdowns when set to high)." Set from: Default
! rofi.max-history-size: 25
! "Hide the prefix mode prefix on the combi view." Set from: Default
! rofi.combi-hide-mode-prefix: false
! "Pidfile location" Set from: File
rofi.pid: /tmp/rofi.pid
! "Paste primary selection" Set from: File

View File

@ -164,6 +164,7 @@ typedef struct
/** Maximum history length per mode. */
unsigned int max_history_size;
gboolean combi_hide_mode_prefix;
} Settings;
/** Global Settings structure. */
extern Settings config;

View File

@ -214,10 +214,13 @@ static char * combi_mgrv ( const Mode *sw, unsigned int selected_line, int *stat
}
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
if ( selected_line >= pd->starts[i] && selected_line < ( pd->starts[i] + pd->lengths[i] ) ) {
char * str = mode_get_display_value ( pd->switchers[i].mode, selected_line - pd->starts[i], state, attr_list, TRUE );
char * retv;
char * str = retv = mode_get_display_value ( pd->switchers[i].mode, selected_line - pd->starts[i], state, attr_list, TRUE );
const char *dname = mode_get_display_name ( pd->switchers[i].mode );
char * retv = g_strdup_printf ( "%s %s", dname, str );
g_free ( str );
if ( !config.combi_hide_mode_prefix ) {
retv = g_strdup_printf ( "%s %s", dname, str );
g_free ( str );
}
if ( attr_list != NULL ) {
ThemeWidget *wid = rofi_theme_find_widget ( sw->name, NULL, TRUE );

View File

@ -208,6 +208,8 @@ static XrmOption xrmOptions[] = {
"Color scheme window", CONFIG_DEFAULT },
{ xrm_Number, "max-history-size", { .num = &config.max_history_size }, NULL,
"Max history size (WARNING: can cause slowdowns when set to high).", CONFIG_DEFAULT },
{ xrm_Boolean, "combi-hide-mode-prefix", { .snum = &config.combi_hide_mode_prefix }, NULL,
"Hide the prefix mode prefix on the combi view.", CONFIG_DEFAULT },
};
/** Dynamic array of extra options */