1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -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* ] ]
[ -ssh-client *client* ] [ -ssh-command *command* ] [ -now ] [ -rnow ] [ -snow ] [ -version ]
[ -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
@ -313,6 +313,10 @@ The default key combinations are:
echo -e "a\n3|b\n4|c\n5" | rofi -sep '|' -eh 2 -dmenu
`-l` *selected line*
Select a certain line.
### Message dialog
`-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 ] ]
[ \-ssh\-client \fIclient\fP ] [ \-ssh\-command \fIcommand\fP ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-version ]
[ \-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
.PP
\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
.fi
.RE
.PP
\fB\fC\-l\fR \fIselected line\fP
.PP
.RS
.nf
Select a certain line.
.fi
.RE
.SS Message dialog
.PP
\fB\fC\-e\fR \fImessage\fP

View file

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

View file

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

View file

@ -95,6 +95,7 @@ Switcher *switchers = NULL;
unsigned int num_switchers = 0;
unsigned int curr_switcher = 0;
/**
* @param name Name of the switcher to lookup.
*
@ -394,10 +395,9 @@ static XWindowAttributes* window_get_attributes ( Window w )
}
// retrieve a property of any type from a window
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 )
{
int format;
unsigned long nitems, nbytes;
unsigned char *ret = NULL;
@ -2460,7 +2460,9 @@ int main ( int argc, char *argv[] )
config.sidebar_mode = FALSE;
// Check prompt
find_arg_str ( argc, argv, "-p", &dmenu_prompt );
find_arg_int ( argc, argv, "-l", &dmenu_selected_line );
int retv = run_dmenu ();
// User canceled the operation.
if ( retv == FALSE ) {
return EXIT_FAILURE;