mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
parent
9b33197e1f
commit
8afba6e875
5 changed files with 24 additions and 8 deletions
|
@ -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*
|
||||||
|
|
10
doc/rofi.1
10
doc/rofi.1
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
#include "dmenu-dialog.h"
|
#include "dmenu-dialog.h"
|
||||||
#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 );
|
||||||
|
|
|
@ -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.
|
||||||
*
|
*
|
||||||
|
@ -394,10 +395,9 @@ static XWindowAttributes* window_get_attributes ( Window w )
|
||||||
}
|
}
|
||||||
|
|
||||||
// retrieve a property of any type from a window
|
// 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 )
|
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;
|
||||||
|
@ -633,7 +633,7 @@ static client* window_client ( Window win )
|
||||||
|
|
||||||
|
|
||||||
static void menu_hide_arrow_text ( int filtered_lines, int selected, int max_elements,
|
static void menu_hide_arrow_text ( int filtered_lines, int selected, int max_elements,
|
||||||
textbox *arrowbox_top, textbox *arrowbox_bottom )
|
textbox *arrowbox_top, textbox *arrowbox_bottom )
|
||||||
{
|
{
|
||||||
if ( arrowbox_top == NULL || arrowbox_bottom == NULL ) {
|
if ( arrowbox_top == NULL || arrowbox_bottom == NULL ) {
|
||||||
return;
|
return;
|
||||||
|
@ -649,7 +649,7 @@ static void menu_hide_arrow_text ( int filtered_lines, int selected, int max_ele
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_set_arrow_text ( int filtered_lines, int selected, int max_elements,
|
static void menu_set_arrow_text ( int filtered_lines, int selected, int max_elements,
|
||||||
textbox *arrowbox_top, textbox *arrowbox_bottom )
|
textbox *arrowbox_top, textbox *arrowbox_bottom )
|
||||||
{
|
{
|
||||||
if ( arrowbox_top == NULL || arrowbox_bottom == NULL ) {
|
if ( arrowbox_top == NULL || arrowbox_bottom == NULL ) {
|
||||||
return;
|
return;
|
||||||
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue