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

Add ctrl-space to set selected item as input.

This commit is contained in:
QC 2014-09-03 19:40:24 +02:00
parent 0462811800
commit 20dca49a22
4 changed files with 54 additions and 5 deletions

View file

@ -312,6 +312,7 @@ Rofi supports the following keybindings:
* `Ctrl-Page Up`: Go to the previous column
* `Ctrl-Page Down`: Go to the next column
* `?`: Switch to the next modi. The list can be customized with the `-switchers` argument.
* `Ctrl-space`: Set selected item as input text.
## WEBSITE

View file

@ -8,8 +8,9 @@ rofi \- A window switcher, run dialog and dmenu replacement
[ \-bg \fIcolor\fP ] [ \-hlfg \fIcolor\fP ] [ \-hlbg \fIcolor\fP ] [ \-key \fIcombo\fP ] [ \-dkey \fIcomdo\fP ] [ \-rkey \fIcomdo\fP ]
[ \-terminal \fIterminal\fP ] [ \-location \fIposition\fP ] [ \-hmode ] [ \-fixed\-num\-lines ] [ \-padding \fIpadding\fP ]
[ \-opacity \fIopacity%\fP ] [ \-display \fIdisplay\fP ] [ \-bc \fIcolor\fP ] [ \-bw \fIwidth\fP ] [ \-dmenu [ \-p \fIprompt\fP ] ]
[ \-ssh\-set\-title \fItrue|false\fP ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-version ] [ \-help] [ \-dump\-xresources ]
[ \-disable\-history ] [ \-levenshtein\-sort ] [ \-show \fImode\fP ] [ \-switcher \fImode1,mode2\fP ] [ \-e \fImessage\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]
.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.
@ -281,6 +282,26 @@ Dump the current active configuration in xresources format to the command\-line.
SSH dialogs tries to set 'ssh hostname' of the spawned terminal.
Not all terminals support this.
Default value is true.
.IP
\fIThis command has been deprecated for the ssh\-command string\fP
.PP
\fB\fC\-ssh\-command\fR \fIcmd\fP
.IP
Set the command to execute when starting a ssh session.
.PP
\fB\fC\-run\-command\fR \fIcmd\fP
.IP
Set the command to execute when running an application.
See \fIPATTERN\fP\&.
.PP
\fB\fC\-run\-shell\-command\fR \fIcmd\fP
.IP
Set the command to execute when running an application in a shell.
See \fIPATTERN\fP\&.
.PP
\fB\fC\-ssh\-client\fR \fIclient\fP
.IP
Override the used ssh client. Default is \fB\fCssh\fR\&.
.PP
\fB\fC\-disable\-history\fR
.IP
@ -341,6 +362,20 @@ So to have a mode 'Workspaces' using the \fB\fCi3_switch_workspace.sh\fR script
Popup a message dialog (used internally for showing errors) with *message*.
.fi
.RE
.SH Pattern
.PP
To launch commands (e.g. when using the ssh dialog) the user can enter the used commandline,
the following keys can be used that will be replaced at runtime:
.RS
.IP \(bu 2
\fB\fC{host}\fR: The host to connect to.
.IP \(bu 2
\fB\fC{terminal}\fR: The configured terminal (See \-terminal\-emulator)
.IP \(bu 2
\fB\fC{ssh\-client}\fR: The configured ssh client (See \-ssh\-client)
.IP \(bu 2
\fB\fC{cmd}\fR: The command to execute.
.RE
.SH Keybindings
.PP
Rofi supports the following keybindings:
@ -379,6 +414,8 @@ Rofi supports the following keybindings:
\fB\fCCtrl\-Page Down\fR: Go to the next column
.IP \(bu 2
\fB\fC?\fR: Switch to the next modi. The list can be customized with the \fB\fC\-switchers\fR argument.
.IP \(bu 2
\fB\fCCtrl\-space\fR: Set selected item as input text.
.RE
.SH WEBSITE
.PP

View file

@ -930,6 +930,7 @@ typedef struct MenuState
// Return state
int *selected_line;
MenuReturn retv;
char **lines;
}MenuState;
/**
@ -1184,6 +1185,15 @@ static void menu_keyboard_navigation ( MenuState *state, KeySym key, unsigned in
state->selected = state->filtered_lines - 1;
state->update = TRUE;
}
else if ( key == XK_space && (modstate & ControlMask ) == ControlMask ) {
// If a valid item is selected, return that..
if ( state->selected < state->filtered_lines && state->filtered[state->selected] != NULL ) {
textbox_text( state->text, state->lines[state->line_map[state->selected]] );
textbox_cursor_end( state->text );
state->update = TRUE;
state->refilter = TRUE;
}
}
state->prev_key = key;
}
@ -1415,7 +1425,8 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
.max_elements = 0,
// We want to filter on the first run.
.refilter = TRUE,
.update = FALSE
.update = FALSE,
.lines = lines
};
unsigned int i;
workarea mon;

View file

@ -34,11 +34,11 @@ textbox_test_SOURCES=\
textbox-test.c
helper_test_SOURCES=\
helper-test.c\
../config/config.c\
../include/rofi.h\
../source/helper.c\
../include/helper.h
../include/helper.h\
helper-test.c
.PHONY: test
test: ${bin_PROGRAMS}