Merge remote-tracking branch 'upstream/next' into wayland

This commit is contained in:
lbonn 2024-02-16 17:54:10 +01:00
commit 070c830a92
33 changed files with 681 additions and 45 deletions

View File

@ -103,4 +103,4 @@ body:
description: I confirm that I verified the issue still exists in the latest stable release.
options:
- label: "Yes, I have checked the problem exists in the latest stable version"
required: true
required: false

View File

@ -0,0 +1,81 @@
name: Documentation Bug Report
description: Report a problem in Rofi Documentation
labels: [Documentation]
title: "[Doc] "
body:
- type: markdown
attributes:
value: |
First read the
[guidelines](https://github.com/DaveDavenport/rofi/blob/next/.github/CONTRIBUTING.md)!
This is not optional for any report. People must be able to understand
the full context of the report when reading it, at any time.
If you feel like you “it is simple and requires no explanation”, please
consider youre wrong and still fill the full report. Any report
missing required informations will be labeled as “Incomplete Report -
Please follow the guidelines” and will be closed. If you ask a
question, enter dummy information in required fields to get passed the
checks or in general completely ignore the guidelines, the issue will
be closed and locked as spam.
If you are unsure, please use the
[discussion](https://github.com/davatorium/rofi/discussions) forum
first. It is easy to upgrade a question to an issue in github.
**Please do not submit reports related to wayland, see
[here](https://github.com/DaveDavenport/rofi/wiki/Wayland) for more
information.**
- type: input
attributes:
label: "Rofi version (rofi -v)"
placeholder: "Version: 1.7.5"
validations:
required: true
- type: input
attributes:
label: "URL"
description: "Please provide a link to the relevant documentation."
placeholder: "link to page on https://davatorium.github.io/rofi/ or file on https://github.com/davatorium/rofi/"
validations:
required: true
- type: textarea
attributes:
label: "Explain the issue with the documentation, please be verbose."
placeholder: |
* What am I trying to achieve
..
* What instructions are unclear, wrong or missing
..
* Suggestions for improving the current documentation
..
validations:
required: true
- type: textarea
attributes:
label: "Optional fixed text"
description: "Suggested new and or improved text for documentation."
validations:
required: false
- type: checkboxes
id: wayland
attributes:
label: Using wayland display server protocol
description: I have checked and confirm that my issue is not related to running rofi using wayland as display server protocol. See [here](https://github.com/DaveDavenport/rofi/wiki/Wayland) for more information.
options:
- label: "No, my documentation issue is not about running rofi using the wayland display server protocol"
required: true
- type: checkboxes
id: latestversion
attributes:
label: I've checked if the issue exists in the latest stable release
description: I confirm that I verified the issue still exists in the latest stable release.
options:
- label: "Yes, I have checked the problem exists in the latest stable version"
required: false

View File

@ -22,6 +22,7 @@ else
echo -en "\0message\x1fSpecial <b>bold</b>message\n"
echo -en "aap\0icon\x1ffolder\n"
echo -en "blob\0icon\x1ffolder\x1fdisplay\x1fblub\n"
echo "noot"
echo "mies"
echo -en "-------------\0nonselectable\x1ftrue\n"

View File

@ -75,6 +75,11 @@ For wayland support:
## Install from a release
When downloading from the github release page, make sure to grab the archive
`rofi-{version}.tar.[g|x]z`. The auto-attached files `source code (zip|tar.gz)`
by github do not contain a valid release. It misses a setup build system and
includes irrelevant files.
### Autotools
Create a build directory and enter it:
@ -272,6 +277,7 @@ https://aur.archlinux.org/packages/rofi-lbonn-wayland-git/
https://packages.fedoraproject.org/pkgs/rofi-wayland/rofi-wayland/
### Gentoo
`gui-apps/rofi-wayland` exists in the [GURU](https://wiki.gentoo.org/wiki/Project:GURU/Information_for_End_Users) overlay.
https://gitweb.gentoo.org/repo/proj/guru.git/tree/gui-apps/rofi-wayland

View File

@ -150,6 +150,11 @@ a widget.
.RE
.PP
The \fBtheme\fP property cannot change the interface while running, it is only
usable for small changes in, for example background color, of widgets that get
updated during display like the row color of the listview.
.SH Parsing row options
.PP
Extra options for individual rows can be set. The extra option can be specified
@ -174,12 +179,14 @@ The following options are supported:
.IP \(bu 2
\fBicon\fP: Set the icon for that row.
.IP \(bu 2
\fBmeta\fP: Specify invisible search terms.
\fBdisplay\fP: Replace the displayed string. (Original string will still be used for filtering)
.IP \(bu 2
\fBmeta\fP: Specify invisible search terms used for filtering.
.IP \(bu 2
\fBnonselectable\fP: If true the row cannot activated.
.IP \(bu 2
\fBinfo\fP: Info that, on selection, gets placed in the \fB\fCROFI_INFO\fR
environment variable. This entry does not get searched.
environment variable. This entry does not get searched for filtering.
.IP \(bu 2
\fBurgent\fP: Set urgent flag on entry (true/false)
.IP \(bu 2

View File

@ -118,6 +118,10 @@ The following extra options exists:
- **theme**: Small theme snippet to f.e. change the background color of
a widget.
The **theme** property cannot change the interface while running, it is only
usable for small changes in, for example background color, of widgets that get
updated during display like the row color of the listview.
## Parsing row options
Extra options for individual rows can be set. The extra option can be specified
@ -133,12 +137,14 @@ The following options are supported:
- **icon**: Set the icon for that row.
- **meta**: Specify invisible search terms.
- **display**: Replace the displayed string. (Original string will still be used for filtering)
- **meta**: Specify invisible search terms used for filtering.
- **nonselectable**: If true the row cannot activated.
- **info**: Info that, on selection, gets placed in the `ROFI_INFO`
environment variable. This entry does not get searched.
environment variable. This entry does not get searched for filtering.
- **urgent**: Set urgent flag on entry (true/false)

View File

@ -2206,7 +2206,8 @@ It supports the following keys as constraint:
.IP \(bu 2
\fB\fCmonitor-id\fR: The monitor id, see rofi -help for id's.
.IP \(bu 2
\fB\fCenabled\fR: Boolean option to enable. Supports environment variable.
\fB\fCenabled\fR: Boolean option to enable. Supports environment variable
or DMENU to detect if in dmenu mode.
.RE
@ -2229,7 +2230,18 @@ added.
.RS
.nf
@media ( enabled: env(DO_LIGHT, false ) {
@media ( enabled: env(DO_LIGHT, false )) {
}
.fi
.RE
.PP
.RS
.nf
@media ( enabled: DMENU) {
}

View File

@ -1497,7 +1497,8 @@ It supports the following keys as constraint:
- `min-aspect-ratio` load when aspect ratio is over value.
- `max-aspect-ratio`: load when aspect ratio is under value.
- `monitor-id`: The monitor id, see rofi -help for id's.
- `enabled`: Boolean option to enable. Supports environment variable.
- `enabled`: Boolean option to enable. Supports environment variable
or DMENU to detect if in dmenu mode.
@media takes an integer number or a fraction, for integer number `px` can be
added.
@ -1509,7 +1510,13 @@ added.
```
```css
@media ( enabled: env(DO_LIGHT, false ) {
@media ( enabled: env(DO_LIGHT, false )) {
}
```
```css
@media ( enabled: DMENU) {
}
```

View File

@ -601,6 +601,8 @@ The format string for the \fB\fCdrun\fR dialog:
\fBcategories\fP: the application's categories
.IP \(bu 2
\fBcomment\fP: the application comment
.IP \(bu 2
\fBurl\fP: The url in case of a link type desktop file
.RE
@ -1372,6 +1374,15 @@ replaced at runtime:
.RE
.PP
It processes the string as follows: \fB\fC{key}\fR
is replaced by its value, if \fB\fC{key}\fR is not set it is removed. If the \fB\fC{key}\fR
is in between \fB\fC[]\fR all the text between \fB\fC[]\fR is removed if \fB\fC{key}\fR is not set.
Otherwise key is replaced and the \fB\fC[]\fR are removed.
.PP
For example: \fB\fC{ssh-client} [-p {port}] {host}\fR
.SH THEMING
.PP
Please see \fBrofi\-theme(5)\fP manpage for more information on theming.

View File

@ -381,6 +381,7 @@ The format string for the `drun` dialog:
- **exec**: the application's executable
- **categories**: the application's categories
- **comment**: the application comment
- **url**: The url in case of a link type desktop file
Pango markup can be used to formatting the output.
@ -886,6 +887,13 @@ replaced at runtime:
- `{cmd}`: the command to execute
- `{window}`: the window ID of the selected window (in `window-command`)
It processes the string as follows: `{key}`
is replaced by its value, if `{key}` is not set it is removed. If the `{key}`
is in between `[]` all the text between `[]` is removed if `{key}` is not set.
Otherwise key is replaced and the `[]` are removed.
For example: `{ssh-client} [-p {port}] {host}`
## THEMING
Please see **rofi-theme(5)** manpage for more information on theming.

View File

@ -8,6 +8,10 @@
typedef struct {
/** Entry content. (visible part) */
char *entry;
/** Display */
char *display;
/** Icon name to display. */
char *icon_name;
/** Async icon fetch handler. */

View File

@ -370,6 +370,7 @@ typedef struct rofi_int_matcher_t {
*/
typedef struct _thread_state {
void (*callback)(struct _thread_state *t, gpointer data);
int priority;
} thread_state;
extern GThreadPool *tpool;

View File

@ -64,7 +64,7 @@ struct _xcb_stuff {
} xkb;
xcb_timestamp_t last_timestamp;
NkBindingsSeat *bindings_seat;
gboolean mouse_seen;
uint32_t mouse_seen;
xcb_window_t focus_revert;
char *clipboard;
};

View File

@ -49,6 +49,7 @@
#define LOG_DOMAIN "Parser"
int last_state = 0;
extern int rofi_is_in_dmenu_mode;
const char *rasi_theme_file_extensions[] = {".rasi", ".rasinc", NULL};
/**
@ -298,6 +299,8 @@ CONFIGURATION (?i:configuration)
MEDIA_TYPES (monitor-id|(min|max)-(width|height|aspect-ratio)|enabled)
DMENU (?i:dmenu)
%x INCLUDE
%x PROPERTIES
%x PROPERTIES_ENV
@ -513,6 +516,7 @@ if ( queue == NULL ) {
<SECTION>":" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(PROPERTIES); return T_PSEP; }
<PROPERTIES>";" { BEGIN(GPOINTER_TO_INT ( g_queue_pop_head ( queue ))); return T_PCLOSE;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_ENV_VAR_CONTENT,MEDIA_ENV_VAR_DEFAULT>(true|false) { yylval->bval= g_strcmp0(yytext, "true") == 0; return T_BOOLEAN;}
<MEDIA_CONTENT>{DMENU} { yylval->bval = rofi_is_in_dmenu_mode; return T_BOOLEAN;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{NUMBER}\.{NUMBER} { yylval->fval = g_ascii_strtod(yytext, NULL); return T_DOUBLE;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{NUMBER} { yylval->ival = (int)g_ascii_strtoll(yytext, NULL, 10); return T_INT;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{UNARYMIN} { return T_MIN; }

View File

@ -151,7 +151,6 @@ config_h = configure_file(output: 'config.h', configuration: header_conf)
nk_options = [
'bindings=true',
'xdg-theme=true',
'git-work-tree=@0@'.format(meson.source_root()),
]
nk = subproject('libnkutils', default_options: nk_options)

View File

@ -170,7 +170,7 @@ These will be merged into the theme on load:
Now if we run it:
```bash
REVIEW=true rofi -theme fullscreen-preview.rasi -show filebrowser
PREVIEW=true rofi -theme fullscreen-preview.rasi -show filebrowser
```
It looks like this:

View File

@ -0,0 +1,324 @@
# 1.7.6: Traveling Time
## Recursive file browser
An experimental file browser is introduced in this version. This recursively scans through the
users home directory (this is configurable) to find files.
Its designed to be asynchronous and very fast.
The following settings can be configured:
css
configuration {
recursivebrowser {
/** Directory the file browser starts in. */
directory: "/some/directory";
/** return 1 on cancel. */
cancelreturns1: true;
/** filter entries using regex */
filterregex: "(.*cache.*|.*.o)";
/** command */
command: "xdgopen";
}
}
## Copy to clipboard support
Add support to copy current selected item to clipboard.
The added `control-c` binding copies the current selection to the clipboard.
THIS ONLY WORKS WITH CLIPBOARD MANAGER!!! Once rofi is closes, the data is
gone!
## entry box history
You can now recall and move through previous queries by using
`kb-entry-history-up` or 'kb-entry-history-down` keys. (`Control-Up`,
`Control-Down`).
The following settings can be configured:
css
configuration {
entry {
maxhistory: 30;
}
}
## Fix calc
There was a non-parsable grammar in the 'calc' part of the language.
The % operator (modulo) overloaded with percent and could leave to statements
having multiple valid but contradicting interpretations. To resolve this the modulo
operator is now `modulo`. Including in this patch several smaller issues with the
parser where fixed.
## Text outline
## Website
The current documentation is now also available on online at:
[https://davatorium.github.io/rofi/](https://davatorium.github.io/rofi/)
# Thanks to
Big thanks to everybody reporting issues.
Special thanks goes to:
* a1346054
* aloispichler
* Amith Mohanan
* Christian Friedow
* cognitiond
* David Kosorin
* Dimitris Triantafyllidis
* duarm
* Fabian Winter
* Gutyina Gergő
* Jasper Lievisse Adriaanse
* Jorge
* Martin Weinelt
* Morgane Glidic
* Naïm Favier
* Nikita Zlobin
* nomoo
* notuxic
* Rasmus Steinke
* Tim Pope
* TonCherAmi
* vE5li
* Yuta Katayama
* Danny Colin
Apologies if I mistyped or missed anybody.
# Changelog
* [Script] Update theme property clarification a bit.
* [Script] Add clarification to theme property.
* [Dmenu][Script] Add 'display' row option to override whats displayed.
* [DRun] Allow url field to be searched and fix c/p error (#1914)
* [DRUN] Add {url} to drun-display-format. (#1914)
* [lexer] Add dmenu as enabled option for media type. (#1903)
* [XCB] Make sure that window maker is 0 terminated before usage.
Thanks to Omar Polo and bsdmp
* Fix text color when `cursor-color` is set (#1901)
* [XCB] Try to be smarter with where mouse click started. (#1896)
* [View|Textbox] cleanups to drawing code
* Clip text with extents rectangle
Fonts are not ideal, some characters have mismatch between reported and
painted size.
* [Rofi] Expand cache-dir (#1892)
* Fix typos in dmenu docs (#1891)
* Support single quotes for strings as in CSS
* [Theme] Fix missing doxygen documentation
* [Theme] Fix opening abs path if no/wrong extension (backward comp.)
* [rofi-theme] fix typo
* [Theme] Try to fix importing of theme.
- Fix the two place of resolving into one method.
- Do not accept file in CWD.
- Prefer file if it exists in same directory as parent file that
imported it.
(#1889)
* script: Let script handle empty custom input
* widget_draw: clean useless calls in corner drawing
* Fix border segments stitch
* Fix mm type in description
* Remaining modi words in the code
* Better descriptions for sort options group
It's unobvious from documentation, that sort only works against filtered menu.
* update man pages without scripts
* [Lexer] Print some more debug info on error. (#1865)
* [Script] Set type on Mode object.
* [window] Quick test of code scanning.
* [ROFI] -e '-' reads from stdin
* [ConfigParser] Don't pass commandline options with very long args.
This is a quick 'n dirty fix for this unexpected issue.
(#1855)
* [Build] Fix autotools build system.
* [Doc] Fix some missing/wrong doxygen headers.
* Print window manager in -help output
* Merging in the Recursive file browser.
* Add wezterm to rofi-sensible-terminal (#1838)
* [DRun] Add option to scan desktop directory for desktop files.
* [IconFetcher] Fix small memory leak.
* Small memory leaks fixed and other cleanups.
* [MKDocs] Add logo
* [DMenu] Fix row initial tab if non-first column is shown first. (#1834)
* [Doc] Update theme manpage with remark-lint hints.
* [Doc] More small markdown fixes.
* [DOC] Update rofi-script update with remark-lint remarks.
* Remove unneeded test and extra enforcement of 0 terminated buffer
* [Doc] Update rofi.1.markdown with markdown fixes.
* [DOC] update readme.md with remark-lint updates..
* [DOC] Update INSTALL,md with remark-lint fixes.
* [DOC] Add some remark markdown fixes.
* Fix to pointless or's.
* [UnitTest] Add more tests for environment parsing.
* [Doc] Mention location of scripts in manpage.
* Re-indent the code using clang-format
* Fix typo in template.
* Update issue template to include checkbox for version.
* [Doc] Re-generate manpage
* docs: element children theming (#1818)
* Add support for adding textbox widgets to listview elements (#1792)
* [Textbox] cairo_save/restore does not store path.
Fix by moving cairo_move_to to after blink.
Also fix drawing outline.
* More Unicode normalization with `-normalize-match` (#1813)
Normalize the string to a fully decomposed form, then filter out mark/accent characters.
* #1802: Calc broken fix (#1803)
* [Theme] First move to double internal calculations.
* [Theme] Allow float numbers.
* [Theme] Fix unary - and tighten the grammar parser.
* [Theme] Rename % to modulo to fix compiler.
* [Theme] Dump right modulo syntax.
* [Test] add missing end_test
* [Grammar] Allow negative numbers as property value
* [Dmenu] Small fix that disabled async mode when multi-select is enabled.
* [View] Fix wrong bitmask checking. (& not |)
* [rofi-theme-selector] prepend newline before specifying new theme (#1791)
* [rofi-theme-selector] prepend newline before specifying new theme
If the EOF is not a newline, new theme setting will fail.
* make sed substitution more readable
* simplify sed substitution
* [MKDocs] Try to fix link.
* [MKDocs] Add downloads to side menu
* [MKDocs] Add a download page.
* [Script] Strip pango markup when matching rows (#1795)
* [Doc] theme, spelling fix and more textual tweaks.
* [Doc] More tweaks to get the formulation right.
* [Doc] themes manpage, small textual improvement.
* [Doc] Try to fix some markdown, themes.
* [Doc] Try to clarify the children situation for the listview widget.
* [EntryHistory] Disable entry history when dmenu password is set.
* I785 (#1789)
* [Textbox] Add history to the entrybox.
* [Textbox] Add comments and move into sub functions.
* [doc] Add conflicting constraint section to manpage.
* [Script] Some small memory leak fixes.
* [Entry History] Add documentation.
(#785)
* [doc] Add conflicting constraint section to manpage.
* [mkdoc] add link to user scripts
* [Textbox] Replace 'space' with a space (#1784)
* draw text after cursor (#1777)
* [Doc] Small tweak to markdown.
* [Example] Small change in escaping for caday.
* [Doc] Add manpage documentation for pango font string.
* [MKDocs] Add dynamic theme guide.
* [FileBrowser] Allow command to be overwritten
* [theme] Small theme tweak.
* [Theme] Add NO_IMAGE mode to theme.
* [Themes] add fullscreen theme with preview part.
* [window] When no window title set, handle this more gracefully
* [DMenu|Script] Add per row urgent/active option.
Instead of having a global list of entries to highlight urgent/active,
you can now to it per row.
* sed & realpath workaround for BSD and Darwin OS
* [filebrowser] Add option to return 1 on cancel. (#1732)
* [Theme] Small tweak to fancy2 theme
* [MKDocs] Link to rasi files in theme page.
* [Themes] Add fancy2 theme.
* [Themes] Add material theme
* Fix header theme
* [Helper] Quick fix for wrong dereference.
* MKDoc website (#1772)
* Add initial documentation page using mkdocs
* Test action
* Add notes to mkdoc site.
* Add installation guide
* Add installation and config guide to mkdocs.
* Add installation manual
* Add image to main page
* [mkdocs] Add plugin guide.
* [mkdocs] Add plugin to main page and some small fixes.
* Add shipped themes page
* [actions] Also rebuild website on the next branch
* [themes] don't use screenshot transparency in shipped themes
* [IconFetcher] Fix for api change
* [Theme] support rasinc for theme include files.
* [listview] Don't calculate infinite rows on empty height. (#1769)
* [Theme] Move some definitions header around for plugin.
* [Textbox] Cursor goes over, not under. allow cursor outline.
* [Textbox] Add text-outline to style
* [Doc] Clarify documentation on `require-input` further.
* make cursor more customizable by adding cursor-width and cursor-color (#1753)
* make cursor more customizable by adding cursor-width and cursor-color to the theme
* fix placeholder color
* add doc entry
* more documentation
* [XIM] Fix an unitialized value problem.
* [Doc] Add example run command with cgroup support (#1752)
* [Build] Fix test building in makefile.
* [Doc] Add documentation for new functions.
* [Doc] Fix some missing docu.
* [DMenu] Add -ellipsize-mode option.
* [listview] Set ellipsize mode on creation of textbox
So if rows are added, they behave correctily. (#1746)
* Disable imdkit by default
* Build documentation (#1744)
* explain how to pass options to meson
* fix typo in INSTALL.md
* [Build] Use built-in lto option.
* [Window] Fix reloading windowcd from xserver request
* [Build] Add option to build with lto to meson.
Fix error in test.
(#1743)
* [Build] Add option to disable imdkit at compile time. (#1742)
* input method (#1735)
* input method draft
* restoring relese event
* using unused macro, removing debug code, handling disconnection
* review fixes, new update_im_window_pos method
* initializing variables correctly
* initializing im pos queue correctly
* ime window positioning
* add widget_get_y_pos() position
* [Build] Update makefile with imdkit
* [CI] Add imdkit as dependency.
* [XCB] rofi_view_paste don't throw warning, print debug.
* [XCB] rofi_view_paste lower 'failed to convert selection'
* [Build] Add minimum version check to imdkit
* new macro XCB_IMDKIT_1_0_3_LOWER
* [Build] Try to support old version of imdkit in meson/makefile.
* [Build] Fix typo in meson.build
* [XIM] Don't set use compound/set use utf8 when on old version.
* [Build] Allow building without imdkit.
* [Doc] Add imdkit to dependency list.
* [Window] Make sure their is a trailing 0 on the workspace strings. (#1739)
* [FileBrowser] Bind kb-delete-entry to toggle show-hidden.
* [Textbox] Add a 'get_cursor_x_pos' function.
* [man] re-gen manpage.
* [DOC] Add parsing row options to dmenu manpage (#1734)
* [Build] Fix icon install path for makefile. (#1733)
* [Window] Small fixes to prefer-icon-theme option
Thanks to Kafva (https://github.com/Kafva) for the original patch.
(#1702)
* [Window] Add -window-prefer-icon-theme option. (#1702)
* [drun] Only pass path on launch, if one is set
* The mode is filebrowser (not file-browser) (#1723)
* [filebrowser] Add an option to show hidden files. (#1716)
* [Doc] Update rofi-keys manpage with unset section
* Add format option to disable padding with space the "window-format" entries (#1715)
* [Script] Split mode string only once on :, allowing : in right part. (#1718)
* [window] Check bitmask, not full comparison
* Use `command -v` instead of `which` (#1704)
* [Keyb] Add a -list-keybindings command.
* Fix sed binary call with variable (#1707)
* [listview] Add extra checks before resolving pointer. (#1703)
* [Textbox] Add 'placeholder-markup' flag. (#1690)
* [Test][Theme] Update test for downgrade error
* [Theme] If no theme loaded, load default. Downgrade missing theme file to warning. (#1689)
* [DMenu] reset variable correctly so keep-selection is initially off. (#1686)
* Update test for # keybindings.
* [View|Xcb] Add support to copy current selected item to clipboard (#378)
* Include sys/stat.h for S_IWUSR (#1685)
* [View] Tweak error message and instant/delayed switching.
* [View] Change refilter timeout limit to be in time units (ms) (#1683)
* [Combi] Fix possible memory leak.
* [combi] Fix selecting entry with only bang as input.
* [View] Increase default refilter-timeout-limit. (#1683)

View File

@ -448,7 +448,9 @@ gboolean parse_keys_abe(NkBindings *bindings) {
entry = strtok_r(NULL, sep, &sp)) {
if (!nk_bindings_add_binding(bindings, b->scope, entry,
binding_check_action, binding_trigger_action,
GUINT_TO_POINTER(b->id), NULL, &error)) {
GUINT_TO_POINTER(b->id), NULL,
NK_BINDINGS_ADD_FLAG_NONE,
&error)) {
if (error->code == NK_BINDINGS_ERROR_ALREADY_REGISTERED &&
error->domain == NK_BINDINGS_ERROR) {
char *str = g_markup_printf_escaped(
@ -485,7 +487,9 @@ gboolean parse_keys_abe(NkBindings *bindings) {
for (gsize j = 1; j < G_N_ELEMENTS(mouse_default_bindings); ++j) {
nk_bindings_add_binding(bindings, i, mouse_default_bindings[j],
binding_check_action, binding_trigger_action,
GSIZE_TO_POINTER(j), NULL, NULL);
GSIZE_TO_POINTER(j), NULL,
NK_BINDINGS_ADD_FLAG_NONE,
NULL);
}
}

View File

@ -169,6 +169,7 @@ static void read_add(DmenuModePrivateData *pd, char *data, gsize len) {
pd->cmd_list[pd->cmd_list_length].icon_fetch_size = 0;
pd->cmd_list[pd->cmd_list_length].icon_fetch_scale = 0;
pd->cmd_list[pd->cmd_list_length].icon_name = NULL;
pd->cmd_list[pd->cmd_list_length].display = NULL;
pd->cmd_list[pd->cmd_list_length].meta = NULL;
pd->cmd_list[pd->cmd_list_length].info = NULL;
pd->cmd_list[pd->cmd_list_length].active = FALSE;
@ -421,7 +422,11 @@ static char *dmenu_get_completion_data(const Mode *data, unsigned int index) {
Mode *sw = (Mode *)data;
DmenuModePrivateData *pd = (DmenuModePrivateData *)mode_get_private_data(sw);
DmenuScriptEntry *retv = (DmenuScriptEntry *)pd->cmd_list;
return dmenu_format_output_string(pd, retv[index].entry, index, FALSE);
if (retv[index].display) {
return dmenu_format_output_string(pd, retv[index].display, index, FALSE);
} else {
return dmenu_format_output_string(pd, retv[index].entry, index, FALSE);
}
}
static char *get_display_data(const Mode *data, unsigned int index, int *state,
@ -457,10 +462,16 @@ static char *get_display_data(const Mode *data, unsigned int index, int *state,
if (pd->cmd_list[index].active) {
*state |= ACTIVE;
}
char *my_retv =
(get_entry ? dmenu_format_output_string(pd, retv[index].entry, index,
pd->multi_select)
: NULL);
char *my_retv = NULL;
if (retv[index].display) {
my_retv = (get_entry ? dmenu_format_output_string(pd, retv[index].display,
index, pd->multi_select)
: NULL);
} else {
my_retv = (get_entry ? dmenu_format_output_string(pd, retv[index].entry,
index, pd->multi_select)
: NULL);
}
return my_retv;
}
@ -475,6 +486,7 @@ static void dmenu_mode_free(Mode *sw) {
if (pd->cmd_list[i].entry) {
g_free(pd->cmd_list[i].entry);
g_free(pd->cmd_list[i].icon_name);
g_free(pd->cmd_list[i].display);
g_free(pd->cmd_list[i].meta);
g_free(pd->cmd_list[i].info);
}

View File

@ -124,6 +124,8 @@ typedef struct {
char **keywords;
/* Comments */
char *comment;
/* Url */
char *url;
/* Underlying key-file. */
GKeyFile *key_file;
/* Used for sorting. */
@ -156,6 +158,8 @@ typedef enum {
DRUN_MATCH_FIELD_KEYWORDS,
/** Comment */
DRUN_MATCH_FIELD_COMMENT,
/** Url */
DRUN_MATCH_FIELD_URL,
/** Number of DRunMatchingFields entries. */
DRUN_MATCH_NUM_FIELDS,
} DRunMatchingFields;
@ -192,6 +196,11 @@ static DRunEntryField matching_entry_fields[DRUN_MATCH_NUM_FIELDS] = {
.entry_field_name = "comment",
.enabled_match = FALSE,
.enabled_display = FALSE,
},
{
.entry_field_name = "url",
.enabled_match = FALSE,
.enabled_display = FALSE,
}};
struct _DRunModePrivateData {
@ -685,6 +694,13 @@ static void read_desktop_file(DRunModePrivateData *pd, const char *root,
} else {
pd->entry_list[pd->cmd_list_length].comment = NULL;
}
if (matching_entry_fields[DRUN_MATCH_FIELD_URL].enabled_match ||
matching_entry_fields[DRUN_MATCH_FIELD_URL].enabled_display) {
pd->entry_list[pd->cmd_list_length].url =
g_key_file_get_locale_string(kf, DRUN_GROUP_NAME, "URL", NULL, NULL);
} else {
pd->entry_list[pd->cmd_list_length].url = NULL;
}
pd->entry_list[pd->cmd_list_length].icon_name =
g_key_file_get_locale_string(kf, DRUN_GROUP_NAME, "Icon", NULL, NULL);
pd->entry_list[pd->cmd_list_length].icon = NULL;
@ -832,7 +848,7 @@ static gint drun_int_sort_list(gconstpointer a, gconstpointer b,
*******************************************/
/** Version of the DRUN cache file format. */
#define CACHE_VERSION 2
#define CACHE_VERSION 3
static void drun_write_str(FILE *fd, const char *str) {
size_t l = (str == NULL ? 0 : strlen(str));
fwrite(&l, sizeof(l), 1, fd);
@ -923,6 +939,7 @@ static void write_cache(DRunModePrivateData *pd, const char *cache_file) {
drun_write_strv(fd, entry->keywords);
drun_write_str(fd, entry->comment);
drun_write_str(fd, entry->url);
drun_write_integer(fd, (int32_t)entry->type);
}
@ -1327,6 +1344,8 @@ static char *_get_display_value(const Mode *sw, unsigned int selected_line,
char *egn = NULL;
char *en = NULL;
char *ec = NULL;
char *ee = NULL;
char *eu = NULL;
if (dr->generic_name) {
egn = g_markup_escape_text(dr->generic_name, -1);
}
@ -1336,14 +1355,22 @@ static char *_get_display_value(const Mode *sw, unsigned int selected_line,
if (dr->comment) {
ec = g_markup_escape_text(dr->comment, -1);
}
if (dr->url) {
eu = g_markup_escape_text(dr->url, -1);
}
if (dr->exec) {
ee = g_markup_escape_text(dr->exec, -1);
}
char *retv = helper_string_replace_if_exists(
config.drun_display_format, "{generic}", egn, "{name}", en, "{comment}",
ec, "{exec}", dr->exec, "{categories}", cats, "{keywords}", keywords,
(char *)0);
ec, "{exec}", ee, "{categories}", cats, "{keywords}", keywords, "{url}",
eu, (char *)0);
g_free(egn);
g_free(en);
g_free(ec);
g_free(eu);
g_free(ee);
g_free(cats);
g_free(keywords);
return retv;
@ -1434,6 +1461,13 @@ static int drun_token_match(const Mode *data, rofi_int_matcher **tokens,
}
}
}
if (matching_entry_fields[DRUN_MATCH_FIELD_URL].enabled_match) {
// Match executable name.
if (test == tokens[j]->invert && rmpd->entry_list[index].url) {
test = helper_token_match(ftokens, rmpd->entry_list[index].url);
}
}
if (matching_entry_fields[DRUN_MATCH_FIELD_COMMENT].enabled_match) {
// Match executable name.

View File

@ -93,6 +93,8 @@ void dmenuscript_parse_entry_extras(G_GNUC_UNUSED Mode *sw,
*(extra + 1) = NULL;
if (strcasecmp(key, "icon") == 0) {
entry->icon_name = value;
} else if (strcasecmp(key, "display") == 0) {
entry->display = value;
} else if (strcasecmp(key, "meta") == 0) {
entry->meta = value;
} else if (strcasecmp(key, "info") == 0) {
@ -243,6 +245,7 @@ static DmenuScriptEntry *execute_executor(Mode *sw, char *arg,
retv[(*length)].entry = g_memdup(buffer, buf_length);
#endif
retv[(*length)].icon_name = NULL;
retv[(*length)].display = NULL;
retv[(*length)].meta = NULL;
retv[(*length)].info = NULL;
retv[(*length)].active = FALSE;
@ -357,6 +360,7 @@ static ModeMode script_mode_result(Mode *sw, int mretv, char **input,
for (unsigned int i = 0; i < rmpd->cmd_list_length; i++) {
g_free(rmpd->cmd_list[i].entry);
g_free(rmpd->cmd_list[i].icon_name);
g_free(rmpd->cmd_list[i].display);
g_free(rmpd->cmd_list[i].meta);
g_free(rmpd->cmd_list[i].info);
}
@ -388,6 +392,7 @@ static void script_mode_destroy(Mode *sw) {
for (unsigned int i = 0; i < rmpd->cmd_list_length; i++) {
g_free(rmpd->cmd_list[i].entry);
g_free(rmpd->cmd_list[i].icon_name);
g_free(rmpd->cmd_list[i].display);
g_free(rmpd->cmd_list[i].meta);
}
g_free(rmpd->cmd_list);
@ -439,7 +444,11 @@ static char *_get_display_value(const Mode *sw, unsigned int selected_line,
if (pd->do_markup) {
*state |= MARKUP;
}
return get_entry ? g_strdup(pd->cmd_list[selected_line].entry) : NULL;
if (pd->cmd_list[selected_line].display) {
return get_entry ? g_strdup(pd->cmd_list[selected_line].display) : NULL;
} else {
return get_entry ? g_strdup(pd->cmd_list[selected_line].entry) : NULL;
}
}
static int script_token_match(const Mode *sw, rofi_int_matcher **tokens,

View File

@ -366,7 +366,8 @@ static void rofi_icon_fetcher_worker(thread_state *sdata,
GdkPixbuf *pb =
gdk_pixbuf_new_from_file_at_scale(icon_path, width, height, TRUE, &error);
if (error != NULL) {
g_warning("Failed to load image: %s", error->message);
g_warning("Failed to load image: |%s| %d %d %s (%p)", icon_path,
sentry->wsize, sentry->hsize, error->message, pb);
g_error_free(error);
if (pb) {
g_object_unref(pb);
@ -419,6 +420,7 @@ uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize,
// Push into fetching queue.
sentry->state.callback = rofi_icon_fetcher_worker;
sentry->state.priority = G_PRIORITY_LOW;
g_thread_pool_push(tpool, sentry, NULL);
return sentry->uid;
@ -458,6 +460,7 @@ uint32_t rofi_icon_fetcher_query(const char *name, const int size) {
// Push into fetching queue.
sentry->state.callback = rofi_icon_fetcher_worker;
sentry->state.priority = G_PRIORITY_LOW;
g_thread_pool_push(tpool, sentry, NULL);
return sentry->uid;

View File

@ -136,7 +136,7 @@ NkBindings *bindings = NULL;
GMainLoop *main_loop = NULL;
/** Flag indicating we are in dmenu mode. */
static int dmenu_mode = FALSE;
int rofi_is_in_dmenu_mode = FALSE;
/** Rofi's return code */
int return_code = EXIT_SUCCESS;
@ -800,7 +800,7 @@ static gboolean startup(G_GNUC_UNUSED gpointer data) {
}
}
// Dmenu mode.
if (dmenu_mode == TRUE) {
if (rofi_is_in_dmenu_mode == TRUE) {
// force off sidebar mode:
config.sidebar_mode = FALSE;
int retv = dmenu_mode_dialog();
@ -947,14 +947,14 @@ int main(int argc, char *argv[]) {
// This has two possible causes.
// 1 the user specifies it on the command-line.
if (find_arg("-dmenu") >= 0) {
dmenu_mode = TRUE;
rofi_is_in_dmenu_mode = TRUE;
}
// 2 the binary that executed is called dmenu (e.g. symlink to rofi)
else {
// Get the base name of the executable called.
char *base_name = g_path_get_basename(argv[0]);
const char *const dmenu_str = "dmenu";
dmenu_mode = (strcmp(base_name, dmenu_str) == 0);
rofi_is_in_dmenu_mode = (strcmp(base_name, dmenu_str) == 0);
// Free the basename for dmenu detection.
g_free(base_name);
}
@ -1137,7 +1137,7 @@ int main(int argc, char *argv[]) {
/** dirty hack for dmenu compatibility */
char *windowid = NULL;
if (!dmenu_mode) {
if (!rofi_is_in_dmenu_mode) {
// setup_modes
if (setup_modes()) {
cleanup();

View File

@ -115,6 +115,76 @@ static int lev_sort(const void *p1, const void *p2, void *arg) {
return distances[*a] - distances[*b];
}
/**
* Stores a screenshot of Rofi at that point in time.
*/
void rofi_capture_screenshot(void) {
RofiViewState *state = current_active_menu;
if (state == NULL || state->main_window == NULL) {
g_warning("Nothing to screenshot.");
return;
}
const char *outp = g_getenv("ROFI_PNG_OUTPUT");
const char *xdg_pict_dir = g_get_user_special_dir(G_USER_DIRECTORY_PICTURES);
if (outp == NULL && xdg_pict_dir == NULL) {
g_warning("XDG user picture directory or ROFI_PNG_OUTPUT is not set. "
"Cannot store screenshot.");
return;
}
// Get current time.
GDateTime *now = g_date_time_new_now_local();
// Format filename.
char *timestmp = g_date_time_format(now, "rofi-%Y-%m-%d-%H%M");
char *filename = g_strdup_printf("%s-%05d.png", timestmp, 0);
// Build full path
char *fpath = NULL;
if (outp == NULL) {
int index = 0;
fpath = g_build_filename(xdg_pict_dir, filename, NULL);
while (g_file_test(fpath, G_FILE_TEST_EXISTS) && index < 99999) {
g_free(fpath);
g_free(filename);
// Try the next index.
index++;
// Format filename.
filename = g_strdup_printf("%s-%05d.png", timestmp, index);
// Build full path
fpath = g_build_filename(xdg_pict_dir, filename, NULL);
}
} else {
fpath = g_strdup(outp);
}
fprintf(stderr, color_green "Storing screenshot %s\n" color_reset, fpath);
cairo_surface_t *surf = cairo_image_surface_create(
CAIRO_FORMAT_ARGB32, state->width, state->height);
cairo_status_t status = cairo_surface_status(surf);
if (status != CAIRO_STATUS_SUCCESS) {
g_warning("Failed to produce screenshot '%s', got error: '%s'", fpath,
cairo_status_to_string(status));
} else {
cairo_t *draw = cairo_create(surf);
status = cairo_status(draw);
if (status != CAIRO_STATUS_SUCCESS) {
g_warning("Failed to produce screenshot '%s', got error: '%s'", fpath,
cairo_status_to_string(status));
} else {
widget_draw(WIDGET(state->main_window), draw);
status = cairo_surface_write_to_png(surf, fpath);
if (status != CAIRO_STATUS_SUCCESS) {
g_warning("Failed to produce screenshot '%s', got error: '%s'", fpath,
cairo_status_to_string(status));
}
}
cairo_destroy(draw);
}
// Cleanup
cairo_surface_destroy(surf);
g_free(fpath);
g_free(filename);
g_free(timestmp);
g_date_time_unref(now);
}
static void rofi_view_update_prompt(RofiViewState *state) {
if (state->prompt) {
const char *str = mode_get_display_name(state->sw);
@ -197,6 +267,13 @@ static void rofi_view_set_user_timeout(G_GNUC_UNUSED gpointer data) {
int delay = p->value.i;
CacheState.user_timeout =
g_timeout_add(delay * 1000, rofi_view_user_timeout, NULL);
} else {
Property *p = rofi_theme_find_property(wid, P_DOUBLE, "delay", TRUE);
if (p != NULL && p->type == P_DOUBLE && p->value.f > 0.01) {
double delay = p->value.f;
CacheState.user_timeout =
g_timeout_add(delay * 1000, rofi_view_user_timeout, NULL);
}
}
}
}
@ -693,6 +770,7 @@ static gboolean rofi_view_refilter_real(RofiViewState *state) {
states[i].plen = plen;
states[i].pattern = pattern;
states[i].st.callback = filter_elements;
states[i].st.priority = G_PRIORITY_HIGH;
if (i > 0) {
g_thread_pool_push(tpool, &states[i], NULL);
}
@ -1233,8 +1311,13 @@ void rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
case SCOPE_MOUSE_SCROLLBAR:
case SCOPE_MOUSE_MODE_SWITCHER: {
gint x = state->mouse.x, y = state->mouse.y;
widget *target = widget_find_mouse_target(WIDGET(state->main_window),
(WidgetType)scope, x, y);
// If we already captured a motion, always forward action to this widget.
widget *target = state->mouse.motion_target;
// If we have not a previous captured motion, lookup widget.
if (target == NULL) {
target = widget_find_mouse_target(WIDGET(state->main_window),
(WidgetType)scope, x, y);
}
if (target == NULL) {
return;
}
@ -1739,6 +1822,15 @@ int rofi_view_error_dialog(const char *msg, int markup) {
return TRUE;
}
static int rofi_thread_workers_sort(gconstpointer a,gconstpointer b, gpointer data G_GNUC_UNUSED)
{
thread_state *tsa = (thread_state *)a;
thread_state *tsb = (thread_state *)b;
// lower number is lower priority.. a is sorted above is a > b.
return tsa->priority-tsb->priority;
}
void rofi_view_workers_initialize(void) {
TICK_N("Setup Threadpool, start");
if (config.threads == 0) {
@ -1764,6 +1856,7 @@ void rofi_view_workers_initialize(void) {
g_error_free(error);
exit(EXIT_FAILURE);
}
g_thread_pool_set_sort_function(tpool, rofi_thread_workers_sort, NULL);
TICK_N("Setup Threadpool, done");
}
void rofi_view_workers_finalize(void) {
@ -1824,7 +1917,7 @@ void rofi_view_switch_mode(RofiViewState *state, Mode *mode) {
rofi_view_restart(state);
state->reload = TRUE;
state->refilter = TRUE;
rofi_view_refilter(state);
rofi_view_refilter_force(state);
rofi_view_update(state, TRUE);
}
@ -1889,8 +1982,6 @@ void rofi_view_get_current_monitor(int *width, int *height) {
proxy->get_current_monitor(width, height);
}
void rofi_capture_screenshot(void) { proxy->capture_screenshot(); }
void rofi_view_set_size(RofiViewState *state, gint width, gint height) {
proxy->set_size(state, width, height);
}

View File

@ -96,6 +96,7 @@ static int box_get_desired_height(widget *wid, const int width) {
box *b = (box *)wid;
int spacing = distance_get_pixel(b->spacing, b->type);
int height = 0;
int nw = width - widget_padding_get_padding_width(wid);
if (b->type == ROFI_ORIENTATION_VERTICAL) {
int active_widgets = 0;
for (GList *iter = g_list_first(b->children); iter != NULL;
@ -105,7 +106,7 @@ static int box_get_desired_height(widget *wid, const int width) {
continue;
}
active_widgets++;
height += widget_get_desired_height(child, width);
height += widget_get_desired_height(child, nw);
}
if (active_widgets > 0) {
height += (active_widgets - 1) * spacing;
@ -117,7 +118,7 @@ static int box_get_desired_height(widget *wid, const int width) {
if (!child->enabled) {
continue;
}
height = MAX(widget_get_desired_height(child, width), height);
height = MAX(widget_get_desired_height(child, nw), height);
}
}
height += widget_padding_get_padding_height(wid);

View File

@ -539,6 +539,9 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
tb->cursor_x_pos = x + cursor_x;
}
if (tb->blink) {
// This save/restore state is necessary to render the text in the
// correct color when `cursor-color` is set
cairo_save(draw);
// use text color as fallback for themes that don't specify the cursor
// color
rofi_theme_get_color(WIDGET(tb), "cursor-color", draw);
@ -554,6 +557,7 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
} else {
cairo_fill(draw);
}
cairo_restore(draw);
}
}

View File

@ -1263,9 +1263,6 @@ static void main_loop_x11_event_handler_view(xcb_generic_event_t *event) {
case XCB_MOTION_NOTIFY: {
xcb_motion_notify_event_t *xme = (xcb_motion_notify_event_t *)event;
gboolean button_mask = xme->state & XCB_EVENT_MASK_BUTTON_1_MOTION;
if (button_mask && config.click_to_exit == TRUE) {
xcb->mouse_seen = TRUE;
}
rofi_view_handle_mouse_motion(state, xme->event_x, xme->event_y,
!button_mask && config.hover_select);
break;
@ -1284,6 +1281,7 @@ static void main_loop_x11_event_handler_view(xcb_generic_event_t *event) {
} else if (x11_button_to_nk_bindings_scroll(bpe->detail, &axis, &steps)) {
nk_bindings_seat_handle_scroll(xcb->bindings_seat, NULL, axis, steps);
}
xcb->mouse_seen++;
break;
}
case XCB_SELECTION_CLEAR: {
@ -1346,7 +1344,7 @@ static void main_loop_x11_event_handler_view(xcb_generic_event_t *event) {
if (!xcb->mouse_seen) {
rofi_view_temp_click_to_exit(state, bre->event);
}
xcb->mouse_seen = FALSE;
xcb->mouse_seen--;
}
break;
}
@ -1618,7 +1616,7 @@ char *x11_helper_get_window_manager(void) {
xcb_ewmh_get_wm_name_unchecked(&(xcb->ewmh), wm_win);
if (xcb_ewmh_get_wm_name_reply(&(xcb->ewmh), cookie, &wtitle, (void *)0)) {
if (wtitle.strings_len > 0) {
retv = g_strdup(wtitle.strings);
retv = g_strndup(wtitle.strings, wtitle.strings_len);
}
xcb_ewmh_get_utf8_strings_reply_wipe(&wtitle);
}
@ -1637,13 +1635,16 @@ static void x11_helper_discover_window_manager(void) {
xcb_ewmh_get_wm_name_unchecked(&(xcb->ewmh), wm_win);
if (xcb_ewmh_get_wm_name_reply(&(xcb->ewmh), cookie, &wtitle, (void *)0)) {
if (wtitle.strings_len > 0) {
g_debug("Found window manager: |%s|", wtitle.strings);
if (g_strcmp0(wtitle.strings, "i3") == 0) {
// Copy the string and add terminating '\0'.
char *str = g_strndup(wtitle.strings, wtitle.strings_len);
g_debug("Found window manager: |%s|", str);
if (g_strcmp0(str, "i3") == 0) {
current_window_manager =
WM_DO_NOT_CHANGE_CURRENT_DESKTOP | WM_PANGO_WORKSPACE_NAMES;
} else if (g_strcmp0(wtitle.strings, "bspwm") == 0) {
} else if (g_strcmp0(str, "bspwm") == 0) {
current_window_manager = WM_ROOT_WINDOW_OFFSET;
}
g_free(str);
}
xcb_ewmh_get_utf8_strings_reply_wipe(&wtitle);
}

@ -1 +1 @@
Subproject commit 09ca429c08530ddb50ba1029f98ca14da7b0b7fa
Subproject commit 72bd7fb07f627a864e724639eea9fab6cccbd77c

View File

@ -42,6 +42,7 @@
#include <widgets/widget-internal.h>
#include <widgets/widget.h>
unsigned int test = 0;
int rofi_is_in_dmenu_mode = 0;
#define TASSERT(a) \
{ \
assert(a); \

View File

@ -60,6 +60,7 @@ unsigned int test = 0;
} \
}
int rofi_is_in_dmenu_mode = 0;
ThemeWidget *rofi_configuration = NULL;
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,

View File

@ -47,6 +47,7 @@
#include "rofi-icon-fetcher.h"
static int test = 0;
unsigned int normal_window_mode = 0;
int rofi_is_in_dmenu_mode = 0;
#define TASSERT(a) \
{ \

View File

@ -44,6 +44,8 @@
#define REAL_COMPARE_DELTA 0.001
int rofi_is_in_dmenu_mode = 0;
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
G_GNUC_UNUSED const int size) {
return 0;

View File

@ -39,6 +39,7 @@
#include <widgets/widget-internal.h>
#include <widgets/widget.h>
unsigned int test = 0;
int rofi_is_in_dmenu_mode = 0;
#define TASSERT(a) \
{ \
assert(a); \