1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Allow maximum history size to be configured.

Fixes: #613
This commit is contained in:
Dave Davenport 2017-10-03 19:59:35 +02:00
parent 7081b56aca
commit 2784959fc1
4 changed files with 7 additions and 3 deletions

View file

@ -141,4 +141,5 @@ Settings config = {
.color_urgent = NULL,
.color_window = NULL,
.plugin_path = PLUGIN_PATH,
.max_history_size = 25,
};

View file

@ -157,6 +157,9 @@ typedef struct
char *theme;
/** Path where plugins can be found. */
char * plugin_path;
/** Maximum history length per mode. */
unsigned int max_history_size;
} Settings;
/** Global Settings structure. */
extern Settings config;

View file

@ -38,8 +38,6 @@
#include "history.h"
#include "settings.h"
#define HISTORY_MAX_ENTRIES 25
/**
* History element
*/
@ -70,7 +68,7 @@ static void __history_write_element_list ( FILE *fd, _element **list, unsigned i
int min_value = list[length - 1]->index;
// Set the max length of the list.
length = ( length > HISTORY_MAX_ENTRIES ) ? HISTORY_MAX_ENTRIES : length;
length = ( length > config.max_history_size ) ? config.max_history_size: length;
// Write out entries.
for ( unsigned int iter = 0; iter < length; iter++ ) {

View file

@ -204,6 +204,8 @@ static XrmOption xrmOptions[] = {
"Color scheme window", CONFIG_DEFAULT },
{ xrm_String, "plugin-path", { .str = &config.plugin_path }, NULL,
"Directory containing plugins", 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 },
};
/** Dynamic array of extra options */