1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Add rofi-script manpage, add meta option support to dmenu.

update ronn to go-md2man
This commit is contained in:
Dave Davenport 2020-02-02 17:21:21 +01:00
parent 7dcc3f450c
commit bc2e1549fb
5 changed files with 1457 additions and 1301 deletions

View file

@ -176,10 +176,12 @@ dist_man1_MANS=\
doc/rofi-sensible-terminal.1 doc/rofi-sensible-terminal.1
dist_man5_MANS=\ dist_man5_MANS=\
doc/rofi-theme.5 doc/rofi-theme.5\
doc/rofi-script.5
EXTRA_DIST += \ EXTRA_DIST += \
doc/rofi-theme.5.markdown \ doc/rofi-theme.5.markdown \
doc/rofi-script.5.markdown \
doc/rofi-theme-selector.1.markdown \ doc/rofi-theme-selector.1.markdown \
doc/rofi.1.markdown doc/rofi.1.markdown
@ -257,10 +259,11 @@ EXTRA_DIST+=\
## ##
update-manpage: $(top_srcdir)/doc/rofi-theme-selector.1.markdown $(top_srcdir)/doc/rofi.1.markdown $(top_srcdir)/doc/rofi-theme.5.markdown update-manpage: $(top_srcdir)/doc/rofi-theme-selector.1.markdown $(top_srcdir)/doc/rofi.1.markdown $(top_srcdir)/doc/rofi-theme.5.markdown $(top_srcdir)/doc/rofi-script.5.markdown
ronn --roff $(top_srcdir)/doc/rofi.1.markdown go-md2man -in $(top_srcdir)/doc/rofi.1.markdown -out $(top_srcdir)/doc/rofi.1
ronn --roff $(top_srcdir)/doc/rofi-theme-selector.1.markdown go-md2man -in $(top_srcdir)/doc/rofi-theme-selector.1.markdown -out $(top_srcdir)/doc/rofi-theme-selector.1
ronn --roff $(top_srcdir)/doc/rofi-theme.5.markdown go-md2man -in $(top_srcdir)/doc/rofi-theme.5.markdown -out $(top_srcdir)/doc/rofi-theme.5
go-md2man -in $(top_srcdir)/doc/rofi-script.5.markdown -out $(top_srcdir)/doc/rofi-script.5
## ##
# Rofi test program # Rofi test program

102
doc/rofi-script.5.markdown Normal file
View file

@ -0,0 +1,102 @@
# ROFI-SCRIPT 5 rofi-script
## NAME
**rofi script mode** - Rofi format for scriptable modi.
## DESCRIPTION
**rofi** supports modes that use simple scripts in the background to generate a list and process the result from user
actions. This provide a simple interface to make simple extensions to rofi.
## USAGE
To specify a script mode, set a mode with the following syntax: "{name}:{executable}"
For example:
```
rofi -show fb -modi "fb:file_browser.sh"
```
The name should be unique.
## API
Rofi calls the executable without arguments on startup. This should generate a list of options, separated by a newline
(`\n`).
If the user selects an option, rofi calls the executable with the text of that option as the first argument.
If the script returns no entries, rofi quits.
A simple script would be:
```bash
#!/usr/bin/env bash
if [ x"$@" = x"quit" ]
then
exit 0
fi
echo "reload"
echo "quit"
```
This shows two entries, reload and quit. When the quit entry is selected, rofi closes.
## Passing mode options
Extra options, like setting the prompt, can be set by the script.
Extra options are lines that start with a NULL character (`\0`) followed by a key, separator (`\x1f`) and value.
For example to set the prompt:
```bash
echo -en "\0prompt\x1fChange prompt\n"
```
The following extra options exists:
* **prompt**: Update the prompt text.
* **message**: Update the message text.
* **markup-rows**: If 'true' renders markup in the row.
* **urgent**: Mark rows as urgent. (for syntax see the urgent option in dmenu mode)
* **active**: Mark rows as active. (for syntax see the active option in dmenu mode)
## Parsing row options
Extra options for individual rows can be set.
The extra option can be specified following the same syntax as mode option, but following the entry.
For example:
```bash
echo -en "aap\0icon\x1ffolder\n"
```
The following options are supported:
* **icon**: Set the icon for that row.
* **meta**: Specify invisible search terms.
* **nonselectable**: If true the row cannot activated.
## SEE ALSO
rofi-sensible-terminal(1), dmenu(1), rofi-theme(5), rofi-theme-selector(1)
## AUTHOR
Qball Cow <qball@gmpclient.org>
Rasmus Steinke <rasi@xssn.at>
Quentin Glidic <sardemff7+rofi@sardemff7.net>
Original code based on work by: Sean Pringle <sean.pringle@gmail.com>
For a full list of authors, check the AUTHORS file.

View file

