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

@ -1,8 +1,8 @@
.TH ROFI 1 rofi
.TH ROFI 1 rofi
.SH NAME
rofi \- a simple EWMH window switcher
.SH SYNOPSIS
.B rofi
.B rofi
.RB [ \-width
.IR pct_scr ]
.RB [ \-lines
@ -45,15 +45,18 @@ rofi \- a simple EWMH window switcher
.RB [ \-help]
.RB [ \-display
.IR display ]
.RB [ \-bc
.RB [ \-bc
.IR color ]
.RB [ \-bw
.RB [ \-bw
.IR width ]
.RB [ \-dmenu
.RB [ \-dmenu
.RB [ \-p
.IR prompt
]
.RB [ \-dump ]
.RB [ \-ssh\-set\-title
true|false
]
.SH DESCRIPTION
.I rofi
@ -211,12 +214,12 @@ monitor:
.B -hmode
Switch to horizontal mode (ala dmenu). The number of elements is the number of
.IR lines
times the number of
times the number of
.IR columns
.
.TP
.B -fixed-num-lines
Keep a fixed number of visible lines (See the
Keep a fixed number of visible lines (See the
.IR -lines
option.)
.TP
@ -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

@ -39,7 +39,7 @@ void history_set ( const char *filename, const char *entry );
/**
* @param filename The filename of the history cache.
* @param entry The entry to remove
* @param entry The entry to remove
*
* Removes the entry from the history.
*/
@ -48,12 +48,12 @@ void history_remove ( const char *filename, const char *entry );
/**
* @param filename The filename of the history cache.
* @param length The length of the returned list.
* @param length The length of the returned list.
*
* Gets the entries in the list (in order of usage)
* @returns a list of entries length long. (and NULL terminated).
*/
char ** history_get_list ( const char *filename, unsigned int * length);
char ** history_get_list ( const char *filename, unsigned int * length );

View File

@ -10,11 +10,11 @@
#define INTERSECT( x, y, w, h, x1, y1, w1, h1 ) ( OVERLAP ( ( x ), ( w ), ( x1 ), ( w1 ) ) && OVERLAP ( ( y ), ( h ), ( y1 ), ( h1 ) ) )
#ifndef TRUE
#define TRUE 1
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#define FALSE 0
#endif
extern const char *cache_dir;
@ -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

@ -46,6 +46,6 @@ void textbox_draw ( textbox *tb );
int textbox_keypress ( textbox *tb, XEvent *ev );
void textbox_cursor_end ( textbox *tb );
void textbox_move (textbox *tb, int x, int y);
void textbox_move ( textbox *tb, int x, int y );
void textbox_hide ( textbox *tb );
#endif //__TEXTBOX_H__

View File

@ -2,5 +2,5 @@
#define __XRMOPTIONS_H__
void parse_xresource_options ( Display *display );
void parse_xresource_free( void );
void parse_xresource_free ( void );
#endif

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 },