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

Only cache successful run. (Thanks to Koppa nd daemoni)

This commit is contained in:
Qball Cow 2015-09-29 17:27:47 +02:00
parent 29360b20aa
commit 9b67838b56
3 changed files with 23 additions and 18 deletions

View file

@ -21,3 +21,5 @@ Tilman Blumenbach
qedi
seanpringle
vimeitor
koppa
daemoni

View file

@ -33,14 +33,14 @@ typedef struct
typedef enum
{
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
} TextboxFlags;
typedef enum

View file

@ -45,8 +45,9 @@
#define RUN_CACHE_FILE "rofi-2.runcache"
static inline void execsh ( const char *cmd, int run_in_term )
static inline int execsh ( const char *cmd, int run_in_term )
{
int retv = TRUE;
char **args = NULL;
int argc = 0;
if ( run_in_term ) {
@ -63,10 +64,12 @@ static inline void execsh ( const char *cmd, int run_in_term )
g_free ( msg );
// print error.
g_error_free ( error );
retv = FALSE;
}
// Free the args list.
g_strfreev ( args );
return retv;
}
// execute sub-process
@ -76,17 +79,17 @@ static void exec_cmd ( const char *cmd, int run_in_term )
return;
}
execsh ( cmd, run_in_term );
if ( execsh ( cmd, run_in_term ) ) {
/**
* This happens in non-critical time (After launching app)
* It is allowed to be a bit slower.
*/
char *path = g_strdup_printf ( "%s/%s", cache_dir, RUN_CACHE_FILE );
/**
* This happens in non-critical time (After launching app)
* It is allowed to be a bit slower.
*/
char *path = g_strdup_printf ( "%s/%s", cache_dir, RUN_CACHE_FILE );
history_set ( path, cmd );
history_set ( path, cmd );
g_free ( path );
g_free ( path );
}
}
// execute sub-process
static void delete_entry ( const char *cmd )