summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/config.c3
-rw-r--r--include/rofi.h2
-rw-r--r--source/ssh-dialog.c26
3 files changed, 29 insertions, 2 deletions
diff --git a/config/config.c b/config/config.c
index 4950dba5..7b282256 100644
--- a/config/config.c
+++ b/config/config.c
@@ -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
};
diff --git a/include/rofi.h b/include/rofi.h
index 01e164a3..9b0c4b52 100644
--- a/include/rofi.h
+++ b/include/rofi.h
@@ -101,6 +101,8 @@ typedef struct _Settings
WindowLocation location;
WindowMode wmode;
unsigned int padding;
+
+ unsigned int show_title;
} Settings;
extern Settings config;
diff --git a/source/ssh-dialog.c b/source/ssh-dialog.c
index 0f405297..a18afc9c 100644
--- a/source/ssh-dialog.c
+++ b/source/ssh-dialog.c
@@ -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 )