1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Add history ignore (#846)

This commit is contained in:
Yoav 2018-12-31 01:35:00 +02:00 committed by Quentin Glidic
parent aacb570850
commit 238648b5b2
5 changed files with 21 additions and 0 deletions

View file

@ -91,6 +91,8 @@ Settings config = {
.fixed_num_lines = TRUE,
/** Do not use history */
.disable_history = FALSE,
/** Programs ignored for history */
.ignored_prefixes = "",
/** Sort the displayed list */
.sort = FALSE,
/** Use levenshtein sorting when matching */

View file

@ -36,6 +36,7 @@
*
* This uses the following options from the #config object:
* * #Settings::disable_history
* * #Settings::ignored_prefixes
*
* @{
*/

View file

@ -108,6 +108,8 @@ typedef struct
unsigned int fixed_num_lines;
/** Do not use history */
unsigned int disable_history;
/** Programs ignored for history */
char * ignored_prefixes;
/** Toggle to enable sorting. */
unsigned int sort;
/** Sorting method. */

View file

@ -180,6 +180,20 @@ void history_set ( const char *filename, const char *entry )
if ( config.disable_history ) {
return;
}
// Check if program should be ignored
for ( char *checked_prefix = strtok ( config.ignored_prefixes, ";" ); checked_prefix != NULL; checked_prefix = strtok ( NULL, ";" ) ) {
// For each ignored prefix
while ( g_unichar_isspace ( g_utf8_get_char ( checked_prefix ) ) ) {
checked_prefix = g_utf8_next_char ( checked_prefix ); // Some users will probably want "; " as their separator for aesthetics.
}
if ( g_str_has_prefix ( entry, checked_prefix ) ) {
return;
}
}
int found = 0;
unsigned int curr = 0;
unsigned int length = 0;

View file

@ -141,6 +141,8 @@ static XrmOption xrmOptions[] = {
"DRUN format string. (Supports: generic,name,comment,exec,categories)", CONFIG_DEFAULT },
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
"Disable history in run/ssh", CONFIG_DEFAULT },
{ xrm_String, "ignored-prefixes", { .str = &config.ignored_prefixes }, NULL,
"Programs ignored for history", CONFIG_DEFAULT },
{ xrm_Boolean, "sort", { .num = &config.sort }, NULL,
"Use sorting", CONFIG_DEFAULT },
{ xrm_String, "sorting-method", { .str = &config.sorting_method }, NULL,