@ -1,47 +1,44 @@
.\" generated with Ronn/v0.7.3 .TH rofi\-theme\-selector 1 rofi\-theme\-selector
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .SH NAME
. .PP
.TH "ROFI\-THEME\-SELECTOR" "1" "December 2019" "" "" \fBrofi\-theme\-selector\fP \- Preview and apply themes for \fBrofi\fP
.
.SH "NAME" .SH DESCRIPTION
\fBrofi\-theme\-selector\fR \- Preview and apply themes for \fBrofi\fR .PP
. \fBrofi\-theme\-selector\fP is a bash/rofi script to preview and apply themes for \fBrofi\fP\&.
.SH "DESCRIPTION" It's part of any installation of \fBrofi\fP\&.
\fBrofi\-theme\-selector\fR is a bash/rofi script to preview and apply themes for \fBrofi\fR\. It\'s part of any installation of \fBrofi\fR\.
. .SH USAGE
.SH "USAGE" .SS Running rofi\-theme\-selector
. .PP
.SS "Running rofi\-theme\-selector" \fBrofi\-theme\-selector\fP shows a list of all available themes in a \fBrofi\fP window.
\fBrofi\-theme\-selector\fR shows a list of all available themes in a \fBrofi\fR window\. It lets you preview each theme with the Enter key and apply the theme to your \fBrofi\fR configuration file with Alt+a\. It lets you preview each theme with the Enter key and apply the theme to your
. \fBrofi\fP configuration file with Alt+a.
.SH "Theme directories"
\fBrofi\-theme\-selector\fR searches the following directories for themes: .SH Theme directories
. .PP
.IP "\(bu" 4 \fBrofi\-theme\-selector\fP searches the following directories for themes:
.RS
.IP \(bu 2
${PREFIX}/share/rofi/themes ${PREFIX}/share/rofi/themes
. .IP \(bu 2
.IP "\(bu" 4 $XDG\_CONFIG\_HOME/rofi/themes
$XDG_CONFIG_HOME/rofi/themes .IP \(bu 2
. $XDG\_DATA\_HOME/share/rofi/themes
.IP "\(bu" 4
$XDG_DATA_HOME/share/rofi/themes .RE
.
.IP "" 0 .PP
. ${PREFIX} reflects the install location of rofi. In most cases this will be "/usr".<br>
.P $XDG\_CONFIG\_HOME is normally unset. Default path is "$HOME/.config".<br>
${PREFIX} reflects the install location of rofi\. In most cases this will be "/usr"\. $XDG\_DATA\_HOME is normally unset. Default path is "$HOME/.local/share".
.
.br .SH SEE ALSO
$XDG_CONFIG_HOME is normally unset\. Default path is "$HOME/\.config"\. .PP
.
.br
$XDG_DATA_HOME is normally unset\. Default path is "$HOME/\.local/share"\.
.
.SH "SEE ALSO"
rofi(1) rofi(1)
.
.SH "AUTHORS" .SH AUTHORS
Qball Cow qball@gmpclient\.org .PP
. Qball Cow qball@gmpclient.org<br>
.br Rasmus Steinke rasi@xssn.at
Rasmus Steinke rasi@xssn\.at

File diff suppressed because it is too large Load diff

View file

@ -436,20 +436,37 @@ static int dmenu_mode_init ( Mode *sw )
static int dmenu_token_match ( const Mode *sw, rofi_int_matcher **tokens, unsigned int index ) static int dmenu_token_match ( const Mode *sw, rofi_int_matcher **tokens, unsigned int index )
{ {
DmenuModePrivateData *rmpd = (DmenuModePrivateData *) mode_get_private_data ( sw ); DmenuModePrivateData *rmpd = (DmenuModePrivateData *) mode_get_private_data ( sw );
if ( rmpd->do_markup ) {
/** Strip out the markup when matching. */ /** Strip out the markup when matching. */
char *esc = NULL; char *esc = NULL;
if ( rmpd->do_markup ) {
pango_parse_markup ( rmpd->cmd_list[index].entry, -1, 0, NULL, &esc, NULL, NULL ); pango_parse_markup ( rmpd->cmd_list[index].entry, -1, 0, NULL, &esc, NULL, NULL );
if ( esc ) {
int retv = helper_token_match ( tokens, esc );
g_free ( esc );
return retv;
}
return FALSE;
} }
else { else {
return helper_token_match ( tokens, rmpd->cmd_list[index].entry ); esc = rmpd->cmd_list[index].entry;
} }
if ( esc ) {
// int retv = helper_token_match ( tokens, esc );
int match = 1;
if ( tokens ) {
for ( int j = 0; match && tokens != NULL && tokens[j] != NULL; j++ ) {
rofi_int_matcher *ftokens[2] = { tokens[j], NULL };
int test = 0;
test = helper_token_match ( ftokens, esc );
if ( test == tokens[j]->invert && rmpd->cmd_list[index].meta ) {
test = helper_token_match ( ftokens, rmpd->cmd_list[index].meta );
}
if ( test == 0 ) {
match = 0;
}
}
}
if ( rmpd->do_markup ) {
g_free ( esc );
}
return match;
}
return FALSE;
} }
static char *dmenu_get_message ( const Mode *sw ) static char *dmenu_get_message ( const Mode *sw )
{ {