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:
parent
7dcc3f450c
commit
bc2e1549fb
5 changed files with 1457 additions and 1301 deletions
13
Makefile.am
13
Makefile.am
|
@ -176,10 +176,12 @@ dist_man1_MANS=\
|
|||
doc/rofi-sensible-terminal.1
|
||||
|
||||
dist_man5_MANS=\
|
||||
doc/rofi-theme.5
|
||||
doc/rofi-theme.5\
|
||||
doc/rofi-script.5
|
||||
|
||||
EXTRA_DIST += \
|
||||
doc/rofi-theme.5.markdown \
|
||||
doc/rofi-script.5.markdown \
|
||||
doc/rofi-theme-selector.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
|
||||
ronn --roff $(top_srcdir)/doc/rofi.1.markdown
|
||||
ronn --roff $(top_srcdir)/doc/rofi-theme-selector.1.markdown
|
||||
ronn --roff $(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
|
||||
go-md2man -in $(top_srcdir)/doc/rofi.1.markdown -out $(top_srcdir)/doc/rofi.1
|
||||
go-md2man -in $(top_srcdir)/doc/rofi-theme-selector.1.markdown -out $(top_srcdir)/doc/rofi-theme-selector.1
|
||||
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
|
||||
|
|
102
doc/rofi-script.5.markdown
Normal file
102
doc/rofi-script.5.markdown
Normal 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.
|
|
@ -1,47 +1,44 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "ROFI\-THEME\-SELECTOR" "1" "December 2019" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBrofi\-theme\-selector\fR \- Preview and apply themes for \fBrofi\fR
|
||||
.
|
||||
.SH "DESCRIPTION"
|
||||
\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"
|
||||
.
|
||||
.SS "Running rofi\-theme\-selector"
|
||||
\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\.
|
||||
.
|
||||
.SH "Theme directories"
|
||||
\fBrofi\-theme\-selector\fR searches the following directories for themes:
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
.TH rofi\-theme\-selector 1 rofi\-theme\-selector
|
||||
.SH NAME
|
||||
.PP
|
||||
\fBrofi\-theme\-selector\fP \- Preview and apply themes for \fBrofi\fP
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBrofi\-theme\-selector\fP is a bash/rofi script to preview and apply themes for \fBrofi\fP\&.
|
||||
It's part of any installation of \fBrofi\fP\&.
|
||||
|
||||
.SH USAGE
|
||||
.SS Running rofi\-theme\-selector
|
||||
.PP
|
||||
\fBrofi\-theme\-selector\fP shows a list of all available themes in a \fBrofi\fP window.
|
||||
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
|
||||
.PP
|
||||
\fBrofi\-theme\-selector\fP searches the following directories for themes:
|
||||
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
${PREFIX}/share/rofi/themes
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
$XDG_CONFIG_HOME/rofi/themes
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
$XDG_DATA_HOME/share/rofi/themes
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
${PREFIX} reflects the install location of rofi\. In most cases this will be "/usr"\.
|
||||
.
|
||||
.br
|
||||
$XDG_CONFIG_HOME is normally unset\. Default path is "$HOME/\.config"\.
|
||||
.
|
||||
.br
|
||||
$XDG_DATA_HOME is normally unset\. Default path is "$HOME/\.local/share"\.
|
||||
.
|
||||
.SH "SEE ALSO"
|
||||
.IP \(bu 2
|
||||
$XDG\_CONFIG\_HOME/rofi/themes
|
||||
.IP \(bu 2
|
||||
$XDG\_DATA\_HOME/share/rofi/themes
|
||||
|
||||
.RE
|
||||
|
||||
.PP
|
||||
${PREFIX} reflects the install location of rofi. In most cases this will be "/usr".<br>
|
||||
$XDG\_CONFIG\_HOME is normally unset. Default path is "$HOME/.config".<br>
|
||||
$XDG\_DATA\_HOME is normally unset. Default path is "$HOME/.local/share".
|
||||
|
||||
.SH SEE ALSO
|
||||
.PP
|
||||
rofi(1)
|
||||
.
|
||||
.SH "AUTHORS"
|
||||
Qball Cow qball@gmpclient\.org
|
||||
.
|
||||
.br
|
||||
Rasmus Steinke rasi@xssn\.at
|
||||
|
||||
.SH AUTHORS
|
||||
.PP
|
||||
Qball Cow qball@gmpclient.org<br>
|
||||
Rasmus Steinke rasi@xssn.at
|
||||
|
|
2519
doc/rofi-theme.5
2519
doc/rofi-theme.5
File diff suppressed because it is too large
Load diff
|
@ -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 )
|
||||
{
|
||||
DmenuModePrivateData *rmpd = (DmenuModePrivateData *) mode_get_private_data ( sw );
|
||||
if ( rmpd->do_markup ) {
|
||||
/** Strip out the markup when matching. */
|
||||
char *esc = NULL;
|
||||
if ( rmpd->do_markup ) {
|
||||
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 {
|
||||
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 )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue