1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Allow window title to be set. issue #42

This commit is contained in:
Dave Davenport 2014-04-22 11:11:46 +02:00
parent d64345ccbe
commit 0d6556618e
3 changed files with 29 additions and 2 deletions

View file

@ -66,5 +66,6 @@ Settings config = {
// Mode of window, list (Vertical) or dmenu like (Horizontal)
.wmode = VERTICAL,
// Padding of the window.
.padding = 5
.padding = 5,
.show_title = 1
};

View file

@ -101,6 +101,8 @@ typedef struct _Settings
WindowLocation location;
WindowMode wmode;
unsigned int padding;
unsigned int show_title;
} Settings;
extern Settings config;

View file

@ -49,7 +49,31 @@
static inline int execshssh ( const char *host )
{
return execlp ( config.terminal_emulator, config.terminal_emulator, "-e", "ssh", host, NULL );
/**
* I am not happy about this code, it causes 7 mallocs and frees
*/
char **args = allocate(sizeof(char*)*7);
int i=0;
args[i++] = config.terminal_emulator;
if(config.show_title) {
ssize_t length = strlen(host)+5;
char buffer[length];
snprintf(buffer, length, "ssh %s", host);
args[i++] = strdup("-T");
args[i++] = strdup(buffer);
}
args[i++] = strdup("-e");
args[i++] = strdup("ssh");
args[i++] = strdup(host);
args[i++] = NULL;
int retv = execvp ( config.terminal_emulator, (char * const *)args );
// Free the args list.
for(int i =0; i < 7 && args[i] != NULL;i++) {
free(args[i]);
}
free(args);
return retv;
}
// execute sub-process
static pid_t exec_ssh ( const char *cmd )