Add option to specify terminal to launch

This commit is contained in:
QC 2014-01-20 21:17:19 +01:00
parent 22399d0fae
commit eda0a9e0d0
2 changed files with 21 additions and 1 deletions

View File

@ -23,6 +23,8 @@ simpleswitcher \- a simple EWMH window switcher
.IR comdo ] .IR comdo ]
.RB [ \-now ] .RB [ \-now ]
.RB [ \-rnow ] .RB [ \-rnow ]
.RB [ \-term
.IR terminal ]
.SH DESCRIPTION .SH DESCRIPTION
.I simpleswitcher .I simpleswitcher
@ -136,6 +138,13 @@ Set the width of the menu as a percentage of the screen width (default: 60).
.RS .RS
simpleswitcher -width 60 simpleswitcher -width 60
.RE .RE
.TP
.B -term
Specify what terminal to start (default x-terminal-emulator)
.P
.RS
simpleswitcher -term xterm
.RE
.SH Switch between modi .SH Switch between modi
Type '?'<enter> to switch between window list and run mode. Type '?'<enter> to switch between window list and run mode.
.SH SEE ALSO .SH SEE ALSO

View File

@ -71,10 +71,19 @@
#define OPACITY "_NET_WM_WINDOW_OPACITY" #define OPACITY "_NET_WM_WINDOW_OPACITY"
#define I3_SOCKET_PATH_PROP "I3_SOCKET_PATH" #define I3_SOCKET_PATH_PROP "I3_SOCKET_PATH"
#define TERMINAL_DEFAULT "x-terminal-emulator"
char *config_terminal_emulator;
#ifdef TIMING #ifdef TIMING
#include <time.h> #include <time.h>
#endif #endif
static void* allocate( unsigned long bytes ) static void* allocate( unsigned long bytes )
{ {
void *ptr = malloc( 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 // use sh for args parsing
if ( run_in_term ) 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 ); 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_menu_bc = find_arg_str( ac, av, "-bc", MENUBC );
config_window_opacity = find_arg_int( ac, av, "-o", 100 ); 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 ); config_zeltak_mode = ( find_arg( ac, av, "-zeltak" ) >= 0 );
#ifdef I3 #ifdef I3