Help users that do not pass the read-the-manual stage.

This commit is contained in:
QC 2015-04-05 22:29:26 +02:00
parent 274819cb34
commit 91fcc76cb2
4 changed files with 78 additions and 8 deletions

View File

@ -50,6 +50,7 @@ rofi - A window switcher, run dialog and dmenu replacement
[ -auto-select ]
[ -parse-hosts ]
[ -combi-modi *mode1,mode2* ]
[ -quiet ]
## DESCRIPTION
@ -93,7 +94,6 @@ The official website for `dmenu` can be found: http://tools.suckless.org/dmenu/
## OPTIONS
`-key-{mode}` **KEY**
Set the key combination to display a {mode} in daemon mode.
@ -140,6 +140,10 @@ The official website for `dmenu` can be found: http://tools.suckless.org/dmenu/
Start in case sensitive mode.
`-quiet`
Do not print any message when starting in daemon mode.
### Theming
@ -457,6 +461,11 @@ The official website for `dmenu` can be found: http://tools.suckless.org/dmenu/
Dump the current active configuration in xresources format to the command-line.
## OPTIONS via XResources
Any of the above options can be specified via Xresources. Check `rofi -dump-xresources` for the
available options. As a general rule option: `-key-run *key*` can be set as `rofi.key-run: *key*`.
## PATTERN
To launch commands (e.g. when using the ssh launcher) the user can enter the used commandline,
@ -501,7 +510,7 @@ and the others slightly transparent.
## Keybindings
Rofi supports the following keybindings:
**rofi** has the following key-bindings:
* `Ctrl-v, Insert`: Paste clipboard
* `Ctrl-Shift-v, Shift-Insert`: Paste primary selection

View File

@ -48,6 +48,7 @@ rofi \- A window switcher, run dialog and dmenu replacement
[ \-auto\-select ]
[ \-parse\-hosts ]
[ \-combi\-modi \fImode1,mode2\fP ]
[ \-quiet ]
.SH DESCRIPTION
.PP
\fBrofi\fP is an X11 popup window switcher, run dialog, dmenu replacement and more. It focusses on
@ -155,6 +156,10 @@ So to have a mode 'Workspaces' using the \fB\fCi3_switch_workspace.sh\fR script
\fB\fC\-case\-sensitive\fR
.IP
Start in case sensitive mode.
.PP
\fB\fC\-quiet\fR
.IP
Do not print any message when starting in daemon mode.
.SS Theming
.PP
\fB\fC\-bg\fR
@ -575,6 +580,10 @@ simultaneous. This is useful when running rofi from a keybinding daemon.
\fB\fC\-dump\-xresources\fR
.IP
Dump the current active configuration in xresources format to the command\-line.
.SH OPTIONS via XResources
.PP
Any of the above options can be specified via Xresources. Check \fB\fCrofi \-dump\-xresources\fR for the
available options. As a general rule option: \fB\fC\-key\-run *key*\fR can be set as \fB\fCrofi.key\-run: *key*\fR\&.
.SH PATTERN
.PP
To launch commands (e.g. when using the ssh launcher) the user can enter the used commandline,
@ -627,7 +636,7 @@ can be done for any color; it is therefore possible to have solid borders, the
and the others slightly transparent.
.SH Keybindings
.PP
Rofi supports the following keybindings:
\fBrofi\fP has the following key\-bindings:
.RS
.IP \(bu 2
\fB\fCCtrl\-v, Insert\fR: Paste clipboard

View File

@ -262,4 +262,24 @@ struct _Switcher
};
void menu_unmap ( void );
#define color_reset "\e[0m"
#define color_bold "\e[1m"
#define color_underline "\033[4m"
#define color_black "\e[0;30m"
#define color_red "\e[0;31m"
#define color_green "\e[0;32m"
#define color_yellow "\e[0;33m"
#define color_blue "\e[0;34m"
#define color_magenta "\e[0;35m"
#define color_cyan "\e[0;36m"
#define color_white "\e[0;37m"
#define color_white_bold "\e[1;37m"
#define color_black_bold "\e[1;30m"
#define color_red_bold "\e[1;31m"
#define color_green_bold "\e[1;32m"
#define color_yellow_bold "\e[1;33m"
#define color_blue_bold "\e[1;34m"
#define color_magenta_bold "\e[1;35m"
#define color_cyan_bold "\e[1;36m"
#endif

