Merge tag '1.7.9' into wayland

This commit is contained in:
lbonn
2025-05-18 20:03:28 +02:00
33 changed files with 4707 additions and 128 deletions

View File

@@ -2,6 +2,8 @@ image: ubuntu/lts
packages:
- meson
- ninja-build
- autoconf
- automake
- build-essential
- libpango1.0-dev
- libstartup-notification0-dev
@@ -13,10 +15,14 @@ packages:
- libxcb-xkb-dev
- libxcb-xrm-dev
- libxcb-cursor-dev
- libxcb-imdkit-dev
- libxcb-keysyms1
- libxkbcommon-dev
- libxkbcommon-dev
- libxkbcommon-x11-dev
- libgdk-pixbuf2.0-dev
- ninja-build
- pandoc
- check
- flex
- bison
@@ -38,4 +44,4 @@ tasks:
- dist: |
ninja -C rofi/builddir dist
artifacts:
- rofi/builddir/meson-dist/rofi-1.7.5-dev.tar.xz
- rofi/builddir/meson-dist/rofi-1.7.8-dev.tar.xz

View File

@@ -128,6 +128,8 @@ Settings config = {
.drun_match_fields = "name,generic,exec,categories,keywords",
/** Only show entries in this category */
.drun_categories = NULL,
/** Exclude entries in this category */
.drun_exclude_categories = NULL,
/** Desktop entry show actions */
.drun_show_actions = FALSE,
/** Desktop format display */
@@ -178,4 +180,6 @@ Settings config = {
.xserver_i300_workaround = FALSE,
/** What browser to use for completion */
.completer_mode = "filebrowser",
/** Whether to enable imdkit, see #2123 */
.enable_imdkit = TRUE,
};

View File

@@ -1,4 +1,4 @@
AC_INIT([rofi], [1.7.8-dev], [https://github.com/davatorium/rofi/],[],[https://github.com/davatorium/rofi/discussions])
AC_INIT([rofi], [1.7.9], [https://github.com/davatorium/rofi/],[],[https://github.com/davatorium/rofi/discussions])
AC_CONFIG_SRCDIR([source/rofi.c])
AC_CONFIG_HEADER([config.h])

View File

@@ -132,18 +132,18 @@ element-text {
└─────────────────────────────────────────────────────────────────────┘
```
We can also specify the color and width of the cursor. You could, for example,
create a crimson block cursor like this:
We can also customize the cursor's color, width, and choose to hide it when the input box is empty. You could, for example, create a crimson block cursor that only appears when text is entered, like this:
```css
entry {
cursor-color: rgb(220,20,60);
cursor-width: 8px;
hide-cursor-on-empty: true;
}
```
By default, the `cursor-color` will be the same as the `text-color`. The
`cursor-width` will always default to 2 pixels.
`cursor-width` will always default to 2 pixels and `hide-cursor-on-empty` is set to false.
If you want to see the complete theme, including the modification you can run:
@@ -964,6 +964,11 @@ The following properties are currently supported:
- **border-radius**: padding
Sets a radius on the corners of the borders.
- border-aa: boolean
Disable aliasing on the border line. Disabling fixes some drawing issues because of nvidia broken driver workaround.
- border-disable-nvidia-workaround: boolean
Disable work-around for nvidia driver breaking.
- **background-color**: color
Background color
@@ -1011,6 +1016,7 @@ The following properties are currently supported:
- **handle-width**: distance
- **handle-color**: color
- **border-color**: color
- **handle-rounded-corners**: boolean for rounded scrollbar
### box
@@ -1068,6 +1074,9 @@ The following properties are currently supported:
- **cursor-color**: The color used to draw the cursor.
- **hide-cursor-on-empty**: Hides the cursor when the search field is empty.
(Boolean)
- **cursor-outline**: Enable a border (outline) around the cursor.
(Boolean)

View File

@@ -374,6 +374,10 @@ Tokenize the input.
Only show desktop files that are present in the listed categories.
`-drun-exclude-categories` *category1*,*category2*
Exclude desktop files that are present in the listed categories.
`-drun-match-fields` *field1*,*field2*,...
When using `drun`, match only with the specified Desktop entry fields.

View File

@@ -455,6 +455,19 @@ void helper_select_next_matching_mode(void);
* Switch to the previous matching method.
*/
void helper_select_previous_matching_mode(void);
/**
* Method to indicate fallthrough. This will help
* gcc/llvm warning/static code analysis.
*/
#if __has_attribute(__fallthrough__)
#define rofi_fallthrough __attribute__((__fallthrough__))
#else
#define rofi_fallthrough \
do { \
} while (0) /* fallthrough */
#endif
G_END_DECLS
/**@} */

View File

@@ -127,6 +127,8 @@ typedef struct {
char *drun_match_fields;
/** Only show entries in this category */
char *drun_categories;
/** Exclude entries in this category */
char *drun_exclude_categories;
/** Desktop entry show actions */
unsigned int drun_show_actions;
/** Desktop format display */
@@ -215,6 +217,8 @@ typedef struct {
gboolean xserver_i300_workaround;
/** completer mode */
char *completer_mode;
/** Whether to enable imdkit, see #2123 */
gboolean enable_imdkit;
} Settings;
/** Default number of lines in the list view */

View File

@@ -83,6 +83,12 @@ struct _widget {
gboolean expand;
/** Place widget at end of parent */
gboolean end;
/** enable/disable border aliasing. */
gboolean border_antialiasing;
/** enable/disable nvisia workaround. */
gboolean border_disable_nvidia_workaround;
/** Parent widget */
struct _widget *parent;
/** Internal */

View File

@@ -193,7 +193,7 @@ cairo_surface_t *x11_helper_get_screenshot_surface_window(xcb_window_t window,
*
* Blur the content of the surface with radius and deviation.
*/
void cairo_image_surface_blur(cairo_surface_t *surface, double radius,
void cairo_image_surface_blur(cairo_surface_t *surface, int radius,
double deviation);
#ifdef XCB_IMDKIT

View File

@@ -0,0 +1,89 @@
# rofi-actions(5)
## NAME
**rofi-actions** - Custom commands following interaction with rofi menus
## DESCRIPTION
**rofi** allows to set custom commands or scripts to be executed when some actions are performed in the menu, such as changing selection, accepting an entry or canceling.
This makes it possible for example to play sound effects or read aloud menu entries on selection.
## USAGE
Following is the list of rofi flags for specifying custom commands or scripts to execute on supported actions:
`-on-selection-changed` *cmd*
Command or script to run when the current selection changes. Selected text is forwarded to the command replacing the pattern *{entry}*.
`-on-entry-accepted` *cmd*
Command or script to run when a menu entry is accepted. Accepted text is forwarded to the command replacing the pattern *{entry}*.
`-on-mode-changed` *cmd*
Command or script to run when the menu mode (e.g. drun,window,ssh...) is changed.
`-on-menu-canceled` *cmd*
Command or script to run when the menu is canceled.
`-on-menu-error` *cmd*
Command or script to run when an error menu is shown (e.g. `rofi -e "error message"`). Error text is forwarded to the command replacing the pattern *{error}*.
`-on-screenshot-taken` *cmd*
Command or script to run when a screenshot of rofi is taken. Screenshot path is forwarded to the command replacing the pattern *{path}*.
### Example usage
Rofi command line:
```bash
rofi -on-selection-changed "/path/to/select.sh {entry}" \
-on-entry-accepted "/path/to/accept.sh {entry}" \
-on-menu-canceled "/path/to/exit.sh" \
-on-mode-changed "/path/to/change.sh" \
-on-menu-error "/path/to/error.sh {error}" \
-on-screenshot-taken "/path/to/camera.sh {path}" \
-show drun
```
Rofi config file:
```css
configuration {
on-selection-changed: "/path/to/select.sh {entry}";
on-entry-accepted: "/path/to/accept.sh {entry}";
on-menu-canceled: "/path/to/exit.sh";
on-mode-changed: "/path/to/change.sh";
on-menu-error: "/path/to/error.sh {error}";
on-screenshot-taken: "/path/to/camera.sh {path}";
}
```
### Play sound effects
Here's an example bash script that plays a sound effect using `aplay` when the current selection is changed:
```bash
#!/bin/bash
coproc aplay -q $HOME/Music/selecting_an_item.wav
```
The use of `coproc` for playing sounds is suggested, otherwise the rofi process will wait for sounds to end playback before exiting.
### Read aloud
Here's an example bash script that reads aloud currently selected entries using `espeak`:
```bash
#!/bin/bash
killall espeak
echo "selected: $@" | espeak
```

View File

@@ -0,0 +1,177 @@
# rofi-debugging(5)
## NAME
Debugging rofi.
When reporting an issue with rofi crashing, or misbehaving. It helps to do some
small test to help pin-point the problem.
First try disabling your custom configuration: `-no-config`
This disables the parsing of the configuration files. This runs rofi in *stock*
mode.
If you run custom C plugins, you can disable the plugins using: `-no-plugins`
## Get the relevant information for an issue
Please pastebin the output of the following commands:
```bash
rofi -help
rofi -dump-config
rofi -dump-theme
```
`rofi -help` provides us with the configuration files parsed, the exact
version, monitor layout and more useful information.
The `rofi -dump-config` and `rofi -dump-theme` output gives us `rofi`
interpretation of your configuration and theme.
Please check the output for identifiable information and remove this.
## Timing traces
To get a timing trace, enable the **Timings** debug domain.
```bash
G_MESSAGES_DEBUG=Timings rofi -show drun
```
It will show a trace with (useful) timing information at relevant points during
the execution. This will help debugging when rofi is slow to start.
Example trace:
```text
(process:14942): Timings-DEBUG: 13:47:39.335: 0.000000 (0.000000): Started
(process:14942): Timings-DEBUG: 13:47:39.335: 0.000126 (0.000126): ../source/rofi.c:main:786
(process:14942): Timings-DEBUG: 13:47:39.335: 0.000163 (0.000037): ../source/rofi.c:main:819
(process:14942): Timings-DEBUG: 13:47:39.336: 0.000219 (0.000056): ../source/rofi.c:main:826 Setup Locale
(process:14942): Timings-DEBUG: 13:47:39.337: 0.001235 (0.001016): ../source/rofi.c:main:828 Collect MODI
(process:14942): Timings-DEBUG: 13:47:39.337: 0.001264 (0.000029): ../source/rofi.c:main:830 Setup MODI
(process:14942): Timings-DEBUG: 13:47:39.337: 0.001283 (0.000019): ../source/rofi.c:main:834 Setup mainloop
(process:14942): Timings-DEBUG: 13:47:39.337: 0.001369 (0.000086): ../source/rofi.c:main:837 NK Bindings
(process:14942): Timings-DEBUG: 13:47:39.337: 0.001512 (0.000143): ../source/xcb.c:display_setup:1177 Open Display
(process:14942): Timings-DEBUG: 13:47:39.337: 0.001829 (0.000317): ../source/xcb.c:display_setup:1192 Setup XCB
(process:14942): Timings-DEBUG: 13:47:39.346: 0.010650 (0.008821): ../source/rofi.c:main:844 Setup Display
(process:14942): Timings-DEBUG: 13:47:39.346: 0.010715 (0.000065): ../source/rofi.c:main:848 Setup abe
(process:14942): Timings-DEBUG: 13:47:39.350: 0.015101 (0.004386): ../source/rofi.c:main:883 Load cmd config
(process:14942): Timings-DEBUG: 13:47:39.351: 0.015275 (0.000174): ../source/rofi.c:main:907 Setup Modi
(process:14942): Timings-DEBUG: 13:47:39.351: 0.015291 (0.000016): ../source/view.c:rofi_view_workers_initialize:1922 Setup Threadpool, start
(process:14942): Timings-DEBUG: 13:47:39.351: 0.015349 (0.000058): ../source/view.c:rofi_view_workers_initialize:1945 Setup Threadpool, done
(process:14942): Timings-DEBUG: 13:47:39.367: 0.032018 (0.016669): ../source/rofi.c:main:1000 Setup late Display
(process:14942): Timings-DEBUG: 13:47:39.367: 0.032080 (0.000062): ../source/rofi.c:main:1003 Theme setup
(process:14942): Timings-DEBUG: 13:47:39.367: 0.032109 (0.000029): ../source/rofi.c:startup:668 Startup
(process:14942): Timings-DEBUG: 13:47:39.367: 0.032121 (0.000012): ../source/rofi.c:startup:677 Grab keyboard
(process:14942): Timings-DEBUG: 13:47:39.368: 0.032214 (0.000093): ../source/view.c:__create_window:701 xcb create window
(process:14942): Timings-DEBUG: 13:47:39.368: 0.032235 (0.000021): ../source/view.c:__create_window:705 xcb create gc
(process:14942): Timings-DEBUG: 13:47:39.368: 0.033136 (0.000901): ../source/view.c:__create_window:714 create cairo surface
(process:14942): Timings-DEBUG: 13:47:39.369: 0.033286 (0.000150): ../source/view.c:__create_window:723 pango cairo font setup
(process:14942): Timings-DEBUG: 13:47:39.369: 0.033351 (0.000065): ../source/view.c:__create_window:761 configure font
(process:14942): Timings-DEBUG: 13:47:39.381: 0.045896 (0.012545): ../source/view.c:__create_window:769 textbox setup
(process:14942): Timings-DEBUG: 13:47:39.381: 0.045944 (0.000048): ../source/view.c:__create_window:781 setup window attributes
(process:14942): Timings-DEBUG: 13:47:39.381: 0.045955 (0.000011): ../source/view.c:__create_window:791 setup window fullscreen
(process:14942): Timings-DEBUG: 13:47:39.381: 0.045966 (0.000011): ../source/view.c:__create_window:797 setup window name and class
(process:14942): Timings-DEBUG: 13:47:39.381: 0.045974 (0.000008): ../source/view.c:__create_window:808 setup startup notification
(process:14942): Timings-DEBUG: 13:47:39.381: 0.045981 (0.000007): ../source/view.c:__create_window:810 done
(process:14942): Timings-DEBUG: 13:47:39.381: 0.045992 (0.000011): ../source/rofi.c:startup:679 Create Window
(process:14942): Timings-DEBUG: 13:47:39.381: 0.045999 (0.000007): ../source/rofi.c:startup:681 Parse ABE
(process:14942): Timings-DEBUG: 13:47:39.381: 0.046113 (0.000114): ../source/rofi.c:startup:684 Config sanity check
(process:14942): Timings-DEBUG: 13:47:39.384: 0.048229 (0.002116): ../source/dialogs/run.c:get_apps:216 start
(process:14942): Timings-DEBUG: 13:47:39.390: 0.054626 (0.006397): ../source/dialogs/run.c:get_apps:336 stop
(process:14942): Timings-DEBUG: 13:47:39.390: 0.054781 (0.000155): ../source/dialogs/drun.c:get_apps:634 Get Desktop apps (start)
(process:14942): Timings-DEBUG: 13:47:39.391: 0.055264 (0.000483): ../source/dialogs/drun.c:get_apps:641 Get Desktop apps (user dir)
(process:14942): Timings-DEBUG: 13:47:39.418: 0.082884 (0.027620): ../source/dialogs/drun.c:get_apps:659 Get Desktop apps (system dirs)
(process:14942): Timings-DEBUG: 13:47:39.418: 0.082944 (0.000060): ../source/dialogs/drun.c:get_apps_history:597 Start drun history
(process:14942): Timings-DEBUG: 13:47:39.418: 0.082977 (0.000033): ../source/dialogs/drun.c:get_apps_history:617 Stop drun history
(process:14942): Timings-DEBUG: 13:47:39.419: 0.083638 (0.000661): ../source/dialogs/drun.c:get_apps:664 Sorting done.
(process:14942): Timings-DEBUG: 13:47:39.419: 0.083685 (0.000047): ../source/view.c:rofi_view_create:1759
(process:14942): Timings-DEBUG: 13:47:39.419: 0.083700 (0.000015): ../source/view.c:rofi_view_create:1783 Startup notification
(process:14942): Timings-DEBUG: 13:47:39.419: 0.083711 (0.000011): ../source/view.c:rofi_view_create:1786 Get active monitor
(process:14942): Timings-DEBUG: 13:47:39.420: 0.084693 (0.000982): ../source/view.c:rofi_view_refilter:1028 Filter start
(process:14942): Timings-DEBUG: 13:47:39.421: 0.085992 (0.001299): ../source/view.c:rofi_view_refilter:1132 Filter done
(process:14942): Timings-DEBUG: 13:47:39.421: 0.086090 (0.000098): ../source/view.c:rofi_view_update:982
(process:14942): Timings-DEBUG: 13:47:39.421: 0.086123 (0.000033): ../source/view.c:rofi_view_update:1002 Background
(process:14942): Timings-DEBUG: 13:47:39.428: 0.092864 (0.006741): ../source/view.c:rofi_view_update:1008 widgets
```
## Debug domains
To further debug the plugin, you can get a trace with (lots of) debug
information. This debug output can be enabled for multiple parts in rofi using
the glib debug framework. Debug domains can be enabled by setting the
G\_MESSAGES\_DEBUG environment variable. At the time of creation of this page,
the following debug domains exist:
- all: Show debug information from all domains.
- X11Helper: The X11 Helper functions.
- View: The main window view functions.
- Widgets.Box: The Box widget.
- Modes.DMenu: The dmenu mode.
- Modes.Run: The run mode.
- Modes.DRun: The desktop file run mode.
- Modes.Window: The window mode.
- Modes.Script: The script mode.
- Modes.Combi: The script mode.
- Modes.Ssh: The ssh mode.
- Rofi: The main application.
- Timings: Get timing output.
- Theme: Theme engine debug output. (warning lots of output).
- Widgets.Icon: The Icon widget.
- Widgets.Box: The box widget.
- Widgets.Container: The container widget.
- Widgets.Window: The window widget.
- Helpers.IconFetcher: Information about icon lookup.
For full list see `man rofi`.
Example: `G_MESSAGES_DEBUG=Dialogs.DRun rofi -show drun` To get specific output
from the Desktop file run dialog.
To redirect the debug output to a file (`~/rofi.log`) add:
```bash
rofi -show drun -log ~/rofi.log
```
Specifying the logfile automatically enabled all log domains.
This can be useful when rofi is launched from a window manager.
## Creating a backtrace
First make sure you compile **rofi** with debug symbols:
```bash
make CFLAGS="-O0 -g3" clean rofi
```
Getting a backtrace using GDB is not very handy. Because if rofi get stuck, it
grabs keyboard and mouse. So if it crashes in GDB you are stuck. The best way
to go is to enable core file. (ulimit -c unlimited in bash) then make rofi
crash. You can then load the core in GDB.
```bash
gdb rofi core
```
Then type inside gdb:
```bash
thread apply all bt
```
The output trace is useful when reporting crashes.
Some distribution have `systemd-coredump`, this way you can easily get a
backtrace via `coredumpctl`.
## SEE ALSO
rofi-sensible-terminal(1), dmenu(1), rofi-theme(5),
rofi-script(5), rofi-keys(5),rofi-theme-selector(1)
## AUTHOR
* Qball Cow <qball@blame.services>

View File

@@ -0,0 +1,245 @@
# rofi-dmenu(5)
## NAME
**rofi dmenu mode** - Rofi dmenu emulation
## DESCRIPTION
To integrate **rofi** into scripts as simple selection dialogs,
**rofi** supports emulating **dmenu(1)** (A dynamic menu for X11).
The website for `dmenu` can be found [here](http://tools.suckless.org/dmenu/).
**rofi** does not aim to be 100% compatible with `dmenu`. There are simply too
many flavors of `dmenu`. The idea is that the basic usage command-line flags
are obeyed, theme-related flags are not. Besides, **rofi** offers some extended
features (like multi-select, highlighting, message bar, extra key bindings).
## BASIC CONCEPT
In `dmenu` mode, **rofi** reads data from standard in, splits them into
separate entries and displays them. If the user selects a row, this is printed
out to standard out, allowing the script to process it further.
By default separation of rows is done on new lines, making it easy to pipe the
output a one application into **rofi** and the output of rofi into the next.
## USAGE
By launching **rofi** with the `-dmenu` flag it will go into dmenu emulation
mode.
```bash
ls | rofi -dmenu
```
### DMENU DROP-IN REPLACEMENT
If `argv[0]` (calling command) is dmenu, **rofi** will start in dmenu mode.
This way, it can be used as a drop-in replacement for dmenu. Just copy or
symlink **rofi** to dmenu in `$PATH`.
```bash
ln -s /usr/bin/rofi /usr/bin/dmenu
```
### DMENU VS SCRIPT MODE
Script mode is used to extend **rofi**, dmenu mode is used to extend a script.
The two do share much of the same input format. Please see the
**rofi-script(5)** manpage for more information.
### DMENU SPECIFIC COMMANDLINE FLAGS
A lot of these options can also be modified by the script using special input.
See the **rofi-script(5)** manpage for more information about this syntax.
`-sep` *separator*
Separator for `dmenu`. Example: To show a list of 'a' to 'e' with '|' as a
separator:
```bash
echo "a|b|c|d|e" | rofi -sep '|' -dmenu
```
`-p` *prompt*
Specify the prompt to show in `dmenu` mode. For example, select 'monkey',
a,b,c,d, or e.
```bash
echo "a|b|c|d|e" | rofi -sep '|' -dmenu -p "monkey"
```
Default: *dmenu*
`-l` *number of lines to show*
Maximum number of lines the menu may show before scrolling.
```bash
rofi -dmenu -l 25
```
Default: *15*
`-i`
Makes `dmenu` searches case-insensitive
`-a` *X*
Active row, mark *X* as active. Where *X* is a comma-separated list of
python(1)-style indices and ranges, e.g. indices start at 0, -1 refers to the
last row with -2 preceding it, ranges are left-open and right-close, and so on.
You can specify:
- A single row: '5'
- A range of (last 3) rows: '-3:'
- 4 rows starting from row 7: '7:11' (or in legacy notation: '7-10')
- A set of rows: '2,0,-9'
- Or any combination: '5,-3:,7:11,2,0,-9'
`-u` *X*
Urgent row, mark *X* as urgent. See `-a` option for details.
`-only-match`
Only return a selected item, do not allow custom entry.
This mode always returns an entry. It will not return if no matching entry is
selected.
`-no-custom`
Only return a selected item, do not allow custom entry.
This mode returns directly when no entries given.
`-format` *format*
Allows the output of dmenu to be customized (N is the total number of input
entries):
- 's' selected string
- 'i' index (0 - (N-1))
- 'd' index (1 - N)
- 'q' quote string
- 'p' Selected string stripped from Pango markup (Needs to be a valid string)
- 'f' filter string (user input)
- 'F' quoted filter string (user input)
Default: 's'
`-select` *string*
Select first line that matches the given string
`-mesg` *string*
Add a message line below the filter entry box. Supports Pango markup. For more
information on supported markup, see
[here](https://docs.gtk.org/Pango/pango_markup.html)
`-dump`
Dump the filtered list to stdout and quit.
This can be used to get the list as **rofi** would filter it.
Use together with `-filter` command.
`-input` *file*
Reads from *file* instead of stdin.
`-password`
Hide the input text. This should not be considered secure!
`-markup-rows`
Tell **rofi** that DMenu input is Pango markup encoded, and should be rendered.
See [here](https://docs.gtk.org/Pango/pango_markup.html)
for details about Pango markup.
`-multi-select`
Allow multiple lines to be selected. Adds a small selection indicator to the
left of each entry.
`-sync`
Force **rofi** mode to first read all data from stdin before showing the
selection window. This is original dmenu behavior.
Note: the default asynchronous mode will also be automatically disabled if used
with conflicting options,
such as `-dump`, `-only-match` or `-auto-select`.
`-window-title` *title*
Set name used for the window title. Will be shown as Rofi - *title*
`-w` *windowid*
Position **rofi** over the window with the given X11 window ID.
`-keep-right`
Set ellipsize mode to start. So, the end of the string is visible.
`-display-columns`
A comma seperated list of columns to show.
`-display-column-separator`
The column separator. This is a regex.
*default*: '\t'
`-ballot-selected-str` *string*
When multi-select is enabled, prefix this string when element is selected.
*default*: "☑ "
`-ballot-unselected-str` *string*
When multi-select is enabled, prefix this string when element is not selected.
*default*: "☐ "
`-ellipsize-mode` (start|middle|end)
Set ellipsize mode on the listview.
*default* "end"
## PARSING ROW OPTIONS
Extra options for individual rows can be also set. See the **rofi-script(5)**
manpage for details; the syntax and supported features are identical.
## RETURN VALUE
- **0**: Row has been selected accepted by user.
- **1**: User cancelled the selection.
- **10-28**: Row accepted by custom keybinding.
## SEE ALSO
rofi(1), rofi-sensible-terminal(1), dmenu(1), rofi-theme(5), rofi-script(5),
rofi-theme-selector(1), ascii(7)
## AUTHOR
Qball Cow <qball@gmpclient.org>
Rasmus Steinke <rasi@xssn.at>
Morgane 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

@@ -0,0 +1,588 @@
# rofi-keys(5)
## NAME
**rofi keys** - Rofi Key and Mouse bindings
## DESCRIPTION
**rofi** supports overriding of any of it key and mouse binding.
## Setting binding
Bindings can be done on the commandline (-{bindingname}):
```bash
rofi -show run -kb-accept-entry 'Control+Shift+space'
```
or via the configuration file:
```css
configuration {
kb-accept-entry: "Control+Shift+space";
}
```
The key can be set by its name (see above) or its keycode:
```css
configuration {
kb-accept-entry: "Control+Shift+[65]";
}
```
An easy way to look up keycode is xev(1).
Multiple keys can be specified for an action as a comma separated list:
```css
configuration {
kb-accept-entry: "Control+Shift+space,Return";
}
```
By Default **rofi** reacts on pressing, to act on the release of all keys
prepend the binding with `!`:
```css
configuration {
kb-accept-entry: "!Control+Shift+space,Return";
}
```
## Unsetting a binding
To unset a binding, pass an empty string.
```css
configuration {
kb-clear-line: "";
}
```
## Keyboard Bindings
`kb-primary-paste`
Paste primary selection
Default: Control+V,Shift+Insert
`kb-secondary-paste`
Paste clipboard
Default: Control+v,Insert
`kb-secondary-copy`
Copy current selection to clipboard
Default: Control+c
`kb-clear-line`
Clear input line
Default: Control+w
`kb-move-front`
Beginning of line
Default: Control+a
`kb-move-end`
End of line
Default: Control+e
`kb-move-word-back`
Move back one word
Default: Alt+b,Control+Left
`kb-move-word-forward`
Move forward one word
Default: Alt+f,Control+Right
`kb-move-char-back`
Move back one char
Default: Left,Control+b
`kb-move-char-forward`
Move forward one char
Default: Right,Control+f
`kb-remove-word-back`
Delete previous word
Default: Control+Alt+h,Control+BackSpace
`kb-remove-word-forward`
Delete next word
Default: Control+Alt+d
`kb-remove-char-forward`
Delete next char
Default: Delete,Control+d
`kb-remove-char-back`
Delete previous char
Default: BackSpace,Shift+BackSpace,Control+h
`kb-remove-to-eol`
Delete till the end of line
Default: Control+k
`kb-remove-to-sol`
Delete till the start of line
Default: Control+u
`kb-accept-entry`
Accept entry
Default: Control+j,Control+m,Return,KP\_Enter
`kb-accept-custom`
Use entered text as command (in ssh/run modes)
Default: Control+Return
`kb-accept-custom-alt`
Use entered text as command (in ssh/run modes)
Default: Control+Shift+Return
`kb-accept-alt`
Use alternate accept command.
Default: Shift+Return
`kb-delete-entry`
Delete entry from history
Default: Shift+Delete
`kb-mode-next`
Switch to the next mode.
Default: Shift+Right,Control+Tab
`kb-mode-previous`
Switch to the previous mode.
Default: Shift+Left,Control+ISO\_Left\_Tab
`kb-mode-complete`
Start completion for mode.
Default: Control+l
`kb-row-left`
Go to the previous column
Default: Control+Page\_Up
`kb-row-right`
Go to the next column
Default: Control+Page\_Down
`kb-row-up`
Select previous entry
Default: Up,Control+p
`kb-row-down`
Select next entry
Default: Down,Control+n
`kb-row-tab`
Go to next row, if one left, accept it, if no left next mode.
Default:
`kb-element-next`
Go to next row.
Default: Tab
`kb-element-prev`
Go to previous row.
Default: ISO\_Left\_Tab
`kb-page-prev`
Go to the previous page
Default: Page\_Up
`kb-page-next`
Go to the next page
Default: Page\_Down
`kb-row-first`
Go to the first entry
Default: Home,KP\_Home
`kb-row-last`
Go to the last entry
Default: End,KP\_End
`kb-row-select`
Set selected item as input text
Default: Control+space
`kb-screenshot`
Take a screenshot of the rofi window
Default: Alt+S
`kb-ellipsize`
Toggle between ellipsize modes for displayed data
Default: Alt+period
`kb-toggle-case-sensitivity`
Toggle case sensitivity
Default: grave,dead\_grave
`kb-toggle-sort`
Toggle filtered menu sort
Default: Alt+grave
`kb-cancel`
Quit rofi
Default: Escape,Control+g,Control+bracketleft
`kb-custom-1`
Custom keybinding 1
Default: Alt+1
`kb-custom-2`
Custom keybinding 2
Default: Alt+2
`kb-custom-3`
Custom keybinding 3
Default: Alt+3
`kb-custom-4`
Custom keybinding 4
Default: Alt+4
`kb-custom-5`
Custom Keybinding 5
Default: Alt+5
`kb-custom-6`
Custom keybinding 6
Default: Alt+6
`kb-custom-7`
Custom Keybinding 7
Default: Alt+7
`kb-custom-8`
Custom keybinding 8
Default: Alt+8
`kb-custom-9`
Custom keybinding 9
Default: Alt+9
`kb-custom-10`
Custom keybinding 10
Default: Alt+0
`kb-custom-11`
Custom keybinding 11
Default: Alt+exclam
`kb-custom-12`
Custom keybinding 12
Default: Alt+at
`kb-custom-13`
Custom keybinding 13
Default: Alt+numbersign
`kb-custom-14`
Custom keybinding 14
Default: Alt+dollar
`kb-custom-15`
Custom keybinding 15
Default: Alt+percent
`kb-custom-16`
Custom keybinding 16
Default: Alt+dead\_circumflex
`kb-custom-17`
Custom keybinding 17
Default: Alt+ampersand
`kb-custom-18`
Custom keybinding 18
Default: Alt+asterisk
`kb-custom-19`
Custom Keybinding 19
Default: Alt+parenleft
`kb-select-1`
Select row 1
Default: Super+1
`kb-select-2`
Select row 2
Default: Super+2
`kb-select-3`
Select row 3
Default: Super+3
`kb-select-4`
Select row 4
Default: Super+4
`kb-select-5`
Select row 5
Default: Super+5
`kb-select-6`
Select row 6
Default: Super+6
`kb-select-7`
Select row 7
Default: Super+7
`kb-select-8`
Select row 8
Default: Super+8
`kb-select-9`
Select row 9
Default: Super+9
`kb-select-10`
Select row 10
Default: Super+0
`kb-entry-history-up`
Go up in the entry history.
Default: Control+Up
`kb-entry-history-down`
Go down in the entry history.
Default: Control+Down
`kb-matcher-up`
Select the next matcher.
Default: Super+equal
`kb-matcher-down`
Select the previous matcher.
Default: Super+minus
## Mouse Bindings
`ml-row-left`
Go to the previous column
Default: ScrollLeft
`ml-row-right`
Go to the next column
Default: ScrollRight
`ml-row-up`
Select previous entry
Default: ScrollUp
`ml-row-down`
Select next entry
Default: ScrollDown
`me-select-entry`
Select hovered row
Default: MousePrimary
`me-accept-entry`
Accept hovered row
Default: MouseDPrimary
`me-accept-custom`
Accept hovered row with custom action
Default: Control+MouseDPrimary
## Mouse key bindings
The following mouse buttons can be bound:
* `Primary`: Primary (Left) mouse button click.
* `Secondary`: Secondary (Right) mouse button click.
* `Middle`: Middle mouse button click.
* `Forward`: The forward mouse button.
* `Back`: The back mouse button.
* `ExtraN`: The N'the mouse button. (Depending on mouse support).
The Identifier is constructed as follow:
`Mouse<D><Button>`
* `D` indicates optional Double press.
* `Button` is the button name.
So `MouseDPrimary` is Primary (`Left`) mouse button double click.
## SEE ALSO
rofi(1), rofi-sensible-terminal(1), rofi-theme(5), rofi-script(5)
## AUTHOR
Qball Cow <qball@gmpclient.org>
Rasmus Steinke <rasi@xssn.at>
Morgane 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

@@ -0,0 +1,217 @@
# rofi-script(5)
## NAME
**rofi script mode** - Rofi format for scriptable mode.
## 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:
```bash
rofi -show fb -modes "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`) (This can be changed by the
script). 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.
## Environment
Rofi sets the following environment variable when executing the script:
### `ROFI_RETV`
An integer number with the current state:
- **0**: Initial call of script.
- **1**: Selected an entry.
- **2**: Selected a custom entry.
- **3**: Deleted an entry.
- **10-28**: Custom keybinding 1-19 ( need to be explicitly enabled by script ).
### `ROFI_INFO`
Environment get set when selected entry get set with the property value of the
'info' row option, if set.
### `ROFI_DATA`
Environment get set when script sets `data` option in header.
## 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)
- **delim**: Set the delimiter for for next rows. Default is '\n' and
this option should finish with this. Only call this on first call of script,
it is remembered for consecutive calls.
- **no-custom**: If set to 'true'; only accept listed entries, ignore custom
input.
- **use-hot-keys**: If set to true, it enabled the Custom keybindings for
script. Warning this breaks the normal rofi flow.
- **keep-selection**: If set, the selection is not moved to the first entry,
but the current position is maintained. The filter is cleared.
- **keep-filter**: If set, the filter is not cleared.
- **new-selection**: If `keep-selection` is set, this allows you to override
the selected entry (absolute position).
- **data**: Passed data to the next execution of the script via
**ROFI\_DATA**.
- **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
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.
- **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.
- **permanent**: If true the row always shows, independent of filter.
- **info**: Info that, on selection, gets placed in the `ROFI_INFO`
environment variable. This entry does not get searched for filtering.
- **urgent**: Set urgent flag on entry (true/false)
- **active**: Set active flag on entry (true/false)
multiple entries can be passed using the `\x1f` separator.
```bash
echo -en "aap\0icon\x1ffolder\x1finfo\x1ftest\n"
```
## Executing external program
If you want to launch an external program from the script, you need to make
sure it is launched in the background. If not rofi will wait for its output (to
display).
In bash the best way to do this is using `coproc`.
```bash
coproc ( myApp > /dev/null 2>&1 )
```
## DASH shell
If you use the `dash` shell for your script, take special care with how dash
handles escaped values for the separators. See issue #1201 on github.
## Script locations
To specify a script there are the following options:
- Specify an absolute path to the script.
- The script is executable and located in your $PATH
Scripts located in the following location are **loaded** on startup
and can be directly launched based on the filename (without extension):
- The script is in `$XDG_CONFIG_HOME/rofi/scripts/`, this is usually
`~/.config/rofi/scripts/`.
If you have a script 'mymode.sh' in this folder you can open it using:
```bash
rofi -show mymode
```
See `rofi -h` output for a list of detected scripts.
## SEE ALSO
rofi(1), rofi-sensible-terminal(1), dmenu(1), rofi-theme(5),
rofi-theme-selector(1)
## AUTHOR
Qball Cow <qball@gmpclient.org>
Rasmus Steinke <rasi@xssn.at>
Morgane 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.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,85 @@
# rofi-thumbnails(5)
## NAME
**rofi-thumbnails** - Rofi thumbnails system
## DESCRIPTION
**rofi** is now able to show thumbnails for all file types where an XDG compatible thumbnailer is present in the system.
This is done by default in filebrowser and recursivebrowser mode, if **rofi** is launched with the `-show-icons` argument.
In a custom user script or dmenu mode, it is possible to produce entry icons using XDG thumbnailers by adding the prefix `thumbnail://` to the filename
specified after `\0icon\x1f`, for example:
```bash
echo -en "EntryName\0icon\x1fthumbnail://path/to/file\n" | rofi -dmenu -show-icons
```
### XDG thumbnailers
XDG thumbnailers are files with a ".thumbnailer" suffix and a structure similar to ".desktop" files for launching applications. They are placed in `/usr/share/thumbnailers/` or `$HOME/.local/share/thumbnailers/`, and contain a list of mimetypes, for which is possible to produce the thumbnail image, and a string with the command to create said image. The example below shows the content of `librsvg.thumbnailer`, a thumbnailer for svg files using librsvg:
```
[Thumbnailer Entry]
TryExec=/usr/bin/gdk-pixbuf-thumbnailer
Exec=/usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
MimeType=image/svg+xml;image/svg+xml-compressed;
```
The images produced are named as the md5sum of the input files and placed, depending on their size, in the XDG thumbnails directories: `$HOME/.cache/thumbnails/{normal,large,x-large,xx-large}`. They are then loaded by **rofi** as entry icons and can also be used by file managers like Thunar, Caja or KDE Dolphin to show their thumbnails. Additionally, if a thumbnail for a file is found in the thumbnails directories (produced previously by **rofi** or a file manager), **rofi** will load it instead of calling the thumbnailer.
If a suitable thumbnailer for a given file is not found, **rofi** will try to use the corresponding mimetype icon from the icon theme.
### Custom command to create thumbnails
It is possible to use a custom command to generate thumbnails for generic entry names, for example a script that downloads an icon given its url or selects different icons depending on the input. This can be done providing the `-preview-cmd` argument followed by a string with the command to execute, with the following syntax:
```
rofi ... -preview-cmd 'path/to/script_or_cmd "{input}" "{output}" "{size}"'
```
**rofi** will call the script or command substituting `{input}` with the input entry icon name (the string after `\0icon\x1fthumbnail://`), `{output}` with the output filename of the thumbnail and `{size}` with the requested thumbnail size. The script or command is responsible of producing a thumbnail image (if possible respecting the requested size) and saving it in the given `{output}` filename.
### Issues with AppArmor
In Linux distributions using AppArmor (such as Ubuntu and Debian), the default rules shipped can cause issues with thumbnails generation. If that is the case, AppArmor can be disabled by issuing the following commands
```
sudo systemctl stop apparmor
sudo systemctl disable apparmor
```
In alternative, the following apparmor profile con be placed in a file named /etc/apparmor.d/usr.bin.rofi
```
#vim:syntax=apparmor
# AppArmor policy for rofi
#include <tunables/global>
/usr/bin/rofi {
#include <abstractions/base>
# TCP/UDP network access for NFS
network inet stream,
network inet6 stream,
network inet dgram,
network inet6 dgram,
/usr/bin/rofi mr,
@{HOME}/ r,
@{HOME}/** rw,
owner @{HOME}/.cache/thumbnails/** rw,
}
```
then run
```
apparmor_parser -r /etc/apparmor.d/usr.bin.rofi
```
to reload the rule. This assumes that **rofi** binary is in /usr/bin, that is the case of a standard package installation.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
../../../doc/rofi-actions.5.markdown

View File

@@ -6,6 +6,21 @@ For development no tarball is released. Please follow the
[Installation](../INSTALL/) instructions for obtaining and compiling
development version.
## [1.7.9](https://github.com/davatorium/rofi/releases/tag/1.7.9)
- [tar.gz](https://github.com/davatorium/rofi/releases/download/1.7.9/rofi-1.7.9.tar.gz)
- [tar.xz](https://github.com/davatorium/rofi/releases/download/1.7.9/rofi-1.7.9.tar.xz)
## [1.7.8](https://github.com/davatorium/rofi/releases/tag/1.7.8)
- [tar.gz](https://github.com/davatorium/rofi/releases/download/1.7.8/rofi-1.7.8.tar.gz)
- [tar.xz](https://github.com/davatorium/rofi/releases/download/1.7.8/rofi-1.7.8.tar.xz)
## [1.7.7](https://github.com/davatorium/rofi/releases/tag/1.7.7)
- [tar.gz](https://github.com/davatorium/rofi/releases/download/1.7.7/rofi-1.7.7.tar.gz)
- [tar.xz](https://github.com/davatorium/rofi/releases/download/1.7.7/rofi-1.7.7.tar.xz)
## [1.7.6](https://github.com/davatorium/rofi/releases/tag/1.7.6)
- [tar.gz](https://github.com/davatorium/rofi/releases/download/1.7.6/rofi-1.7.6.tar.gz)

View File

@@ -11,7 +11,6 @@ The manpages are grouped on rofi version.
- [Themes](themes/themes.md)
- [User scripts (wiki)](https://github.com/davatorium/rofi/wiki/User-scripts)
## Development version
- [Rofi manpage](current/rofi.1.markdown)
@@ -20,15 +19,18 @@ The manpages are grouped on rofi version.
- [Script](current/rofi-script.5.markdown)
- [Debugging](current/rofi-debugging.5.markdown)
- [Keys](current/rofi-keys.5.markdown)
- [Actions](current/rofi-actions.5.markdown)
- [Thumbnails](current/rofi-thumbnails.5.markdown)
## Stable
- [Rofi manpage](1.7.5/rofi.1.markdown)
- [Themes](1.7.5/rofi-theme.5.markdown)
- [Dmenu](1.7.5/rofi-dmenu.5.markdown)
- [Script](1.7.5/rofi-script.5.markdown)
- [Debugging](1.7.5/rofi-debugging.5.markdown)
- [Keys](1.7.5/rofi-keys.5.markdown)
- [Rofi manpage](1.7.9/rofi.1.markdown)
- [Themes](1.7.9/rofi-theme.5.markdown)
- [Dmenu](1.7.9/rofi-dmenu.5.markdown)
- [Script](1.7.9/rofi-script.5.markdown)
- [Debugging](1.7.9/rofi-debugging.5.markdown)
- [Keys](1.7.9/rofi-keys.5.markdown)
- [Thumbnails](1.7.9/rofi-thumbnails.5.markdown)
## Guides

View File

@@ -23,6 +23,15 @@ nav:
- Debugging: current/rofi-debugging.5.markdown
- Keys: current/rofi-keys.5.markdown
- Thumbnails: current/rofi-thumbnails.5.markdown
- Actions: current/rofi-actions.5.markdown
- 1.7.9:
- Rofi: 1.7.9/rofi.1.markdown
- Themes: 1.7.9/rofi-theme.5.markdown
- Dmenu: 1.7.9/rofi-dmenu.5.markdown
- Script: 1.7.9/rofi-script.5.markdown
- Debugging: 1.7.9/rofi-debugging.5.markdown
- Keys: 1.7.9/rofi-keys.5.markdown
- Thumbnails: 1.7.9/rofi-thumbnails.5.markdown
- 1.7.8:
- Rofi: 1.7.8/rofi.1.markdown
- Themes: 1.7.8/rofi-theme.5.markdown

View File

@@ -0,0 +1,76 @@
# 1.7.9
## Custom commands on events
Giomatfois62 added a nice feature that allows you to execute a custom command
on different events. For example play a sound when accepting an entry.
See the
[rofi-actions(5)](https://github.com/davatorium/rofi/blob/1.7.9/doc/rofi-actions.5.markdown)
manpage for more information.
## NVidia workaround workaround
Because of oddness in nvidia drivers, we had an issue the whole screen turned
black if we used the 'over' operator in cairo. Working around this caused some
drawing issues with anti-aliasing. There now exists two flags to to work around
this workaround again. Either disable the workaround, or disable anti-aliasing.
You can set these options per widget:
```css
widget {
border-disable-nvidia-workaround: true;
border-aa: false;
}
```
It's recommended to set it globally.
```css
* {
border-disable-nvidia-workaround: true;
border-aa: false;
}
```
## IMDKit runtime disable option
Because IMDKit can break some keybindings, this can now be disabled at runtime.
For example if you try to bind only the 'Super' key, this can fix this.
For more information, see issue: #2124
## Smartcase support
Thanks to Phanium, rofi now supports Vim style 'smartcase'. Can be enabled
using `-case-smart`.
Fore more information, see issue: #2060
## Changelog
* Add -imdkit config to toggle imdkit at runtime (#2124) (thx Amos Bird)
* [Widget] Add 2 workaround for error in corner radius drawing
* [rofi-sensible-terminal] Add ghostty (#2110)
* [scrollbar] Add theming for rounded corners (#2108) (thx J0hannes101)
* [DOC] Fix indenting of sub-bullets as mkdocs interpets them differently (#2112)
* Fix typo in fullscreen-preview.rasi (#2113) (thx elig0n)
* Add theming to hide text cursor if no text is put in (#2106) (thx J0hannes101)
* [DRUN] Add option to exclude categories from drun #2102 (#2104) (thx J0hannes101)
* [XCB] Don't keep casting from int to double to int
* [Helper] Add a rofi_fallthrough macro to tell compiler fallthrough is intentional
* [View] xcb_clear_area fixed wrong argument order.
* [DRun] Better handling of corrupted cache file.
* Fix broken Pango link (#2096) (thx Emil)
* [NKUtils] Drop support for binding Meta key. (#2095)
* [View] Allow cycling through matching methods (#2091)
* Fix wrong pointer `-replace` and small cleanup.
* [Textbox] Small signedness fixes for password mask code.
* [dmenu] Modified textbox password masking (#2067) (thx Zebra2711)
* add smartcase support like vim (#2060) (thx Phanium)
* [Mode] Fix wrong documentation header.
* Execute custom user commands or scripts on a variety of rofi events (#2053) (thx giomatfois62)
* Add option to enable the `kb-delete-entry` in script mode (#2087) (thx Tiou Lims)
* [Window] Allow active window to be sorted on top. (#2048)
* [Lexer] Allow for optional imports. (#2078)

View File

@@ -9,7 +9,7 @@
# We welcome patches that add distribution-specific mechanisms to find the
# preferred terminal emulator. On Debian, there is the x-terminal-emulator
# symlink for example.
for terminal in $TERMINAL x-terminal-emulator urxvt rxvt st terminology qterminal Eterm aterm uxterm xterm roxterm xfce4-terminal.wrapper mate-terminal lxterminal konsole alacritty kitty wezterm foot; do
for terminal in $TERMINAL x-terminal-emulator urxvt rxvt st terminology qterminal Eterm aterm uxterm xterm roxterm xfce4-terminal.wrapper mate-terminal lxterminal konsole alacritty kitty wezterm foot ghostty; do
if command -v $terminal >/dev/null 2>&1; then
exec $terminal "$@"
fi

View File

@@ -216,6 +216,7 @@ struct _DRunModePrivateData {
unsigned int expected_line_height;
char **show_categories;
char **exclude_categories;
// Theme
const gchar *icon_theme;
@@ -236,6 +237,7 @@ struct RegexEvalArg {
const char *path;
gboolean success;
};
static void drun_entry_clear(DRunModeEntry *e);
static gboolean drun_helper_eval_cb(const GMatchInfo *info, GString *res,
gpointer data) {
@@ -722,6 +724,19 @@ static void read_desktop_file(DRunModePrivateData *pd, const char *root,
}
}
if (pd->exclude_categories) {
if (categories == NULL) {
categories = g_key_file_get_locale_string_list(
kf, DRUN_GROUP_NAME, "Categories", NULL, NULL, NULL);
}
if (rofi_strv_contains((const char *const *)categories,
(const char *const *)pd->exclude_categories)) {
g_strfreev(categories);
g_key_file_free(kf);
return;
}
}
size_t nl = ((pd->cmd_list_length) + 1);
if (nl >= pd->cmd_list_length_actual) {
pd->cmd_list_length_actual += 256;
@@ -966,18 +981,19 @@ static void drun_write_str(FILE *fd, const char *str) {
static void drun_write_integer(FILE *fd, int32_t val) {
fwrite(&val, sizeof(val), 1, fd);
}
static void drun_read_integer(FILE *fd, int32_t *type) {
static gboolean drun_read_integer(FILE *fd, int32_t *type) {
if (fread(type, sizeof(int32_t), 1, fd) != 1) {
g_warning("Failed to read entry, cache corrupt?");
return;
return TRUE;
}
return FALSE;
}
static void drun_read_string(FILE *fd, char **str) {
static gboolean drun_read_string(FILE *fd, char **str) {
size_t l = 0;
if (fread(&l, sizeof(l), 1, fd) != 1) {
g_warning("Failed to read entry, cache corrupt?");
return;
return TRUE;
}
(*str) = NULL;
if (l > 0) {
@@ -986,8 +1002,10 @@ static void drun_read_string(FILE *fd, char **str) {
(*str) = g_malloc(l);
if (fread((*str), 1, l, fd) != l) {
g_warning("Failed to read entry, cache corrupt?");
return TRUE;
}
}
return FALSE;
}
static void drun_write_strv(FILE *fd, char **str) {
guint vl = (str == NULL ? 0 : g_strv_length(str));
@@ -996,20 +1014,23 @@ static void drun_write_strv(FILE *fd, char **str) {
drun_write_str(fd, str[index]);
}
}
static void drun_read_stringv(FILE *fd, char ***str) {
static gboolean drun_read_stringv(FILE *fd, char ***str) {
guint vl = 0;
(*str) = NULL;
if (fread(&vl, sizeof(vl), 1, fd) != 1) {
g_warning("Failed to read entry, cache corrupt?");
return;
return TRUE;
}
if (vl > 0) {
// Include terminating NULL entry.
(*str) = g_malloc0((vl + 1) * sizeof(**str));
for (guint index = 0; index < vl; index++) {
drun_read_string(fd, &((*str)[index]));
if (drun_read_string(fd, &((*str)[index]))) {
return TRUE;
}
}
}
return FALSE;
}
static void write_cache(DRunModePrivateData *pd, const char *cache_file) {
@@ -1100,30 +1121,82 @@ static gboolean drun_read_cache(DRunModePrivateData *pd,
pd->entry_list =
g_malloc0(pd->cmd_list_length_actual * sizeof(*(pd->entry_list)));
for (unsigned int index = 0; index < pd->cmd_list_length; index++) {
int error = 0;
for (unsigned int index = 0; !error && index < pd->cmd_list_length; index++) {
DRunModeEntry *entry = &(pd->entry_list[index]);
drun_read_string(fd, &(entry->action));
drun_read_string(fd, &(entry->root));
drun_read_string(fd, &(entry->path));
drun_read_string(fd, &(entry->app_id));
drun_read_string(fd, &(entry->desktop_id));
drun_read_string(fd, &(entry->icon_name));
drun_read_string(fd, &(entry->exec));
drun_read_string(fd, &(entry->name));
drun_read_string(fd, &(entry->generic_name));
if (drun_read_string(fd, &(entry->action))) {
error = 1;
continue;
}
if (drun_read_string(fd, &(entry->root))) {
error = 1;
continue;
}
if (drun_read_string(fd, &(entry->path))) {
error = 1;
continue;
}
if (drun_read_string(fd, &(entry->app_id))) {
error = 1;
continue;
}
if (drun_read_string(fd, &(entry->desktop_id))) {
error = 1;
continue;
}
if (drun_read_string(fd, &(entry->icon_name))) {
error = 1;
continue;
}
if (drun_read_string(fd, &(entry->exec))) {
error = 1;
continue;
}
if (drun_read_string(fd, &(entry->name))) {
error = 1;
continue;
}
if (drun_read_string(fd, &(entry->generic_name))) {
error = 1;
continue;
}
drun_read_stringv(fd, &(entry->categories));
drun_read_stringv(fd, &(entry->keywords));
if (drun_read_stringv(fd, &(entry->categories))) {
error = 1;
continue;
}
if (drun_read_stringv(fd, &(entry->keywords))) {
error = 1;
continue;
}
drun_read_string(fd, &(entry->comment));
drun_read_string(fd, &(entry->url));
if (drun_read_string(fd, &(entry->comment))) {
error = 1;
continue;
}
if (drun_read_string(fd, &(entry->url))) {
error = 1;
continue;
}
int32_t type = 0;
drun_read_integer(fd, &(type));
if (drun_read_integer(fd, &(type))) {
error = 1;
continue;
}
entry->type = type;
}
fclose(fd);
if (error) {
for (size_t i = 0; i < pd->cmd_list_length; i++) {
drun_entry_clear(&(pd->entry_list[i]));
}
g_free(pd->entry_list);
pd->cmd_list_length = 0;
pd->cmd_list_length_actual = 0;
return TRUE;
}
TICK_N("DRUN Read CACHE: stop");
return FALSE;
}
@@ -1190,6 +1263,8 @@ static void get_apps(DRunModePrivateData *pd) {
TICK_N("Sorting done.");
write_cache(pd, cache_file);
} else {
g_debug("Read drun entries from cache.");
}
g_free(cache_file);
}
@@ -1261,6 +1336,10 @@ static int drun_mode_init(Mode *sw) {
pd->show_categories = g_strsplit(config.drun_categories, ",", 0);
}
if (config.drun_exclude_categories && *(config.drun_exclude_categories)) {
pd->exclude_categories = g_strsplit(config.drun_exclude_categories, ",", 0);
}
drun_mode_parse_entry_fields();
drun_mode_parse_display_format();
get_apps(pd);
@@ -1269,6 +1348,9 @@ static int drun_mode_init(Mode *sw) {
return TRUE;
}
static void drun_entry_clear(DRunModeEntry *e) {
if (e == NULL) {
return;
}
g_free(e->root);
g_free(e->path);
g_free(e->app_id);
@@ -1411,6 +1493,7 @@ static void drun_mode_destroy(Mode *sw) {
g_strfreev(rmpd->current_desktop_list);
g_strfreev(rmpd->show_categories);
g_strfreev(rmpd->exclude_categories);
g_free(rmpd);
mode_set_private_data(sw, NULL);
}

View File

@@ -341,10 +341,10 @@ void rofi_view_set_selected_line(RofiViewState *state,
}
}
listview_set_selected(state->list_view, selected);
#ifdef ENABLE_XCB
if (config.backend == DISPLAY_XCB) {
xcb_clear_area(xcb->connection, CacheState.main_window, 1, 0, 0, 1, 1);
// Clear the window and force an expose event resulting in a redraw.
xcb_clear_area(xcb->connection, 1, CacheState.main_window, 0, 0, 1, 1);
xcb_flush(xcb->connection);
}
#endif
@@ -1386,10 +1386,10 @@ void rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
return;
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END:
target = NULL;
/* FALLTHRU */
rofi_fallthrough;
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN:
state->mouse.motion_target = target;
/* FALLTHRU */
rofi_fallthrough;
case WIDGET_TRIGGER_ACTION_RESULT_HANDLED:
return;
}

View File

@@ -34,6 +34,7 @@
#include <widgets/textbox.h>
#include <widgets/widget.h>
#include "helper.h"
#include "settings.h"
#include "theme.h"
#include "view.h"
@@ -757,7 +758,7 @@ static WidgetTriggerActionResult listview_element_trigger_action(
break;
case ACCEPT_HOVERED_CUSTOM:
custom = TRUE;
/* FALLTHRU */
rofi_fallthrough;
case ACCEPT_HOVERED_ENTRY:
listview_set_selected(lv, lv->last_offset + i);
lv->mouse_activated(lv, custom, lv->mouse_activated_data);

View File

@@ -174,8 +174,26 @@ static void scrollbar_draw(widget *wid, cairo_t *draw) {
// Cap length;
rofi_theme_get_color(WIDGET(sb), "handle-color", draw);
if (rofi_theme_get_boolean(WIDGET(sb), "handle-rounded-corners", FALSE)) {
float x = widget_padding_get_left(wid);
float width = widget_padding_get_remaining_width(wid);
float radius = ((width < height) ? width : height) / 2; // Limit radius to prevent overlap
// Draw rounded rectangle
cairo_new_sub_path(draw);
cairo_arc(draw, x + width - radius, y + radius, radius, -G_PI_2, 0);
cairo_arc(draw, x + width - radius, y + height - radius, radius, 0, G_PI_2);
cairo_arc(draw, x + radius, y + height - radius, radius, G_PI_2, G_PI);
cairo_arc(draw, x + radius, y + radius, radius, G_PI, 1.5 * G_PI);
cairo_close_path(draw);
cairo_fill(draw);
}
else {
cairo_rectangle(draw, widget_padding_get_left(wid),
widget_padding_get_top(wid) + y,
widget_padding_get_remaining_width(wid), height);
cairo_fill(draw);
}
}

View File

@@ -551,6 +551,8 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
if (tb->flags & TB_EDITABLE) {
// We want to place the cursor based on the text shown.
const char *text = pango_layout_get_text(tb->layout);
// hide the cursor, if no text is entered and hide-empty-cursor is set to true
if (!(tb->text[0] == '\0' && rofi_theme_get_boolean(WIDGET(tb), "hide-cursor-on-empty", FALSE) == TRUE)){
// Clamp the position, should not be needed, but we are paranoid.
size_t cursor_offset;
@@ -598,6 +600,7 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
cairo_restore(draw);
}
}
}
// draw the text
cairo_save(draw);

View File

@@ -24,6 +24,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include "cairo.h"
#include "config.h"
#include "theme.h"
@@ -53,6 +54,10 @@ void widget_init(widget *wid, widget *parent, WidgetType type,
// enabled by default
wid->enabled = rofi_theme_get_boolean(wid, "enabled", TRUE);
wid->border_antialiasing = rofi_theme_get_boolean(wid, "border-aa", TRUE);
wid->border_disable_nvidia_workaround =
rofi_theme_get_boolean(wid, "border-disable-nvidia-workaround", FALSE);
}
void widget_set_state(widget *wid, const char *state) {
@@ -251,7 +256,12 @@ void widget_draw(widget *wid, cairo_t *d) {
if (left != 0 || top != 0 || right != 0 || bottom != 0) {
cairo_save(d);
// cairo_set_operator(d, CAIRO_OPERATOR_ADD);
if (wid->border_antialiasing == FALSE) {
cairo_set_antialias(d, CAIRO_ANTIALIAS_NONE);
}
if (wid->border_disable_nvidia_workaround) {
cairo_set_operator(d, CAIRO_OPERATOR_ADD);
}
cairo_translate(d, wid->x, wid->y);
cairo_new_path(d);
rofi_theme_get_color(wid, "border-color", d);

View File

@@ -148,11 +148,10 @@ static xcb_visualtype_t *lookup_visual(xcb_screen_t *s, xcb_visualid_t vis) {
* website: http://macslow.thepimp.net. I'm not entirely sure he's proud of it,
* but it has proved immeasurably useful for me. */
static uint32_t *create_kernel(double radius, double deviation,
uint32_t *sum2) {
int size = 2 * (int)(radius) + 1;
static uint32_t *create_kernel(int radius, double deviation, uint32_t *sum2) {
int size = 2 * (radius) + 1;
uint32_t *kernel = (uint32_t *)(g_malloc(sizeof(uint32_t) * (size + 1)));
double radiusf = fabs(radius) + 1.0;
double radiusf = abs(radius) + 1.0;
double value = -radius;
double sum = 0.0;
int i;
@@ -176,7 +175,7 @@ static uint32_t *create_kernel(double radius, double deviation,
return kernel;
}
void cairo_image_surface_blur(cairo_surface_t *surface, double radius,
void cairo_image_surface_blur(cairo_surface_t *surface, int radius,
double deviation) {
uint32_t *horzBlur;
uint32_t *kernel = 0;
@@ -1172,13 +1171,13 @@ static gboolean x11_button_to_nk_bindings_scroll(guint32 x11_button,
switch (x11_button) {
case 4:
*steps = -1;
/* fallthrough */
rofi_fallthrough;
case 5:
*axis = NK_BINDINGS_SCROLL_AXIS_VERTICAL;
break;
case 6:
*steps = -1;
/* fallthrough */
rofi_fallthrough;
case 7:
*axis = NK_BINDINGS_SCROLL_AXIS_HORIZONTAL;
break;
@@ -1374,7 +1373,7 @@ static void main_loop_x11_event_handler_view(xcb_generic_event_t *event) {
case XCB_KEY_PRESS: {
xcb_key_press_event_t *xkpe = (xcb_key_press_event_t *)event;
#ifdef XCB_IMDKIT
if (xcb->ic) {
if (config.enable_imdkit && xcb->ic) {
g_log("IMDKit", G_LOG_LEVEL_DEBUG, "press key %d to xim", xkpe->detail);
xcb_xim_forward_event(xcb->im, xcb->ic, xkpe);
return;
@@ -1388,7 +1387,7 @@ static void main_loop_x11_event_handler_view(xcb_generic_event_t *event) {
case XCB_KEY_RELEASE: {
xcb_key_release_event_t *xkre = (xcb_key_release_event_t *)event;
#ifdef XCB_IMDKIT
if (xcb->ic) {
if (config.enable_imdkit && xcb->ic) {
g_log("IMDKit", G_LOG_LEVEL_DEBUG, "release key %d to xim", xkre->detail);
// Check if the keysym is a modifier key (e.g., Shift, Ctrl, Alt). If it
@@ -1453,7 +1452,7 @@ static gboolean main_loop_x11_event_handler(xcb_generic_event_t *ev,
}
#ifdef XCB_IMDKIT
if (xcb->im && xcb_xim_filter_event(xcb->im, ev))
if (config.enable_imdkit && xcb->im && xcb_xim_filter_event(xcb->im, ev))
return G_SOURCE_CONTINUE;
#endif
@@ -1643,7 +1642,9 @@ static gboolean xcb_display_setup(GMainLoop *main_loop, NkBindings *bindings) {
xcb->main_loop = main_loop;
#ifdef XCB_IMDKIT
if (config.enable_imdkit) {
xcb_compound_text_init();
}
#endif
xcb->source = g_water_xcb_source_new(g_main_loop_get_context(xcb->main_loop),
display_str, &xcb->screen_nbr,
@@ -1654,14 +1655,21 @@ static gboolean xcb_display_setup(GMainLoop *main_loop, NkBindings *bindings) {
}
xcb->connection = g_water_xcb_source_get_connection(xcb->source);
#ifdef XCB_IMDKIT
if (config.enable_imdkit) {
xcb->im = xcb_xim_create(xcb->connection, xcb->screen_nbr, NULL);
xcb->syms = xcb_key_symbols_alloc(xcb->connection);
} else {
xcb->im = NULL;
xcb->syms = NULL;
}
#endif
#ifdef XCB_IMDKIT
#ifndef XCB_IMDKIT_1_0_3_LOWER
if (config.enable_imdkit) {
xcb_xim_set_use_compound_text(xcb->im, true);
xcb_xim_set_use_utf8_string(xcb->im, true);
}
#endif
#endif
@@ -1929,9 +1937,11 @@ static void xcb_display_cleanup(void) {
xcb_flush(xcb->connection);
xcb_aux_sync(xcb->connection);
#ifdef XCB_IMDKIT
if (config.enable_imdkit) {
xcb_xim_close(xcb->im);
xcb_xim_destroy(xcb->im);
xcb->im = NULL;
}
#endif
g_water_xcb_source_free(xcb->source);
xcb->source = NULL;

View File

@@ -294,13 +294,14 @@ static void xcb_rofi_view_update(RofiViewState *state, gboolean qr) {
TICK_N("Background");
widget_draw(WIDGET(state->main_window), d);
// TODO
#ifdef XCB_IMDKIT
if (config.enable_imdkit) {
int x = widget_get_x_pos(&state->text->widget) +
textbox_get_cursor_x_pos(state->text);
int y = widget_get_y_pos(&state->text->widget) +
widget_get_height(&state->text->widget);
rofi_set_im_window_pos(x, y);
}
#endif
TICK_N("widgets");
@@ -344,30 +345,30 @@ static void xcb_rofi_view_calculate_window_position(RofiViewState *state) {
switch (location) {
case WL_NORTH_WEST:
state->x = XcbState.mon.x;
/* FALLTHRU */
rofi_fallthrough;
case WL_NORTH:
state->y = XcbState.mon.y;
break;
rofi_fallthrough;
case WL_NORTH_EAST:
state->y = XcbState.mon.y;
/* FALLTHRU */
rofi_fallthrough;
case WL_EAST:
state->x = XcbState.mon.x + XcbState.mon.w;
break;
case WL_SOUTH_EAST:
state->x = XcbState.mon.x + XcbState.mon.w;
/* FALLTHRU */
rofi_fallthrough;
case WL_SOUTH:
state->y = XcbState.mon.y + XcbState.mon.h;
break;
case WL_SOUTH_WEST:
state->y = XcbState.mon.y + XcbState.mon.h;
/* FALLTHRU */
rofi_fallthrough;
case WL_WEST:
state->x = XcbState.mon.x;
break;
case WL_CENTER:;
/* FALLTHRU */
rofi_fallthrough;
default:
break;
}
@@ -673,12 +674,12 @@ static void xcb___create_window(MenuFlags menu_flags) {
xcb_event_masks, map};
#ifdef XCB_IMDKIT
if (config.enable_imdkit) {
xcb_xim_set_im_callback(xcb->im, &xim_callback, NULL);
#endif
// Open connection to XIM server.
#ifdef XCB_IMDKIT
// Open connection to XIM server.
xcb_xim_open(xcb->im, open_xim_callback, true, NULL);
}
#endif
xcb_window_t box_window = xcb_generate_id(xcb->connection);

View File

@@ -237,6 +237,12 @@ static XrmOption xrmOptions[] = {
NULL,
"Only show Desktop entry from these categories",
CONFIG_DEFAULT},
{xrm_String,
"drun-exclude-categories",
{.str = &config.drun_exclude_categories},
NULL,
"Exclude Desktop entries from these categories",
CONFIG_DEFAULT},
{xrm_Boolean,
"drun-show-actions",
{.num = &config.drun_show_actions},
@@ -497,6 +503,12 @@ static XrmOption xrmOptions[] = {
NULL,
"What completer to use for drun/run.",
CONFIG_DEFAULT},
{xrm_Boolean,
"imdkit",
{.snum = &config.enable_imdkit},
NULL,
"Whether to enable imdkit",
CONFIG_DEFAULT},
};
/** Dynamic array of extra options */

View File

@@ -21,7 +21,7 @@ window {
}
/** We add an extra child to this is PREVIEW=true */
/** We add an extra child to this if PREVIEW=true */
listview-split {
orientation: horizontal;
spacing: 0.4em;