From eda0a9e0d0fe6674ed1a35de76bb84372dc9c578 Mon Sep 17 00:00:00 2001 From: QC Date: Mon, 20 Jan 2014 21:17:19 +0100 Subject: [PATCH] Add option to specify terminal to launch --- doc/simpleswitcher.1 | 9 +++++++++ source/simpleswitcher.c | 13 ++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/simpleswitcher.1 b/doc/simpleswitcher.1 index c7d3048d..c65a6ae1 100644 --- a/doc/simpleswitcher.1 +++ b/doc/simpleswitcher.1 @@ -23,6 +23,8 @@ simpleswitcher \- a simple EWMH window switcher .IR comdo ] .RB [ \-now ] .RB [ \-rnow ] +.RB [ \-term +.IR terminal ] .SH DESCRIPTION .I simpleswitcher @@ -136,6 +138,13 @@ Set the width of the menu as a percentage of the screen width (default: 60). .RS simpleswitcher -width 60 .RE +.TP +.B -term +Specify what terminal to start (default x-terminal-emulator) +.P +.RS +simpleswitcher -term xterm +.RE .SH Switch between modi Type '?' to switch between window list and run mode. .SH SEE ALSO diff --git a/source/simpleswitcher.c b/source/simpleswitcher.c index 7e161472..307a3ab5 100644 --- a/source/simpleswitcher.c +++ b/source/simpleswitcher.c @@ -71,10 +71,19 @@ #define OPACITY "_NET_WM_WINDOW_OPACITY" #define I3_SOCKET_PATH_PROP "I3_SOCKET_PATH" + + + +#define TERMINAL_DEFAULT "x-terminal-emulator" +char *config_terminal_emulator; + #ifdef TIMING #include #endif + + + static void* allocate( unsigned long bytes ) { void *ptr = malloc( bytes ); @@ -212,7 +221,7 @@ static inline int execsh( const char *cmd ,int run_in_term ) { // use sh for args parsing if ( run_in_term ) - return execlp( "x-terminal-emulator", "x-terminal-emulator", "-e", "sh", "-c", cmd, NULL ); + return execlp( config_terminal_emulator, config_terminal_emulator, "-e", "sh", "-c", cmd, NULL ); return execlp( "/bin/sh", "sh", "-c", cmd, NULL ); } @@ -1539,6 +1548,8 @@ int main( int argc, char *argv[] ) config_menu_bc = find_arg_str( ac, av, "-bc", MENUBC ); config_window_opacity = find_arg_int( ac, av, "-o", 100 ); + config_terminal_emulator = find_arg_str( ac, av, "-term", TERMINAL_DEFAULT); + config_zeltak_mode = ( find_arg( ac, av, "-zeltak" ) >= 0 ); #ifdef I3