summaryrefslogtreecommitdiffstats
path: root/source/script-dialog.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2014-09-03 13:07:26 +0200
committerDave Davenport <qball@gmpclient.org>2014-09-03 13:07:26 +0200
commit0462811800e69933a069ac48e471bc6016aae08f (patch)
treec57272b3a755152ffc0df12c767cc38e3707c5b9 /source/script-dialog.c
parent5f33d506b9e7ef4c78d33d78044f092fb0dfb201 (diff)
Add flexible configuration for launching
* You can now specify links: {terminal} -e bash -e "{ssh-client} {host}" * Add test for this code.
Diffstat (limited to 'source/script-dialog.c')
-rw-r--r--source/script-dialog.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/source/script-dialog.c b/source/script-dialog.c
index 32172cdf..b4dca016 100644
--- a/source/script-dialog.c
+++ b/source/script-dialog.c
@@ -36,18 +36,17 @@
#include <assert.h>
#include "rofi.h"
#include "script-dialog.h"
+#include "helper.h"
pid_t execute_generator ( char * cmd )
{
- char **args = g_malloc_n ( 4, sizeof ( char* ) );
- args[0] = g_strdup ( "sh" );
- args[1] = g_strdup ( "-c" );
- args[2] = g_strdup ( cmd );
- args[3] = NULL;
+ char **args = NULL;
+ int argv = 0;
+ helper_parse_setup ( config.run_command, &args, &argv, "{cmd}", cmd, NULL );
- int fd = -1;
+ int fd = -1;
GError *error = NULL;
g_spawn_async_with_pipes ( NULL,
args,
@@ -59,14 +58,13 @@ pid_t execute_generator ( char * cmd )
NULL, &fd, NULL,
&error );
- if( error != NULL )
- {
- char *msg = g_strdup_printf("Failed to execute: '%s'\nError: '%s'", cmd,
- error->message);
- error_dialog(msg);
- g_free(msg);
+ if ( error != NULL ) {
+ char *msg = g_strdup_printf ( "Failed to execute: '%s'\nError: '%s'", cmd,
+ error->message );
+ error_dialog ( msg );
+ g_free ( msg );
// print error.
- g_error_free(error);
+ g_error_free ( error );
}
g_strfreev ( args );
return fd;