1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Commandline options and Xresources now match in nameing.

This commit is contained in:
QC 2014-05-22 09:18:16 +02:00
parent beced5d36e
commit a26cf2637d
3 changed files with 64 additions and 36 deletions

View file

@ -28,14 +28,19 @@ rofi \- a simple EWMH window switcher
.RB [ \-now ]
.RB [ \-rnow ]
.RB [ \-snow ]
.RB [ \-term
.IR terminal ]
.RB [ \-terminal
.IR terminal
]
.RB [ \-loc
.IR position ]
.RB [ \-hmode ]
.RB [ \-fixed\-num\-lines ]
.RB [ \-padding
.IR padding ]
.IR padding
]
.RB [ \-opacity
.IR opacity %
]
.RB [ \-version ]
.RB [ \-help]
.RB [ \-display
@ -46,7 +51,8 @@ rofi \- a simple EWMH window switcher
.IR width ]
.RB [ \-dmenu
.RB [ \-p
.IR prompt ]]
.IR prompt
]
.RB [ \-dump ]
.SH DESCRIPTION
@ -155,11 +161,11 @@ Set the foreground text color (X11 named color or hex #rrggbb) for the highlight
rofi -fg "#ffffff"
.RE
.TP
.B -o
.B -opacity
Set the window opacity (0-100).
.P
.RS
rofi -o "75"
rofi -opacity "75"
.RE
.TP
.B -lines
@ -183,11 +189,11 @@ Set the width of the menu as a percentage of the screen width (default: 60).
rofi -width 60
.RE
.TP
.B -term
.B -terminal
Specify what terminal to start (default x-terminal-emulator)
.P
.RS
rofi -term xterm
rofi -terminal xterm
.RE
.TP
.B -loc

View file

@ -80,9 +80,9 @@
#ifdef HAVE_I3_IPC_H
#define I3_SOCKET_PATH_PROP "I3_SOCKET_PATH"
// This setting is no longer user configurable, but partial to this file:
int config_i3_mode = 0;
int config_i3_mode = 0;
// Path to HAVE_I3_IPC_H socket.
char *i3_socket_path = NULL;
char *i3_socket_path = NULL;
#endif
@ -1067,17 +1067,17 @@ MenuReturn menu ( char **lines, char **input, char *prompt, Time *time, int *shi
// search text input
textbox *prompt_tb = textbox_create ( box, TB_AUTOHEIGHT | TB_AUTOWIDTH,
( config.padding ),
( config.padding ),
0,0,
config.menu_font, config.menu_fg, config.menu_bg,
prompt);
( config.padding ),
( config.padding ),
0, 0,
config.menu_font, config.menu_fg, config.menu_bg,
prompt );
textbox *text = textbox_create ( box, TB_AUTOHEIGHT | TB_EDITABLE,
( config.padding )+prompt_tb->w,
( config.padding ) + prompt_tb->w,
( config.padding ),
((config.hmode == TRUE)?
element_width:(w - (2 * ( config.padding ) ) ))-prompt_tb->w, 1,
( ( config.hmode == TRUE ) ?
element_width : ( w - ( 2 * ( config.padding ) ) ) ) - prompt_tb->w, 1,
config.menu_font, config.menu_fg, config.menu_bg,
( input != NULL ) ? *input : "" );
@ -1096,10 +1096,10 @@ MenuReturn menu ( char **lines, char **input, char *prompt, Time *time, int *shi
int col = ( i ) / max_rows + ( ( config.hmode == FALSE ) ? 0 : 1 );
boxes[i] = textbox_create ( box,
0,
( config.padding ) + col * ( element_width + LINE_MARGIN ), // X
( config.padding ) + col * ( element_width + LINE_MARGIN ), // X
line * line_height + config.padding + ( ( config.hmode == TRUE ) ? 0 : LINE_MARGIN ), // y
element_width, // w
line_height, // h
element_width, // w
line_height, // h
config.menu_font, config.menu_fg, config.menu_bg, "" );
textbox_show ( boxes[i] );
}
@ -1239,7 +1239,7 @@ MenuReturn menu ( char **lines, char **input, char *prompt, Time *time, int *shi
}
textbox_draw ( text );
textbox_draw( prompt_tb );
textbox_draw ( prompt_tb );
menu_draw ( boxes, max_elements, num_lines, &last_offset, selected, filtered );
menu_set_arrow_text ( filtered_lines, selected,
max_elements, arrowbox_top,
@ -1483,7 +1483,7 @@ MenuReturn menu ( char **lines, char **input, char *prompt, Time *time, int *shi
max_elements, arrowbox_top,
arrowbox_bottom );
textbox_draw ( text );
textbox_draw( prompt_tb );
textbox_draw ( prompt_tb );
menu_draw ( boxes, max_elements, num_lines, &last_offset, selected, filtered );
menu_set_arrow_text ( filtered_lines, selected,
max_elements, arrowbox_top,
@ -1890,17 +1890,24 @@ static void parse_cmd_options ( int argc, char ** argv )
|| find_arg ( argc, argv, "-h" ) >= 0 )
{
help ();
exit( EXIT_SUCCESS );
exit ( EXIT_SUCCESS );
}
if ( find_arg ( argc, argv, "-v" ) >= 0 ||
find_arg ( argc, argv, "-version" ) >= 0 )
{
fprintf ( stdout, "Version: "VERSION "\n" );
exit( EXIT_SUCCESS );
exit ( EXIT_SUCCESS );
}
// Parse commandline arguments about the looks.
find_arg_int ( argc, argv, "-opacity", &( config.window_opacity ) );
find_arg_int ( argc, argv, "-width", &( config.menu_width ) );
find_arg_int ( argc, argv, "-lines", &( config.menu_lines ) );
find_arg_int ( argc, argv, "-columns", &( config.menu_columns ) );
find_arg_str ( argc, argv, "-font", &( config.menu_font ) );
find_arg_str ( argc, argv, "-fg", &( config.menu_fg ) );
find_arg_str ( argc, argv, "-bg", &( config.menu_bg ) );
@ -1908,12 +1915,8 @@ static void parse_cmd_options ( int argc, char ** argv )
find_arg_str ( argc, argv, "-hlbg", &( config.menu_hlbg ) );
find_arg_str ( argc, argv, "-bc", &( config.menu_bc ) );
find_arg_int ( argc, argv, "-bw", &( config.menu_bw ) );
find_arg_int ( argc, argv, "-o", &( config.window_opacity ) );
// Parse commandline arguments about size and position
find_arg_int ( argc, argv, "-width", &( config.menu_width ) );
find_arg_int ( argc, argv, "-lines", &( config.menu_lines ) );
find_arg_int ( argc, argv, "-columns", &( config.menu_columns ) );
find_arg_int ( argc, argv, "-loc", &( config.location ) );
find_arg_int ( argc, argv, "-padding", &( config.padding ) );
find_arg_int ( argc, argv, "-xoffset", &( config.x_offset ) );
@ -1924,7 +1927,7 @@ static void parse_cmd_options ( int argc, char ** argv )
}
// Parse commandline arguments about behavior
find_arg_str ( argc, argv, "-term", &( config.terminal_emulator ) );
find_arg_str ( argc, argv, "-terminal", &( config.terminal_emulator ) );
if ( find_arg ( argc, argv, "-zeltak" ) >= 0 )
{
config.zeltak_mode = 1;
@ -1944,8 +1947,8 @@ static void parse_cmd_options ( int argc, char ** argv )
// Dump.
if ( find_arg ( argc, argv, "-dump" ) >= 0 )
{
config_print();
exit(EXIT_SUCCESS);
config_print ();
exit ( EXIT_SUCCESS );
}
// Sanity check

View file

@ -59,23 +59,43 @@ typedef struct
*/
static XrmOption xrmOptions[] = {
{ xrm_Number, "opacity", { .num = &config.window_opacity }, NULL },
{ xrm_Number, "width", { .num = &config.menu_width }, NULL },
{ xrm_Number, "lines", { .num = &config.menu_lines }, NULL },
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL },
{ xrm_String, "font", { .str = &config.menu_font }, NULL },
/* Foreground color */
{ xrm_String, "foreground", { .str = &config.menu_fg }, NULL },
{ xrm_String, "fg", { .str = &config.menu_fg }, NULL },
{ xrm_String, "background", { .str = &config.menu_bg }, NULL },
{ xrm_String, "bg", { .str = &config.menu_bg }, NULL },
{ xrm_String, "highlightfg", { .str = &config.menu_hlfg }, NULL },
{ xrm_String, "hlbg", { .str = &config.menu_hlfg }, NULL },
{ xrm_String, "highlightbg", { .str = &config.menu_hlbg }, NULL },
{ xrm_String, "hlbg", { .str = &config.menu_hlbg }, NULL },
{ xrm_String, "bordercolor", { .str = &config.menu_bc }, NULL },
{ xrm_Number, "padding", { .num = &config.padding }, NULL },
{ xrm_String, "bc", { .str = &config.menu_bc }, NULL },
{ xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL },
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL },
{ xrm_Number, "bw", { .num = &config.menu_bw }, NULL },
{ xrm_Number, "location", { .num = &config.location }, NULL },
{ xrm_Number, "loc", { .num = &config.location }, NULL },
{ xrm_Number, "padding", { .num = &config.padding }, NULL },
{ xrm_Number, "yoffset", { .num = &config.y_offset }, NULL },
{ xrm_Number, "xoffset", { .num = &config.x_offset }, NULL },
{ xrm_Boolean,"fixed-num-lines", { .num = &config.fixed_num_lines }, NULL },
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL },
{ xrm_Boolean,"hmode", { .num = &config.hmode }, NULL },
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL },
/* Key bindings */
{ xrm_String, "key", { .str = &config.window_key }, NULL },
{ xrm_String, "rkey", { .str = &config.run_key }, NULL },
@ -119,7 +139,6 @@ void parse_xresource_options ( Display *display )
free ( xrmOptions[i].mem );
xrmOptions[i].mem = NULL;
}
//TODO this leaks memory.
*xrmOptions[i].str = ( char * ) malloc ( xrmValue.size * sizeof ( char ) );
strncpy ( *xrmOptions[i].str, xrmValue.addr, xrmValue.size );