Make ssh set title public.

This commit is contained in:
QC 2014-05-22 10:03:36 +02:00
parent 21a0666a6e
commit 5769bc36f1
9 changed files with 43 additions and 18 deletions

View File

@ -71,7 +71,7 @@ Settings config = {
.hmode = FALSE,
// Padding of the window.
.padding = 5,
.show_title = 1,
.ssh_set_title = TRUE,
.y_offset = 0,
.x_offset = 0,
.fixed_num_lines = FALSE

View File

@ -54,6 +54,9 @@ rofi \- a simple EWMH window switcher
.IR prompt
]
.RB [ \-dump ]
.RB [ \-ssh\-set\-title
true|false
]
.SH DESCRIPTION
.I rofi
@ -234,6 +237,12 @@ Run rofi in dmenu mode. Allowing it to be used for user interaction in scripts.
.TP
.B -dump
Dump the current active configuration to the command-line.
.RE
.TP
.B -ssh-set-title true|false
SSH dialogs tries to set 'ssh <hostname>' of the spawned terminal.
Not all terminals support this.
Default value is true.
.RS
.SH Switch between modi
Type '?'<enter> to switch between window list, run and ssh mode.

View File

@ -94,9 +94,8 @@ typedef struct _Settings
int y_offset;
int x_offset;
unsigned int show_title;
unsigned int ssh_set_title;
unsigned int fixed_num_lines;
} Settings;
extern Settings config;

View File

@ -1926,6 +1926,20 @@ static void parse_cmd_options ( int argc, char ** argv )
config.hmode = TRUE;
}
if ( find_arg ( argc, argv, "-ssh-set-title" ) >= 0 )
{
char *value;
find_arg_str ( argc, argv, "-ssh-set-title", &value );
if ( strcasecmp ( value, "true" ) == 0 )
{
config.ssh_set_title = TRUE;
}
else
{
config.ssh_set_title = FALSE;
}
}
// Keybindings
find_arg_str ( argc, argv, "-key", &( config.window_key ) );
find_arg_str ( argc, argv, "-rkey", &( config.run_key ) );
@ -2057,6 +2071,7 @@ void config_print ( void )
/* Terminal */
printf ( "Terminal emulator: %22s\n", config.terminal_emulator );
printf ( "SSH dialog set terminal title: %5s\n", config.ssh_set_title ? "true" : "false" );
/* Keybindings. */
printf ( "Window switcher key: %7s\n", config.window_key );
printf ( "Run dialog key: %7s\n", config.run_key );

View File

@ -56,7 +56,7 @@ static inline int execshssh ( const char *host )
char **args = malloc ( sizeof ( char* ) * 7 );
int i = 0;
args[i++] = config.terminal_emulator;
if ( config.show_title )
if ( config.ssh_set_title )
{
char *buffer = NULL;
if ( asprintf ( &buffer, "ssh %s", host ) > 0 )

View File

@ -96,6 +96,8 @@ static XrmOption xrmOptions[] = {
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL },
{ xrm_Boolean, "ssh-set-title", { .num = &config.ssh_set_title }, NULL },
/* Key bindings */
{ xrm_String, "key", { .str = &config.window_key }, NULL },
{ xrm_String, "rkey", { .str = &config.run_key }, NULL },