1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-24 15:56:25 -05:00

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, .hmode = FALSE,
// Padding of the window. // Padding of the window.
.padding = 5, .padding = 5,
.show_title = 1, .ssh_set_title = TRUE,
.y_offset = 0, .y_offset = 0,
.x_offset = 0, .x_offset = 0,
.fixed_num_lines = FALSE .fixed_num_lines = FALSE

View file

@ -1,8 +1,8 @@
.TH ROFI 1 rofi .TH ROFI 1 rofi
.SH NAME .SH NAME
rofi \- a simple EWMH window switcher rofi \- a simple EWMH window switcher
.SH SYNOPSIS .SH SYNOPSIS
.B rofi .B rofi
.RB [ \-width .RB [ \-width
.IR pct_scr ] .IR pct_scr ]
.RB [ \-lines .RB [ \-lines
@ -45,15 +45,18 @@ rofi \- a simple EWMH window switcher
.RB [ \-help] .RB [ \-help]
.RB [ \-display .RB [ \-display
.IR display ] .IR display ]
.RB [ \-bc .RB [ \-bc
.IR color ] .IR color ]
.RB [ \-bw .RB [ \-bw
.IR width ] .IR width ]
.RB [ \-dmenu .RB [ \-dmenu
.RB [ \-p .RB [ \-p
.IR prompt .IR prompt
] ]
.RB [ \-dump ] .RB [ \-dump ]
.RB [ \-ssh\-set\-title
true|false
]
.SH DESCRIPTION .SH DESCRIPTION
.I rofi .I rofi
@ -211,12 +214,12 @@ monitor:
.B -hmode .B -hmode
Switch to horizontal mode (ala dmenu). The number of elements is the number of Switch to horizontal mode (ala dmenu). The number of elements is the number of
.IR lines .IR lines
times the number of times the number of
.IR columns .IR columns
. .
.TP .TP
.B -fixed-num-lines .B -fixed-num-lines
Keep a fixed number of visible lines (See the Keep a fixed number of visible lines (See the
.IR -lines .IR -lines
option.) option.)
.TP .TP
@ -234,6 +237,12 @@ Run rofi in dmenu mode. Allowing it to be used for user interaction in scripts.
.TP .TP
.B -dump .B -dump
Dump the current active configuration to the command-line. 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 .RS
.SH Switch between modi .SH Switch between modi
Type '?'<enter> to switch between window list, run and ssh mode. 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 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. * 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 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) * Gets the entries in the list (in order of usage)
* @returns a list of entries length long. (and NULL terminated). * @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 ) ) ) #define INTERSECT( x, y, w, h, x1, y1, w1, h1 ) ( OVERLAP ( ( x ), ( w ), ( x1 ), ( w1 ) ) && OVERLAP ( ( y ), ( h ), ( y1 ), ( h1 ) ) )
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
#endif #endif
#ifndef FALSE #ifndef FALSE
#define FALSE 0 #define FALSE 0
#endif #endif
extern const char *cache_dir; extern const char *cache_dir;
@ -94,9 +94,8 @@ typedef struct _Settings
int y_offset; int y_offset;
int x_offset; int x_offset;
unsigned int show_title; unsigned int ssh_set_title;
unsigned int fixed_num_lines; unsigned int fixed_num_lines;
} Settings; } Settings;
extern Settings config; extern Settings config;

View file

@ -46,6 +46,6 @@ void textbox_draw ( textbox *tb );
int textbox_keypress ( textbox *tb, XEvent *ev ); int textbox_keypress ( textbox *tb, XEvent *ev );
void textbox_cursor_end ( textbox *tb ); 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 ); void textbox_hide ( textbox *tb );
#endif //__TEXTBOX_H__ #endif //__TEXTBOX_H__

View file

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

View file

@ -1926,6 +1926,20 @@ static void parse_cmd_options ( int argc, char ** argv )
config.hmode = TRUE; 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 // Keybindings
find_arg_str ( argc, argv, "-key", &( config.window_key ) ); find_arg_str ( argc, argv, "-key", &( config.window_key ) );
find_arg_str ( argc, argv, "-rkey", &( config.run_key ) ); find_arg_str ( argc, argv, "-rkey", &( config.run_key ) );
@ -2057,6 +2071,7 @@ void config_print ( void )
/* Terminal */ /* Terminal */
printf ( "Terminal emulator: %22s\n", config.terminal_emulator ); printf ( "Terminal emulator: %22s\n", config.terminal_emulator );
printf ( "SSH dialog set terminal title: %5s\n", config.ssh_set_title ? "true" : "false" );
/* Keybindings. */ /* Keybindings. */
printf ( "Window switcher key: %7s\n", config.window_key ); printf ( "Window switcher key: %7s\n", config.window_key );
printf ( "Run dialog key: %7s\n", config.run_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 ); char **args = malloc ( sizeof ( char* ) * 7 );
int i = 0; int i = 0;
args[i++] = config.terminal_emulator; args[i++] = config.terminal_emulator;
if ( config.show_title ) if ( config.ssh_set_title )
{ {
char *buffer = NULL; char *buffer = NULL;
if ( asprintf ( &buffer, "ssh %s", host ) > 0 ) 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_String, "terminal", { .str = &config.terminal_emulator }, NULL },
{ xrm_Boolean, "ssh-set-title", { .num = &config.ssh_set_title }, NULL },
/* Key bindings */ /* Key bindings */
{ xrm_String, "key", { .str = &config.window_key }, NULL }, { xrm_String, "key", { .str = &config.window_key }, NULL },
{ xrm_String, "rkey", { .str = &config.run_key }, NULL }, { xrm_String, "rkey", { .str = &config.run_key }, NULL },