summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQball Cow <qball@gmpclient.org>2015-09-29 17:27:47 +0200
committerQball Cow <qball@gmpclient.org>2015-09-29 17:28:21 +0200
commit9b67838b56019bf6c91a7e53995b3c69f40de874 (patch)
tree5728aa1ffd1ffac33346561a41e6a754d01c2319
parent29360b20aaa0ad5f0ffcbd251f143ed2d7d6b0af (diff)
Only cache successful run. (Thanks to Koppa nd daemoni)
-rw-r--r--AUTHORS2
-rw-r--r--include/textbox.h16
-rw-r--r--source/dialogs/run.c23
3 files changed, 23 insertions, 18 deletions
diff --git a/AUTHORS b/AUTHORS
index 4300f99f..24283a29 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -21,3 +21,5 @@ Tilman Blumenbach
qedi
seanpringle
vimeitor
+koppa
+daemoni
diff --git a/include/textbox.h b/include/textbox.h
index 7fb53305..2b2f2e57 100644
--- a/include/textbox.h
+++ b/include/textbox.h
@@ -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
diff --git a/source/dialogs/run.c b/source/dialogs/run.c
index 87e826f2..bfd2f323 100644
--- a/source/dialogs/run.c
+++ b/source/dialogs/run.c
@@ -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 )