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

Bug #98: Select a certain line.

* -l select line
This commit is contained in:
QC 2014-12-16 21:08:12 +01:00
parent 9b33197e1f
commit 8afba6e875
5 changed files with 24 additions and 8 deletions

View file

@ -12,7 +12,7 @@ rofi - A window switcher, run dialog and dmenu replacement
[ -opacity *opacity%* ] [ -display *display* ] [ -bc *color* ] [ -bw *width* ] [ -dmenu [ -p *prompt* ] ] [ -opacity *opacity%* ] [ -display *display* ] [ -bc *color* ] [ -bw *width* ] [ -dmenu [ -p *prompt* ] ]
[ -ssh-client *client* ] [ -ssh-command *command* ] [ -now ] [ -rnow ] [ -snow ] [ -version ] [ -ssh-client *client* ] [ -ssh-command *command* ] [ -now ] [ -rnow ] [ -snow ] [ -version ]
[ -help] [ -dump-xresources ] [ -disable-history ] [ -levenshtein-sort ] [ -show *mode* ] [ -switcher [ -help] [ -dump-xresources ] [ -disable-history ] [ -levenshtein-sort ] [ -show *mode* ] [ -switcher
*mode1,mode2* ] [ -e *message*] [ -sep *separator* ] [ -eh *element height* ] *mode1,mode2* ] [ -e *message*] [ -sep *separator* ] [ -eh *element height* ] [ -l *selected line* ]
## DESCRIPTION ## DESCRIPTION
@ -313,6 +313,10 @@ The default key combinations are:
echo -e "a\n3|b\n4|c\n5" | rofi -sep '|' -eh 2 -dmenu echo -e "a\n3|b\n4|c\n5" | rofi -sep '|' -eh 2 -dmenu
`-l` *selected line*
Select a certain line.
### Message dialog ### Message dialog
`-e` *message* `-e` *message*

View file

@ -10,7 +10,7 @@ rofi \- A window switcher, run dialog and dmenu replacement
[ \-opacity \fIopacity%\fP ] [ \-display \fIdisplay\fP ] [ \-bc \fIcolor\fP ] [ \-bw \fIwidth\fP ] [ \-dmenu [ \-p \fIprompt\fP ] ] [ \-opacity \fIopacity%\fP ] [ \-display \fIdisplay\fP ] [ \-bc \fIcolor\fP ] [ \-bw \fIwidth\fP ] [ \-dmenu [ \-p \fIprompt\fP ] ]
[ \-ssh\-client \fIclient\fP ] [ \-ssh\-command \fIcommand\fP ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-version ] [ \-ssh\-client \fIclient\fP ] [ \-ssh\-command \fIcommand\fP ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-version ]
[ \-help] [ \-dump\-xresources ] [ \-disable\-history ] [ \-levenshtein\-sort ] [ \-show \fImode\fP ] [ \-switcher [ \-help] [ \-dump\-xresources ] [ \-disable\-history ] [ \-levenshtein\-sort ] [ \-show \fImode\fP ] [ \-switcher
\fImode1,mode2\fP ] [ \-e \fImessage\fP] [ \-sep \fIseparator\fP ] [ \-eh \fIelement height\fP ] \fImode1,mode2\fP ] [ \-e \fImessage\fP] [ \-sep \fIseparator\fP ] [ \-eh \fIelement height\fP ] [ \-l \fIselected line\fP ]
.SH DESCRIPTION .SH DESCRIPTION
.PP .PP
\fBrofi\fP is an X11 popup window switcher. A list is displayed center\-screen showing open window titles, WM_CLASS, and desktop number. \fBrofi\fP is an X11 popup window switcher. A list is displayed center\-screen showing open window titles, WM_CLASS, and desktop number.
@ -393,6 +393,14 @@ The height of a field in lines. e.g.
echo \-e "a\\n3|b\\n4|c\\n5" | rofi \-sep '|' \-eh 2 \-dmenu echo \-e "a\\n3|b\\n4|c\\n5" | rofi \-sep '|' \-eh 2 \-dmenu
.fi .fi
.RE .RE
.PP
\fB\fC\-l\fR \fIselected line\fP
.PP
.RS
.nf
Select a certain line.
.fi
.RE
.SS Message dialog .SS Message dialog
.PP .PP
\fB\fC\-e\fR \fImessage\fP \fB\fC\-e\fR \fImessage\fP

View file

@ -5,6 +5,7 @@
* Prompt used in dmenu. * Prompt used in dmenu.
*/ */
extern char *dmenu_prompt; extern char *dmenu_prompt;
extern int dmenu_selected_line;
/** /**

View file

@ -37,6 +37,7 @@
#include "helper.h" #include "helper.h"
char *dmenu_prompt = "dmenu "; char *dmenu_prompt = "dmenu ";
int dmenu_selected_line = 0;
static char **get_dmenu ( int *length ) static char **get_dmenu ( int *length )
{ {
@ -67,7 +68,7 @@ static char **get_dmenu ( int *length )
int dmenu_switcher_dialog ( char **input ) int dmenu_switcher_dialog ( char **input )
{ {
int selected_line = 0; int selected_line = dmenu_selected_line;
int retv = FALSE; int retv = FALSE;
int length = 0; int length = 0;
char **list = get_dmenu ( &length ); char **list = get_dmenu ( &length );

View file

@ -95,6 +95,7 @@ Switcher *switchers = NULL;
unsigned int num_switchers = 0; unsigned int num_switchers = 0;
unsigned int curr_switcher = 0; unsigned int curr_switcher = 0;
/** /**
* @param name Name of the switcher to lookup. * @param name Name of the switcher to lookup.
* *
@ -397,7 +398,6 @@ static XWindowAttributes* window_get_attributes ( Window w )
static int window_get_prop ( Window w, Atom prop, Atom *type, int *items, void *buffer, unsigned int bytes ) __attribute__ ( ( nonnull ( 3, 4 ) ) ); static int window_get_prop ( Window w, Atom prop, Atom *type, int *items, void *buffer, unsigned int bytes ) __attribute__ ( ( nonnull ( 3, 4 ) ) );
static int window_get_prop ( Window w, Atom prop, Atom *type, int *items, void *buffer, unsigned int bytes ) static int window_get_prop ( Window w, Atom prop, Atom *type, int *items, void *buffer, unsigned int bytes )
{ {
int format; int format;
unsigned long nitems, nbytes; unsigned long nitems, nbytes;
unsigned char *ret = NULL; unsigned char *ret = NULL;
@ -2460,7 +2460,9 @@ int main ( int argc, char *argv[] )
config.sidebar_mode = FALSE; config.sidebar_mode = FALSE;
// Check prompt // Check prompt
find_arg_str ( argc, argv, "-p", &dmenu_prompt ); find_arg_str ( argc, argv, "-p", &dmenu_prompt );
find_arg_int ( argc, argv, "-l", &dmenu_selected_line );
int retv = run_dmenu (); int retv = run_dmenu ();
// User canceled the operation. // User canceled the operation.
if ( retv == FALSE ) { if ( retv == FALSE ) {
return EXIT_FAILURE; return EXIT_FAILURE;