mirror of
https://github.com/davatorium/rofi.git
synced 2025-02-10 15:44:41 -05:00
Allow window title to be set. issue #42
This commit is contained in:
parent
d64345ccbe
commit
0d6556618e
3 changed files with 29 additions and 2 deletions
|
@ -66,5 +66,6 @@ Settings config = {
|
||||||
// Mode of window, list (Vertical) or dmenu like (Horizontal)
|
// Mode of window, list (Vertical) or dmenu like (Horizontal)
|
||||||
.wmode = VERTICAL,
|
.wmode = VERTICAL,
|
||||||
// Padding of the window.
|
// Padding of the window.
|
||||||
.padding = 5
|
.padding = 5,
|
||||||
|
.show_title = 1
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,6 +101,8 @@ typedef struct _Settings
|
||||||
WindowLocation location;
|
WindowLocation location;
|
||||||
WindowMode wmode;
|
WindowMode wmode;
|
||||||
unsigned int padding;
|
unsigned int padding;
|
||||||
|
|
||||||
|
unsigned int show_title;
|
||||||
} Settings;
|
} Settings;
|
||||||
|
|
||||||
extern Settings config;
|
extern Settings config;
|
||||||
|
|
|
@ -49,7 +49,31 @@
|
||||||
|
|
||||||
static inline int execshssh ( const char *host )
|
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
|
// execute sub-process
|
||||||
static pid_t exec_ssh ( const char *cmd )
|
static pid_t exec_ssh ( const char *cmd )
|
||||||
|
|
Loading…
Add table
Reference in a new issue