mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Only cache successful run. (Thanks to Koppa nd daemoni)
This commit is contained in:
parent
29360b20aa
commit
9b67838b56
3 changed files with 23 additions and 18 deletions
2
AUTHORS
2
AUTHORS
|
@ -21,3 +21,5 @@ Tilman Blumenbach
|
||||||
qedi
|
qedi
|
||||||
seanpringle
|
seanpringle
|
||||||
vimeitor
|
vimeitor
|
||||||
|
koppa
|
||||||
|
daemoni
|
||||||
|
|
|
@ -33,14 +33,14 @@ typedef struct
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TB_AUTOHEIGHT = 1 << 0,
|
TB_AUTOHEIGHT = 1 << 0,
|
||||||
TB_AUTOWIDTH = 1 << 1,
|
TB_AUTOWIDTH = 1 << 1,
|
||||||
TB_LEFT = 1 << 16,
|
TB_LEFT = 1 << 16,
|
||||||
TB_RIGHT = 1 << 17,
|
TB_RIGHT = 1 << 17,
|
||||||
TB_CENTER = 1 << 18,
|
TB_CENTER = 1 << 18,
|
||||||
TB_EDITABLE = 1 << 19,
|
TB_EDITABLE = 1 << 19,
|
||||||
TB_MARKUP = 1 << 20,
|
TB_MARKUP = 1 << 20,
|
||||||
TB_WRAP = 1 << 21,
|
TB_WRAP = 1 << 21,
|
||||||
} TextboxFlags;
|
} TextboxFlags;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
|
@ -45,8 +45,9 @@
|
||||||
|
|
||||||
#define RUN_CACHE_FILE "rofi-2.runcache"
|
#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;
|
char **args = NULL;
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
if ( run_in_term ) {
|
if ( run_in_term ) {
|
||||||
|
@ -63,10 +64,12 @@ static inline void execsh ( const char *cmd, int run_in_term )
|
||||||
g_free ( msg );
|
g_free ( msg );
|
||||||
// print error.
|
// print error.
|
||||||
g_error_free ( error );
|
g_error_free ( error );
|
||||||
|
retv = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free the args list.
|
// Free the args list.
|
||||||
g_strfreev ( args );
|
g_strfreev ( args );
|
||||||
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute sub-process
|
// execute sub-process
|
||||||
|
@ -76,17 +79,17 @@ static void exec_cmd ( const char *cmd, int run_in_term )
|
||||||
return;
|
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 );
|
||||||
|
|
||||||
/**
|
history_set ( path, cmd );
|
||||||
* 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 );
|
g_free ( path );
|
||||||
|
}
|
||||||
g_free ( path );
|
|
||||||
}
|
}
|
||||||
// execute sub-process
|
// execute sub-process
|
||||||
static void delete_entry ( const char *cmd )
|
static void delete_entry ( const char *cmd )
|
||||||
|
|
Loading…
Reference in a new issue