View File

@ -119,9 +119,8 @@ XVisualInfo vinfo;
void menu_unmap ( void )
{
if ( main_window != None ) {
release_keyboard(display);
XUnmapWindow(display, main_window);
release_keyboard ( display );
XUnmapWindow ( display, main_window );
}
}
@ -422,7 +421,7 @@ static void menu_calculate_rows_columns ( MenuState *state )
state->columns ) / ( state->columns )
) );
// Always have at least one row.
state->max_rows = MAX( 1, state->max_rows);
state->max_rows = MAX ( 1, state->max_rows );
if ( config.fixed_num_lines == TRUE ) {
state->max_elements = state->menu_lines * state->columns;
@ -1505,7 +1504,7 @@ static void handle_keypress ( XEvent *ev )
*/
static void help ()
{
int code = execlp ( "man", "man", "-M", MANPAGE_PATH, "rofi",NULL );
int code = execlp ( "man", "man", "-M", MANPAGE_PATH, "rofi", NULL );
if ( code == -1 ) {
fprintf ( stderr, "Failed to execute man: %s\n", strerror ( errno ) );
@ -1681,8 +1680,13 @@ static void show_error_message ( const char *msg )
int main ( int argc, char *argv[] )
{
int quiet = FALSE;
int dmenu_mode = FALSE;
cmd_set_arguments ( argc, argv );
// Quiet flag
if ( find_arg ( "-quiet" ) >= 0 ) {
quiet = TRUE;
}
// catch help request
if ( find_arg ( "-h" ) >= 0 || find_arg ( "-help" ) >= 0 ) {
help ();
@ -1789,11 +1793,39 @@ int main ( int argc, char *argv[] )
}
}
else{
int key_bound = FALSE;
unsigned int key_length = 0;
// Daemon mode, Listen to key presses..
for ( unsigned int i = 0; i < num_switchers; i++ ) {
key_length = MAX ( key_length, strlen ( switchers[i]->name ) );
if ( switchers[i]->keystr != NULL ) {
x11_parse_key ( switchers[i]->keystr, &( switchers[i]->modmask ), &( switchers[i]->keysym ) );
x11_grab_key ( display, switchers[i]->modmask, switchers[i]->keysym );
key_bound = TRUE;
}
}
if ( !key_bound ) {
fprintf ( stderr, "Rofi was launched in daemon mode, but no key-binding was specified.\n" );
fprintf ( stderr, "Please check the manpage on how to specify a key-binding.\n" );
fprintf ( stderr, "The following modi are enabled and keys can be specified:\n" );
for ( unsigned int i = 0; i < num_switchers; i++ ) {
fprintf ( stderr, "\t* "color_bold "%*s"color_reset ": -key-%s <key>\n",
key_length, switchers[i]->name, switchers[i]->name );
}
return EXIT_FAILURE;
}
if ( !quiet ) {
fprintf ( stdout, "Rofi is launched in daemon mode.\n" );
fprintf ( stdout, "listening to the following keys:\n" );
for ( unsigned int i = 0; i < num_switchers; i++ ) {
if ( switchers[i]->keystr != NULL ) {
fprintf ( stdout, "\t* "color_bold "%*s"color_reset " on %s\n",
key_length, switchers[i]->name, switchers[i]->keystr );
}
else {
fprintf ( stdout, "\t* "color_bold "%*s"color_reset " on <unspecified>\n",
key_length, switchers[i]->name );
}
}
}
// Setup handler for sighup (reload config)