Merge tag '1.7.1' into wayland

This commit is contained in:
lbonn 2021-11-28 15:50:59 +01:00
commit fd68f97fe7
19 changed files with 656 additions and 411 deletions

View file

@ -46,6 +46,7 @@ Peter Cannici
qedi
Quentin Glidic
Rasmus Steinke
RaZ0rr-Two
Roomcays
seanpringle
Sebastian Reuße

200
CONFIG.md Normal file
View file

@ -0,0 +1,200 @@
> # :warning: This page does not describe all of **ROFI**'s configuration options, just the most common usecase. For the full configuration options, check the manpages.
<br />
## :exclamation: Upgrade from old configuration format to new :exclamation:
In release after '2 Jan 2020' you can convert to the new configuration format by using the following command:
```bash
rofi -upgrade-config
```
This will create `~/.config/rofi/config.rasi` (or the default location for your system) with the previously configured options.
From 1.7.0 the old configuration format is no longer supported and the `-upgrade-config` option is no longer available.
<br />
# Where does the configuration live
Rofi's configurations, custom themes live in `${XDG_CONFIG_HOME}/rofi/`, on most systems this is `~/.config/rofi/`.
The name of the main configuration file is `config.rasi`. (`~/.config/rofi/config.rasi`).
# Create an empty configuration file
Open `~/.config/rofi/config.rasi` in your favorite text editor and add the following block:
```css
configuration {
}
```
You can now set the options in the `configuration` block.
# Create a configuration file from current setup
If you do not want to start from scratch, or want to migrate from older configuration format, you can get tell rofi to dumps it configuration:
```bash
rofi -dump-config > ~/.config/rofi/config.rasi
```
This will have all the possible settings and their current value.
If a value is the default value, the entry will be commented.
For example:
```css
configuration {
/* modi: "window,run,ssh,drun";*/
/* font: "mono 12";*/
/* location: 0;*/
/* yoffset: 0;*/
/* xoffset: 0;*/
/* fixed-num-lines: true;*/
... cut ...
/* ml-row-down: "ScrollDown";*/
/* me-select-entry: "MousePrimary";*/
/* me-accept-entry: "MouseDPrimary";*/
/* me-accept-custom: "Control+MouseDPrimary";*/
}
```
# Configuration file format
## Encoding
The encoding of the file is utf-8. Both Unix (`\n`) and windows (`\r\n`) newlines format are supported. But Unix is preferred.
## Comments
C and C++ file comments are supported.
* Anything after `// ` and before a newline is considered a comment.
* Everything between `/*` and `*/` is a comment.
Comments can be nested and the C comments can be inline.
The following is valid:
```
// Magic comment.
property: /* comment */ value;
```
However, this is not:
```
prop/*comment*/erty: value;
```
## White space
White space and newlines, like comments, are ignored by the parser.
This:
```
property: name;
```
Is identical to:
```
property :
name
;
```
## Data types
**ROFI**'s configuration supports several data formats:
### String
A string is always surrounded by double quotes (`"`). Between the quotes there can be any printable character.
For example:
```css
ml-row-down: "ScrollDown";
```
### Number
An integer may contain any full number.
For example:
```
eh: 2;
```
### Boolean
Boolean value is either `true` or `false`. This is case-sensitive.
For example:
```css
show-icons: true;
```
This is equal to the `-show-icons` option on the commandline, and `show-icons: false;` is equal to `-no-show-icons`.
### Character
Character value is always surrounded by single quotes (') and should contain a single character.
It supports escaping.
```css
matching-negate-char: '-';
```
### List
This is not supported by the old configuration system, but can be used in the **rasi** format.
A list starts with a '[' and ends with a ']'. The entries in the list are comma-separated.
The entry in the list single ASCII words.
```css
combi-modi: [window,drun];
```
For older versions you have :
```css
combi-modi: "window,drun";
```
# Get a list of all possible options
There are 2 ways to get a list of all options:
1. Dump the configuration file explained above. (`rofi -dump-config`)
2. Look at output of `rofi -h`.
To see what values an option support check the manpage, it describes most of them.
NOTE: not all options might be in the manpage, as options can be added at run-time. (f.e. by plugins).
# Splitting configuration over multiple files
It is possible to split configuration over multiple files using imports. For example in `~/.config/rofi/config.rasi`
```css
configuration {
}
@import "myConfig"
@theme "MyTheme"
```
Rofi will first parse the config block in `~/.config/rofi/config.rasi`, then parse `~/.config/rofi/myConfig.rasi` and then load the theme `myTheme`.\
More information can be obtained from **Themes** section\
Imports can be nested.

View file

@ -1,3 +1,27 @@
v1.7.1: Turtley amazing!
- [Theme] Fix highlight with only theme.
- Updated documentation and landing page (Thanks to RaZ0rr-Two)
- [Combi] Fix nesting combi modi (#1510)
- [DMenu] Fix crash dmenu mode when no entry is available. (#1504)
- [Run|Drun] Only initialize file-completer on first use.
- [FileBrowser] Reduce number of re-allocs.
- [Readme] Remove generating readme.html for dist.
- [Dmenu] Fix uninitialized memory (non-selectable)
- [FileBrowser] Try to convert invalid encoded text. (#1471)
- [FileBrowser] Don't crash on invalid file filenames. (#1471)
- [Theme] print known colors as its color name.
- [CMD] If failed to convert commandline to new option, do not stop. (#1425)
- [Theme] Fix parsing of nested media blocks. (#1442)
- [Widgets] Fix sizing logic widgets. (#1437)
- [Window] Try to fix auto-sizing of desktop names for non-i3 desktops. (#1439)
- [Window] Fix broken close-on-delete. (#1421)
- [Listview] Correctly check if selected item is highlighted. (#1423)
- [Entry] Allow action to be taken on input change. (#1405)
- [Theme] Don't truncate double values. (#1419)
- [Grammar] Add support for env(ENV,default).
- [Documentation] documentation fixes.
- [Theme] fix dmenu theme ( #1396).
v1.7.0: Iggy 2024
- ADD: -steal-focus option.
- ADD: [Config] Add nested configuration option support.

159
README.md
View file

@ -1,10 +1,19 @@
[![Issues](https://img.shields.io/github/issues/lbonn/rofi.svg)](https://github.com/lbonn/rofi/issues)
[![Forks](https://img.shields.io/github/forks/lbonn/rofi.svg)](https://github.com/lbonn/rofi/network)
[![Stars](https://img.shields.io/github/stars/lbonn/rofi.svg)](https://github.com/lbonn/rofi/stargazers)
[![Downloads](https://img.shields.io/github/downloads/lbonn/rofi/total.svg)](https://github.com/lbonn/rofi/releases)
[![Packages](https://repology.org/badge/tiny-repos/rofi-wayland.svg)](https://repology.org/metapackage/rofi-wayland/versions)
<p align="center">
<a href="https://github.com/lbonn/rofi/issues"><img src="https://img.shields.io/github/issues/lbonn/rofi.svg"></a>
<a href="https://img.shields.io/github/forks/lbonn/rofi.svg"><img src="https://img.shields.io/github/forks/lbonn/rofi.svg"></a>
<a href="https://github.com/lbonn/rofi/stargazers"><img src="https://img.shields.io/github/stars/lbonn/rofi.svg"></a>
<a href="https://github.com/lbonn/rofi/releases"><img src="https://img.shields.io/github/downloads/lbonn/rofi/total.svg"></a>
<a href="https://github.com/lbonn/rofi/discussions"><img src="https://img.shields.io/badge/forum-online-green.svg"></a>
<a href="https://repology.org/metapackage/rofi-wayland/versions"><img src="https://repology.org/badge/tiny-repos/rofi-wayland.svg"></a>
</p>
<h1 align="center">
Rofi
</h1>
<p align="center"><i>A window switcher, Application launcher and dmenu replacement</i>.</p>
https://user-images.githubusercontent.com/84911063/139428874-fe182dd6-82c6-49b8-8da1-920ddda3d1ed.mp4
# A window switcher, Application launcher and dmenu replacement
**This is a fork of [Rofi](https://github.com/davatorium/rofi) with added support for Wayland via the [layer shell protocol](https://github.com/swaywm/wlr-protocols).**
**For more information, see the [Wayland support section](#wayland-support)**
@ -18,6 +27,34 @@ ssh-launcher, and can act as a drop-in dmenu replacement, making it a very versa
**Rofi**, like dmenu, will provide the user with a textual list of options where one or more can be selected.
This can either be running an application, selecting a window, or options provided by an external script.
## What is rofi not?
Rofi is not:
* A UI toolkit.
* A library to be used in other applications.
* An application that can support every possible use-case. It tries to be generic enough to be usable by everybody.
* Specific functionality can be added using scripts or plugins, many exists.
* Just a dmenu replacement. The dmenu functionality is a nice 'extra' to **rofi**, not its main purpose.
# Table of Contents
- [Features](#features)
- [Modi](#modi)
- [Manpages](#manpage)
- [Installation](#installation)
- [Quickstart](#quickstart)
- [Usage](#usage)
- [Configuration](#configuration)
- [Themes](#themes)
- [Screenshots](#screenshots)
- [Wiki](#wiki)
- [Discussion places](#discussion-places)
# Features
Its main features are:
* Fully configurable keyboard navigation
@ -44,6 +81,8 @@ Its main features are:
* Easily extensible using scripts and plugins
* Advanced Theming
# Modi
**Rofi** has several built-in modi implementing common use cases and can be extended by scripts (either called from
**Rofi** or calling **Rofi**) or plugins.
@ -88,38 +127,108 @@ If you find something does not work and is not listed here, please open a PR.
I do not intend to make releases from this fork at the moment, but will simply try to keep it regularly in sync with the develop branch upstream.
# Screenshots
![screenshot](https://raw.githubusercontent.com/davatorium/rofi/next/releasenotes/1.6.0/icons.png)
![screenshot2](https://raw.githubusercontent.com/davatorium/rofi/next/releasenotes/1.6.0/icons2.png)
![default](https://raw.githubusercontent.com/davatorium/rofi/next/releasenotes/1.4.0/rofi-no-fzf.png)
# Manpage
For more up to date information, please see the manpages:
For more up to date information, please see the manpages. The other sections and links might have outdated information as they have relatively less maintainance than the manpages. So, if you come across any issues please consult manpages, [discussion](https://github.com/davatorium/rofi/discussions) and [issue traker](https://github.com/davatorium/rofi/issues?q=) before filing new issue.
* Manpages:
* [rofi](doc/rofi.1.markdown)
* [rofi-theme](doc/rofi-theme.5.markdown)
* [rofi-script](doc/rofi-script.5.markdown)
* [rofi-theme-selector](doc/rofi-theme-selector.1.markdown)
* Discussion places:
* [Reddit](https://reddit.com/r/qtools/)
* [GitHub Discussions](https://github.com/davatorium/rofi/discussions)
* IRC (#rofi on irc.libera.chat)
* [wiki](https://github.com/davatorium/rofi/wiki) (Currently unmaintained).
# Installation
Please see the [installation guide](INSTALL.md) for instructions on how to
install **Rofi**.
# What is rofi not?
# Quickstart
Rofi is not:
## Usage
* A UI toolkit.
* A library to be used in other applications.
* An application that can support every possible use-case. It tries to be generic enough to be usable by everybody.
* Specific functionality can be added using scripts or plugins, many exists.
* Just a dmenu replacement. The dmenu functionality is a nice 'extra' to **rofi**, not its main purpose.
> **This section just gives a brief overview of the various options. To get the full set of options see the _manpages_ section above**
#### Running rofi
To launch **rofi** directly in a certain mode, specify a mode with `rofi -show <mode>`.
To show the `run` dialog:
rofi -show run
Or get the options from a script:
~/my_script.sh | rofi -dmenu
Specify an ordered, comma-separated list of modes to enable.
Enabled modes can be changed at runtime. Default key is `Ctrl+Tab`.
If no modes are specified, all configured modes will be enabled.
To only show the `run` and `ssh` launcher:
rofi -modi "run,ssh" -show run
The modi to combine in combi mode.
For syntax to `-combi-modi`, see `-modi`.
To get one merge view, of `window`,`run`, and `ssh`:
rofi -show combi -combi-modi "window,run,ssh" -modi combi
## Configuration
Generate a default configuration file
```
mkdir -p ~/.config/rofi
rofi -dump-config > ~/.config/rofi/config.rasi
```
This creates a file called `config.rasi` in the `~/.config/rofi/` folder. You can modify this file to set configuration settings and modify themes. `config.rasi` is the file rofi looks to by default.
Please see the [configuration guide](https://github.com/davatorium/rofi/blob/next/CONFIG.md) for a summary of configuration options. More detailed options are provided in the manpages.
## Themes
Please see the [themes](https://github.com/davatorium/rofi/wiki/themes) section from the [wiki](https://github.com/davatorium/rofi/wiki) for brief reference. More detailed options are provided in the [themes manpages](https://github.com/davatorium/rofi/blob/next/doc/rofi-theme.5.markdown).
The latest bundled themes can be found [here](https://github.com/davatorium/rofi/tree/next/themes).
# Screenshots
Rezlooks:
![screenshot](https://raw.githubusercontent.com/davatorium/rofi/next/releasenotes/1.6.0/icons.png)
Arthur:
![screenshot2](https://raw.githubusercontent.com/davatorium/rofi/next/releasenotes/1.6.0/icons2.png)
Default theme:
![default](https://raw.githubusercontent.com/davatorium/rofi/next/releasenotes/1.4.0/rofi-no-fzf.png)
# Wiki
| ❗ **The Wiki is currently unmaintained and might contain outdated data ** |
| --- |
[Go to wiki](https://github.com/davatorium/rofi/wiki) .
#### Contents
* [Debugging](https://github.com/davatorium/rofi/wiki/Debugging-Rofi)
* [User scripts](https://github.com/davatorium/rofi/wiki/User-scripts)
* [Examples](https://github.com/davatorium/rofi/wiki#examples)
* [dmenu Specs](https://github.com/davatorium/rofi/wiki/dmenu_specs)
* [mode Specs](https://github.com/davatorium/rofi/wiki/mode-Specs)
* [F.A.Q.](https://github.com/davatorium/rofi/wiki/Frequently-Asked-Questions).
* [Script mode](https://github.com/davatorium/rofi/wiki/rfc-script-mode)
* [Creating an issue](https://github.com/davatorium/rofi/blob/master/.github/CONTRIBUTING.md)
* [Creating a Pull request](https://github.com/davatorium/rofi/wiki/Creating-a-pull-request)
# Discussion places:
The [GitHub Discussions](https://github.com/davatorium/rofi/discussions) is the preferred location
for discussions.
* [GitHub Discussions](https://github.com/davatorium/rofi/discussions)
* IRC (#rofi on irc.libera.chat)
* [Reddit](https://reddit.com/r/qtools/)

View file

@ -1,4 +1,4 @@
AC_INIT([rofi], [1.7.0-dev], [https://github.com/davatorium/rofi/],[],[https://reddit.com/r/qtools/])
AC_INIT([rofi], [1.7.1], [https://github.com/davatorium/rofi/],[],[https://reddit.com/r/qtools/])
AC_CONFIG_SRCDIR([source/rofi.c])
AC_CONFIG_HEADER([config.h])

View file

@ -170,8 +170,16 @@ void rofi_view_restart(RofiViewState *state);
*
* @returns TRUE if action was handled.
*/
gboolean rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
guint action);
gboolean rofi_view_check_action(RofiViewState *state, BindingsScope scope,
guint action);
/**
* @param state The handle to the view
* @param scope The scope of the action
* @param action The action
*/
void rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
guint action);
/**
* @param state The handle to the view

View file

@ -279,6 +279,20 @@ gboolean widget_need_redraw(widget *wid);
*/
widget *widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y);
/**
* @param wid The widget handle
* @param action The action to trigger
* @param x A pointer to the x coordinate of the click
* @param y A pointer to the y coordinate of the click
*
* Trigger an action on widget.
* param x and param y are relative to param wid .
*
* @returns Whether the action would be handled or not
*/
WidgetTriggerActionResult widget_check_action(widget *wid, guint action,
gint x, gint y);
/**
* @param wid The widget handle
* @param action The action to trigger

View file

@ -67,6 +67,7 @@ typedef struct YYLTYPE {
while (0)
}
%{
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>

View file

@ -1,5 +1,5 @@
project('rofi', 'c',
version: '1.7.0+wayland1-dev',
version: '1.7.1+wayland1',
meson_version: '>=0.47.0',
license: [ 'MIT' ],
default_options: [

View file

@ -0,0 +1,49 @@
# 1.7.1: Turtley amazing!
This release focusses on fixing bugs found in 1.7.0. The most important ones
are fixing sizing bug, fix nested media statements and broken close-on-delete.
There are a few new features to help themeing: We now support
`env(ENV,default)` statement and when dumping a theme theme-names are resolved
(f.e. `green`, `lightblue`, etc.).
Thanks to everybody reporting bugs, providing patches that made this release possible.
For a more complete list of changes see below.
# Changelog
* [Theme] Fix highlight with only theme.
* Updated documentation and landing page (Thanks to RaZ0rr-Two)
* [Combi] Fix nesting combi modi (#1510)
* [DMenu] Fix crash dmenu mode when no entry is available. (#1504)
* [Run|Drun] Only initialize file-completer on first use.
* [FileBrowser] Reduce number of re-allocs.
* [Readme] Remove generating readme.html for dist.
* [Dmenu] Fix uninitialized memory (non-selectable)
* [FileBrowser] Try to convert invalid encoded text. (#1471)
* [FileBrowser] Don't crash on invalid file filenames. (#1471)
* [Theme] print known colors as its color name.
* [CMD] If failed to convert commandline to new option, do not stop. (#1425)
* [Theme] Fix parsing of nested media blocks. (#1442)
* [Widgets] Fix sizing logic widgets. (#1437)
* [Window] Try to fix auto-sizing of desktop names for non-i3 desktops. (#1439)
* [Window] Fix broken close-on-delete. (#1421)
* [Listview] Correctly check if selected item is highlighted. (#1423)
* [Entry] Allow action to be taken on input change. (#1405)
* [Theme] Don't truncate double values. (#1419)
* [Grammar] Add support for env(ENV,default).
* [Documentation] documentation fixes.
* [Theme] fix dmenu theme ( #1396).
# Thanks
Big thanks to everybody reporting issues.
Special thanks goes to:
* Iggy
* RaZ0rr-Two
* Quentin Glidic
* Danny Colin
* Tuure Piitulainen
Apologies if I mistyped or missed anybody.

View file

@ -67,6 +67,11 @@ static void combi_mode_parse_switchers(Mode *sw) {
// Split token on ','. This modifies switcher_str.
for (char *token = strtok_r(switcher_str, sep, &savept); token != NULL;
token = strtok_r(NULL, sep, &savept)) {
/* Check against recursion. */
if ( g_strcmp0(token, sw->name) == 0 ){
g_warning("You cannot add '%s' to the list of combined modi.", sw->name);
continue;
}
// Resize and add entry.
pd->switchers = (CombiMode *)g_realloc(
pd->switchers, sizeof(CombiMode) * (pd->num_switchers + 1));

View file

@ -28,6 +28,7 @@
/** The log domain of this dialog. */
#define G_LOG_DOMAIN "Dialogs.Script"
#include "config.h"
#include "dialogs/script.h"
#include "helper.h"
#include "rofi.h"

View file

@ -27,410 +27,179 @@
#include "config.h"
#include <string.h>
#include "rofi.h"
#include "nkutils-bindings.h"
#include "xrmoptions.h"
typedef struct {
guint id;
guint scope;
char *name;
char *binding;
char *comment;
typedef struct
{
guint id;
guint scope;
char *name;
char *binding;
char *comment;
} ActionBindingEntry;
/**
* Data structure holding all the action keybinding.
*/
ActionBindingEntry rofi_bindings[] = {
{.id = PASTE_PRIMARY,
.name = "kb-primary-paste",
.binding = "Control+V,Shift+Insert",
.comment = "Paste primary selection"},
{.id = PASTE_SECONDARY,
.name = "kb-secondary-paste",
.binding = "Control+v,Insert",
.comment = "Paste clipboard"},
{.id = CLEAR_LINE,
.name = "kb-clear-line",
.binding = "Control+w",
.comment = "Clear input line"},
{.id = MOVE_FRONT,
.name = "kb-move-front",
.binding = "Control+a",
.comment = "Beginning of line"},
{.id = MOVE_END,
.name = "kb-move-end",
.binding = "Control+e",
.comment = "End of line"},
{.id = MOVE_WORD_BACK,
.name = "kb-move-word-back",
.binding = "Alt+b,Control+Left",
.comment = "Move back one word"},
{.id = MOVE_WORD_FORWARD,
.name = "kb-move-word-forward",
.binding = "Alt+f,Control+Right",
.comment = "Move forward one word"},
{.id = MOVE_CHAR_BACK,
.name = "kb-move-char-back",
.binding = "Left,Control+b",
.comment = "Move back one char"},
{.id = MOVE_CHAR_FORWARD,
.name = "kb-move-char-forward",
.binding = "Right,Control+f",
.comment = "Move forward one char"},
{.id = REMOVE_WORD_BACK,
.name = "kb-remove-word-back",
.binding = "Control+Alt+h,Control+BackSpace",
.comment = "Delete previous word"},
{.id = REMOVE_WORD_FORWARD,
.name = "kb-remove-word-forward",
.binding = "Control+Alt+d",
.comment = "Delete next word"},
{.id = REMOVE_CHAR_FORWARD,
.name = "kb-remove-char-forward",
.binding = "Delete,Control+d",
.comment = "Delete next char"},
{.id = REMOVE_CHAR_BACK,
.name = "kb-remove-char-back",
.binding = "BackSpace,Shift+BackSpace,Control+h",
.comment = "Delete previous char"},
{.id = REMOVE_TO_EOL,
.name = "kb-remove-to-eol",
.binding = "Control+k",
.comment = "Delete till the end of line"},
{.id = REMOVE_TO_SOL,
.name = "kb-remove-to-sol",
.binding = "Control+u",
.comment = "Delete till the start of line"},
{.id = ACCEPT_ENTRY,
.name = "kb-accept-entry",
.binding = "Control+j,Control+m,Return,KP_Enter",
.comment = "Accept entry"},
{.id = ACCEPT_CUSTOM,
.name = "kb-accept-custom",
.binding = "Control+Return",
.comment = "Use entered text as command (in ssh/run modi)"},
{.id = ACCEPT_CUSTOM_ALT,
.name = "kb-accept-custom-alt",
.binding = "Control+Shift+Return",
.comment = "Use entered text as command (in ssh/run modi)"},
{.id = ACCEPT_ALT,
.name = "kb-accept-alt",
.binding = "Shift+Return",
.comment = "Use alternate accept command."},
{.id = DELETE_ENTRY,
.name = "kb-delete-entry",
.binding = "Shift+Delete",
.comment = "Delete entry from history"},
{.id = MODE_NEXT,
.name = "kb-mode-next",
.binding = "Shift+Right,Control+Tab",
.comment = "Switch to the next mode."},
{.id = MODE_PREVIOUS,
.name = "kb-mode-previous",
.binding = "Shift+Left,Control+ISO_Left_Tab",
.comment = "Switch to the previous mode."},
{.id = MODE_COMPLETE,
.name = "kb-mode-complete",
.binding = "Control+l",
.comment = "Start completion for mode."},
{.id = ROW_LEFT,
.name = "kb-row-left",
.binding = "Control+Page_Up",
.comment = "Go to the previous column"},
{.id = ROW_RIGHT,
.name = "kb-row-right",
.binding = "Control+Page_Down",
.comment = "Go to the next column"},
{.id = ROW_UP,
.name = "kb-row-up",
.binding = "Up,Control+p,ISO_Left_Tab",
.comment = "Select previous entry"},
{.id = ROW_DOWN,
.name = "kb-row-down",
.binding = "Down,Control+n",
.comment = "Select next entry"},
{.id = ROW_TAB,
.name = "kb-row-tab",
.binding = "Tab",
.comment =
"Go to next row, if one left, accept it, if no left next mode."},
{.id = PAGE_PREV,
.name = "kb-page-prev",
.binding = "Page_Up",
.comment = "Go to the previous page"},
{.id = PAGE_NEXT,
.name = "kb-page-next",
.binding = "Page_Down",
.comment = "Go to the next page"},
{.id = ROW_FIRST,
.name = "kb-row-first",
.binding = "Home,KP_Home",
.comment = "Go to the first entry"},
{.id = ROW_LAST,
.name = "kb-row-last",
.binding = "End,KP_End",
.comment = "Go to the last entry"},
{.id = ROW_SELECT,
.name = "kb-row-select",
.binding = "Control+space",
.comment = "Set selected item as input text"},
{.id = SCREENSHOT,
.name = "kb-screenshot",
.binding = "Alt+S",
.comment = "Take a screenshot of the rofi window"},
{.id = CHANGE_ELLIPSIZE,
.name = "kb-ellipsize",
.binding = "Alt+period",
.comment = "Toggle between ellipsize modes for displayed data"},
{.id = TOGGLE_CASE_SENSITIVITY,
.name = "kb-toggle-case-sensitivity",
.binding = "grave,dead_grave",
.comment = "Toggle case sensitivity"},
{.id = TOGGLE_SORT,
.name = "kb-toggle-sort",
.binding = "Alt+grave",
.comment = "Toggle sort"},
{.id = CANCEL,
.name = "kb-cancel",
.binding = "Escape,Control+g,Control+bracketleft",
.comment = "Quit rofi"},
{.id = CUSTOM_1,
.name = "kb-custom-1",
.binding = "Alt+1",
.comment = "Custom keybinding 1"},
{.id = CUSTOM_2,
.name = "kb-custom-2",
.binding = "Alt+2",
.comment = "Custom keybinding 2"},
{.id = CUSTOM_3,
.name = "kb-custom-3",
.binding = "Alt+3",
.comment = "Custom keybinding 3"},
{.id = CUSTOM_4,
.name = "kb-custom-4",
.binding = "Alt+4",
.comment = "Custom keybinding 4"},
{.id = CUSTOM_5,
.name = "kb-custom-5",
.binding = "Alt+5",
.comment = "Custom Keybinding 5"},
{.id = CUSTOM_6,
.name = "kb-custom-6",
.binding = "Alt+6",
.comment = "Custom keybinding 6"},
{.id = CUSTOM_7,
.name = "kb-custom-7",
.binding = "Alt+7",
.comment = "Custom Keybinding 7"},
{.id = CUSTOM_8,
.name = "kb-custom-8",
.binding = "Alt+8",
.comment = "Custom keybinding 8"},
{.id = CUSTOM_9,
.name = "kb-custom-9",
.binding = "Alt+9",
.comment = "Custom keybinding 9"},
{.id = CUSTOM_10,
.name = "kb-custom-10",
.binding = "Alt+0",
.comment = "Custom keybinding 10"},
{.id = CUSTOM_11,
.name = "kb-custom-11",
.binding = "Alt+exclam",
.comment = "Custom keybinding 11"},
{.id = CUSTOM_12,
.name = "kb-custom-12",
.binding = "Alt+at",
.comment = "Custom keybinding 12"},
{.id = CUSTOM_13,
.name = "kb-custom-13",
.binding = "Alt+numbersign",
.comment = "Custom keybinding 13"},
{.id = CUSTOM_14,
.name = "kb-custom-14",
.binding = "Alt+dollar",
.comment = "Custom keybinding 14"},
{.id = CUSTOM_15,
.name = "kb-custom-15",
.binding = "Alt+percent",
.comment = "Custom keybinding 15"},
{.id = CUSTOM_16,
.name = "kb-custom-16",
.binding = "Alt+dead_circumflex",
.comment = "Custom keybinding 16"},
{.id = CUSTOM_17,
.name = "kb-custom-17",
.binding = "Alt+ampersand",
.comment = "Custom keybinding 17"},
{.id = CUSTOM_18,
.name = "kb-custom-18",
.binding = "Alt+asterisk",
.comment = "Custom keybinding 18"},
{.id = CUSTOM_19,
.name = "kb-custom-19",
.binding = "Alt+parenleft",
.comment = "Custom Keybinding 19"},
{.id = SELECT_ELEMENT_1,
.name = "kb-select-1",
.binding = "Super+1",
.comment = "Select row 1"},
{.id = SELECT_ELEMENT_2,
.name = "kb-select-2",
.binding = "Super+2",
.comment = "Select row 2"},
{.id = SELECT_ELEMENT_3,
.name = "kb-select-3",
.binding = "Super+3",
.comment = "Select row 3"},
{.id = SELECT_ELEMENT_4,
.name = "kb-select-4",
.binding = "Super+4",
.comment = "Select row 4"},
{.id = SELECT_ELEMENT_5,
.name = "kb-select-5",
.binding = "Super+5",
.comment = "Select row 5"},
{.id = SELECT_ELEMENT_6,
.name = "kb-select-6",
.binding = "Super+6",
.comment = "Select row 6"},
{.id = SELECT_ELEMENT_7,
.name = "kb-select-7",
.binding = "Super+7",
.comment = "Select row 7"},
{.id = SELECT_ELEMENT_8,
.name = "kb-select-8",
.binding = "Super+8",
.comment = "Select row 8"},
{.id = SELECT_ELEMENT_9,
.name = "kb-select-9",
.binding = "Super+9",
.comment = "Select row 9"},
{.id = SELECT_ELEMENT_10,
.name = "kb-select-10",
.binding = "Super+0",
.comment = "Select row 10"},
ActionBindingEntry rofi_bindings[] =
{
{ .id = PASTE_PRIMARY, .name = "kb-primary-paste", .binding = "Control+V,Shift+Insert", .comment = "Paste primary selection" },
{ .id = PASTE_SECONDARY, .name = "kb-secondary-paste", .binding = "Control+v,Insert", .comment = "Paste clipboard" },
{ .id = CLEAR_LINE, .name = "kb-clear-line", .binding = "Control+w", .comment = "Clear input line" },
{ .id = MOVE_FRONT, .name = "kb-move-front", .binding = "Control+a", .comment = "Beginning of line" },
{ .id = MOVE_END, .name = "kb-move-end", .binding = "Control+e", .comment = "End of line" },
{ .id = MOVE_WORD_BACK, .name = "kb-move-word-back", .binding = "Alt+b,Control+Left", .comment = "Move back one word" },
{ .id = MOVE_WORD_FORWARD, .name = "kb-move-word-forward", .binding = "Alt+f,Control+Right", .comment = "Move forward one word" },
{ .id = MOVE_CHAR_BACK, .name = "kb-move-char-back", .binding = "Left,Control+b", .comment = "Move back one char" },
{ .id = MOVE_CHAR_FORWARD, .name = "kb-move-char-forward", .binding = "Right,Control+f", .comment = "Move forward one char" },
{ .id = REMOVE_WORD_BACK, .name = "kb-remove-word-back", .binding = "Control+Alt+h,Control+BackSpace", .comment = "Delete previous word" },
{ .id = REMOVE_WORD_FORWARD, .name = "kb-remove-word-forward", .binding = "Control+Alt+d", .comment = "Delete next word" },
{ .id = REMOVE_CHAR_FORWARD, .name = "kb-remove-char-forward", .binding = "Delete,Control+d", .comment = "Delete next char" },
{ .id = REMOVE_CHAR_BACK, .name = "kb-remove-char-back", .binding = "BackSpace,Shift+BackSpace,Control+h", .comment = "Delete previous char" },
{ .id = REMOVE_TO_EOL, .name = "kb-remove-to-eol", .binding = "Control+k", .comment = "Delete till the end of line" },
{ .id = REMOVE_TO_SOL, .name = "kb-remove-to-sol", .binding = "Control+u", .comment = "Delete till the start of line" },
{ .id = ACCEPT_ENTRY, .name = "kb-accept-entry", .binding = "Control+j,Control+m,Return,KP_Enter", .comment = "Accept entry" },
{ .id = ACCEPT_CUSTOM, .name = "kb-accept-custom", .binding = "Control+Return", .comment = "Use entered text as command (in ssh/run modi)" },
{ .id = ACCEPT_CUSTOM_ALT, .name = "kb-accept-custom-alt", .binding = "Control+Shift+Return", .comment = "Use entered text as command (in ssh/run modi)" },
{ .id = ACCEPT_ALT, .name = "kb-accept-alt", .binding = "Shift+Return", .comment = "Use alternate accept command." },
{ .id = DELETE_ENTRY, .name = "kb-delete-entry", .binding = "Shift+Delete", .comment = "Delete entry from history" },
{ .id = MODE_NEXT, .name = "kb-mode-next", .binding = "Shift+Right,Control+Tab", .comment = "Switch to the next mode." },
{ .id = MODE_PREVIOUS, .name = "kb-mode-previous", .binding = "Shift+Left,Control+ISO_Left_Tab", .comment = "Switch to the previous mode." },
{ .id = MODE_COMPLETE, .name = "kb-mode-complete", .binding = "Control+l", .comment = "Start completion for mode." },
{ .id = ROW_LEFT, .name = "kb-row-left", .binding = "Control+Page_Up", .comment = "Go to the previous column" },
{ .id = ROW_RIGHT, .name = "kb-row-right", .binding = "Control+Page_Down", .comment = "Go to the next column" },
{ .id = ROW_UP, .name = "kb-row-up", .binding = "Up,Control+p,ISO_Left_Tab", .comment = "Select previous entry" },
{ .id = ROW_DOWN, .name = "kb-row-down", .binding = "Down,Control+n", .comment = "Select next entry" },
{ .id = ROW_TAB, .name = "kb-row-tab", .binding = "Tab", .comment = "Go to next row, if one left, accept it, if no left next mode." },
{ .id = PAGE_PREV, .name = "kb-page-prev", .binding = "Page_Up", .comment = "Go to the previous page" },
{ .id = PAGE_NEXT, .name = "kb-page-next", .binding = "Page_Down", .comment = "Go to the next page" },
{ .id = ROW_FIRST, .name = "kb-row-first", .binding = "Home,KP_Home", .comment = "Go to the first entry" },
{ .id = ROW_LAST, .name = "kb-row-last", .binding = "End,KP_End", .comment = "Go to the last entry" },
{ .id = ROW_SELECT, .name = "kb-row-select", .binding = "Control+space", .comment = "Set selected item as input text" },
{ .id = SCREENSHOT, .name = "kb-screenshot", .binding = "Alt+S", .comment = "Take a screenshot of the rofi window" },
{ .id = CHANGE_ELLIPSIZE, .name = "kb-ellipsize", .binding = "Alt+period", .comment = "Toggle between ellipsize modes for displayed data" },
{ .id = TOGGLE_CASE_SENSITIVITY, .name = "kb-toggle-case-sensitivity", .binding = "grave,dead_grave", .comment = "Toggle case sensitivity" },
{ .id = TOGGLE_SORT, .name = "kb-toggle-sort", .binding = "Alt+grave", .comment = "Toggle sort" },
{ .id = CANCEL, .name = "kb-cancel", .binding = "Escape,Control+g,Control+bracketleft", .comment = "Quit rofi" },
{ .id = CUSTOM_1, .name = "kb-custom-1", .binding = "Alt+1", .comment = "Custom keybinding 1" },
{ .id = CUSTOM_2, .name = "kb-custom-2", .binding = "Alt+2", .comment = "Custom keybinding 2" },
{ .id = CUSTOM_3, .name = "kb-custom-3", .binding = "Alt+3", .comment = "Custom keybinding 3" },
{ .id = CUSTOM_4, .name = "kb-custom-4", .binding = "Alt+4", .comment = "Custom keybinding 4" },
{ .id = CUSTOM_5, .name = "kb-custom-5", .binding = "Alt+5", .comment = "Custom Keybinding 5" },
{ .id = CUSTOM_6, .name = "kb-custom-6", .binding = "Alt+6", .comment = "Custom keybinding 6" },
{ .id = CUSTOM_7, .name = "kb-custom-7", .binding = "Alt+7", .comment = "Custom Keybinding 7" },
{ .id = CUSTOM_8, .name = "kb-custom-8", .binding = "Alt+8", .comment = "Custom keybinding 8" },
{ .id = CUSTOM_9, .name = "kb-custom-9", .binding = "Alt+9", .comment = "Custom keybinding 9" },
{ .id = CUSTOM_10, .name = "kb-custom-10", .binding = "Alt+0", .comment = "Custom keybinding 10" },
{ .id = CUSTOM_11, .name = "kb-custom-11", .binding = "Alt+exclam", .comment = "Custom keybinding 11" },
{ .id = CUSTOM_12, .name = "kb-custom-12", .binding = "Alt+at", .comment = "Custom keybinding 12" },
{ .id = CUSTOM_13, .name = "kb-custom-13", .binding = "Alt+numbersign", .comment = "Custom keybinding 13" },
{ .id = CUSTOM_14, .name = "kb-custom-14", .binding = "Alt+dollar", .comment = "Custom keybinding 14" },
{ .id = CUSTOM_15, .name = "kb-custom-15", .binding = "Alt+percent", .comment = "Custom keybinding 15" },
{ .id = CUSTOM_16, .name = "kb-custom-16", .binding = "Alt+dead_circumflex", .comment = "Custom keybinding 16" },
{ .id = CUSTOM_17, .name = "kb-custom-17", .binding = "Alt+ampersand", .comment = "Custom keybinding 17" },
{ .id = CUSTOM_18, .name = "kb-custom-18", .binding = "Alt+asterisk", .comment = "Custom keybinding 18" },
{ .id = CUSTOM_19, .name = "kb-custom-19", .binding = "Alt+parenleft", .comment = "Custom Keybinding 19" },
{ .id = SELECT_ELEMENT_1, .name = "kb-select-1", .binding = "Super+1", .comment = "Select row 1" },
{ .id = SELECT_ELEMENT_2, .name = "kb-select-2", .binding = "Super+2", .comment = "Select row 2" },
{ .id = SELECT_ELEMENT_3, .name = "kb-select-3", .binding = "Super+3", .comment = "Select row 3" },
{ .id = SELECT_ELEMENT_4, .name = "kb-select-4", .binding = "Super+4", .comment = "Select row 4" },
{ .id = SELECT_ELEMENT_5, .name = "kb-select-5", .binding = "Super+5", .comment = "Select row 5" },
{ .id = SELECT_ELEMENT_6, .name = "kb-select-6", .binding = "Super+6", .comment = "Select row 6" },
{ .id = SELECT_ELEMENT_7, .name = "kb-select-7", .binding = "Super+7", .comment = "Select row 7" },
{ .id = SELECT_ELEMENT_8, .name = "kb-select-8", .binding = "Super+8", .comment = "Select row 8" },
{ .id = SELECT_ELEMENT_9, .name = "kb-select-9", .binding = "Super+9", .comment = "Select row 9" },
{ .id = SELECT_ELEMENT_10, .name = "kb-select-10", .binding = "Super+0", .comment = "Select row 10" },
/* Mouse-aware bindings */
{.id = SCROLL_LEFT,
.scope = SCOPE_MOUSE_LISTVIEW,
.name = "ml-row-left",
.binding = "ScrollLeft",
.comment = "Go to the previous column"},
{.id = SCROLL_RIGHT,
.scope = SCOPE_MOUSE_LISTVIEW,
.name = "ml-row-right",
.binding = "ScrollRight",
.comment = "Go to the next column"},
{.id = SCROLL_UP,
.scope = SCOPE_MOUSE_LISTVIEW,
.name = "ml-row-up",
.binding = "ScrollUp",
.comment = "Select previous entry"},
{.id = SCROLL_DOWN,
.scope = SCOPE_MOUSE_LISTVIEW,
.name = "ml-row-down",
.binding = "ScrollDown",
.comment = "Select next entry"},
{ .id = SCROLL_LEFT, .scope = SCOPE_MOUSE_LISTVIEW, .name = "ml-row-left", .binding = "ScrollLeft", .comment = "Go to the previous column" },
{ .id = SCROLL_RIGHT, .scope = SCOPE_MOUSE_LISTVIEW, .name = "ml-row-right", .binding = "ScrollRight", .comment = "Go to the next column" },
{ .id = SCROLL_UP, .scope = SCOPE_MOUSE_LISTVIEW, .name = "ml-row-up", .binding = "ScrollUp", .comment = "Select previous entry" },
{ .id = SCROLL_DOWN, .scope = SCOPE_MOUSE_LISTVIEW, .name = "ml-row-down", .binding = "ScrollDown", .comment = "Select next entry" },
{.id = SELECT_HOVERED_ENTRY,
.scope = SCOPE_MOUSE_LISTVIEW_ELEMENT,
.name = "me-select-entry",
.binding = "MousePrimary",
.comment = "Select hovered row"},
{.id = ACCEPT_HOVERED_ENTRY,
.scope = SCOPE_MOUSE_LISTVIEW_ELEMENT,
.name = "me-accept-entry",
.binding = "MouseDPrimary",
.comment = "Accept hovered row"},
{.id = ACCEPT_HOVERED_CUSTOM,
.scope = SCOPE_MOUSE_LISTVIEW_ELEMENT,
.name = "me-accept-custom",
.binding = "Control+MouseDPrimary",
.comment = "Accept hovered row with custom action"},
{ .id = SELECT_HOVERED_ENTRY, .scope = SCOPE_MOUSE_LISTVIEW_ELEMENT, .name = "me-select-entry", .binding = "MousePrimary", .comment = "Select hovered row" },
{ .id = ACCEPT_HOVERED_ENTRY, .scope = SCOPE_MOUSE_LISTVIEW_ELEMENT, .name = "me-accept-entry", .binding = "MouseDPrimary", .comment = "Accept hovered row" },
{ .id = ACCEPT_HOVERED_CUSTOM, .scope = SCOPE_MOUSE_LISTVIEW_ELEMENT, .name = "me-accept-custom", .binding = "Control+MouseDPrimary", .comment = "Accept hovered row with custom action"},
};
/** Default binding of mouse button to action. */
static const gchar *mouse_default_bindings[] = {
[MOUSE_CLICK_DOWN] = "MousePrimary",
[MOUSE_CLICK_UP] = "!MousePrimary",
[MOUSE_CLICK_DOWN] = "MousePrimary",
[MOUSE_CLICK_UP] = "!MousePrimary",
[MOUSE_DCLICK_DOWN] = "MouseDPrimary",
[MOUSE_DCLICK_UP] = "!MouseDPrimary",
[MOUSE_DCLICK_UP] = "!MouseDPrimary",
};
void setup_abe(void) {
for (gsize i = 0; i < G_N_ELEMENTS(rofi_bindings); ++i) {
ActionBindingEntry *b = &rofi_bindings[i];
b->binding = g_strdup(b->binding);
config_parser_add_option(xrm_String, b->name, (void **)&(b->binding),
b->comment);
}
void setup_abe ( void )
{
for ( gsize i = 0; i < G_N_ELEMENTS ( rofi_bindings ); ++i ) {
ActionBindingEntry *b = &rofi_bindings[i];
b->binding = g_strdup ( b->binding );
config_parser_add_option ( xrm_String, b->name, (void * *) &( b->binding ), b->comment );
}
}
static gboolean binding_trigger_action(guint64 scope,
G_GNUC_UNUSED gpointer target,
gpointer user_data) {
return rofi_view_trigger_action(rofi_view_get_active(), scope,
GPOINTER_TO_UINT(user_data));
static gboolean binding_check_action ( guint64 scope, G_GNUC_UNUSED gpointer target, gpointer user_data )
{
return rofi_view_check_action ( rofi_view_get_active (), scope, GPOINTER_TO_UINT ( user_data ) ) ? NK_BINDINGS_BINDING_TRIGGERED : NK_BINDINGS_BINDING_NOT_TRIGGERED;
}
guint key_binding_get_action_from_name(const char *name) {
for (gsize i = 0; i < G_N_ELEMENTS(rofi_bindings); ++i) {
static void binding_trigger_action ( guint64 scope, G_GNUC_UNUSED gpointer target, gpointer user_data )
{
rofi_view_trigger_action ( rofi_view_get_active (), scope, GPOINTER_TO_UINT ( user_data ) );
}
guint key_binding_get_action_from_name ( const char *name )
{
for ( gsize i = 0; i < G_N_ELEMENTS ( rofi_bindings ); ++i ) {
ActionBindingEntry *b = &rofi_bindings[i];
if (g_strcmp0(b->name, name) == 0) {
if ( g_strcmp0(b->name, name) == 0 ) {
return b->id;
}
}
return UINT32_MAX;
}
gboolean parse_keys_abe(NkBindings *bindings) {
GError *error = NULL;
GString *error_msg = g_string_new("");
for (gsize i = 0; i < G_N_ELEMENTS(rofi_bindings); ++i) {
ActionBindingEntry *b = &rofi_bindings[i];
char *keystr = g_strdup(b->binding);
char *sp = NULL;
// Iter over bindings.
const char *const sep = ",";
for (char *entry = strtok_r(keystr, sep, &sp); entry != NULL;
entry = strtok_r(NULL, sep, &sp)) {
if (!nk_bindings_add_binding(bindings, b->scope, entry,
binding_trigger_action,
GUINT_TO_POINTER(b->id), NULL, &error)) {
char *str = g_markup_printf_escaped(
"Failed to set binding <i>%s</i> for: <i>%s (%s)</i>:\n\t<span "
"size=\"smaller\" style=\"italic\">%s</span>\n",
b->binding, b->comment, b->name, error->message);
g_string_append(error_msg, str);
g_free(str);
g_clear_error(&error);
}
gboolean parse_keys_abe ( NkBindings *bindings )
{
GError *error = NULL;
GString *error_msg = g_string_new ( "" );
for ( gsize i = 0; i < G_N_ELEMENTS ( rofi_bindings ); ++i ) {
ActionBindingEntry *b = &rofi_bindings[i];
char *keystr = g_strdup ( b->binding );
char *sp = NULL;
// Iter over bindings.
const char *const sep = ",";
for ( char *entry = strtok_r ( keystr, sep, &sp ); entry != NULL; 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 ) ) {
char *str = g_markup_printf_escaped ( "Failed to set binding <i>%s</i> for: <i>%s (%s)</i>:\n\t<span size=\"smaller\" style=\"italic\">%s</span>\n",
b->binding, b->comment, b->name, error->message );
g_string_append ( error_msg, str );
g_free ( str );
g_clear_error ( &error );
}
}
g_free ( keystr );
}
if ( error_msg->len > 0 ) {
//rofi_view_error_dialog ( error_msg->str, TRUE );
rofi_add_error_message ( error_msg );
// g_string_free ( error_msg, TRUE );
return FALSE;
}
g_free(keystr);
}
if (error_msg->len > 0) {
// rofi_view_error_dialog ( error_msg->str, TRUE );
rofi_add_error_message(error_msg);
// g_string_free ( error_msg, TRUE );
return FALSE;
}
for (gsize i = SCOPE_MIN_FIXED; i <= SCOPE_MAX_FIXED; ++i) {
for (gsize j = 1; j < G_N_ELEMENTS(mouse_default_bindings); ++j) {
nk_bindings_add_binding(bindings, i, mouse_default_bindings[j],
binding_trigger_action, GSIZE_TO_POINTER(j), NULL,
NULL);
for ( gsize i = SCOPE_MIN_FIXED; i <= SCOPE_MAX_FIXED; ++i ) {
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 );
}
}
}
g_string_free(error_msg, TRUE);
return TRUE;
g_string_free ( error_msg, TRUE );
return TRUE;
}

View file

@ -387,7 +387,7 @@ static void help_print_disabled_mode(const char *mode) {
color_red, mode, color_reset);
fprintf(stderr,
"Please consider adding %s%s%s to the list of enabled modi: "
"%smodi: %s%s%s,%s%s.\n",
"%smodi: [%s%s%s,%s]%s.\n",
color_red, mode, color_reset, color_green, config.modi, color_reset,
color_red, mode, color_reset);
}

View file

@ -1238,8 +1238,21 @@ rofi_theme_get_highlight_inside(Property *p, widget *widget,
th);
}
return th;
} else if (p->type == P_COLOR) {
th.style = ROFI_HL_NONE | ROFI_HL_COLOR;
th.color = p->value.color;
return th;
}
return p->value.highlight;
} else {
ThemeWidget *wid =
rofi_theme_find_widget(widget->name, widget->state, FALSE);
Property *p = rofi_theme_find_property(wid, P_COLOR, property, FALSE);
if (p != NULL) {
return rofi_theme_get_highlight_inside(p, widget, property, th);
}
return th;
}
g_debug("Theme entry: #%s %s property %s unset.", widget->name,
widget->state ? widget->state : "", property);
@ -1250,6 +1263,9 @@ RofiHighlightColorStyle rofi_theme_get_highlight(widget *widget,
RofiHighlightColorStyle th) {
ThemeWidget *wid = rofi_theme_find_widget(widget->name, widget->state, FALSE);
Property *p = rofi_theme_find_property(wid, P_HIGHLIGHT, property, FALSE);
if (p == NULL) {
p = rofi_theme_find_property(wid, P_COLOR, property, FALSE);
}
return rofi_theme_get_highlight_inside(p, widget, property, th);
}
static int get_pixels(RofiDistanceUnit *unit, RofiOrientation ori) {

View file

@ -881,12 +881,10 @@ static void rofi_view_trigger_global_action(KeyBindingAction action) {
}
}
gboolean rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
guint action) {
rofi_view_set_user_timeout(NULL);
gboolean rofi_view_check_action(RofiViewState *state, BindingsScope scope,
guint action) {
switch (scope) {
case SCOPE_GLOBAL:
rofi_view_trigger_global_action(action);
return TRUE;
case SCOPE_MOUSE_LISTVIEW:
case SCOPE_MOUSE_LISTVIEW_ELEMENT:
@ -900,15 +898,11 @@ gboolean rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
return FALSE;
}
widget_xy_to_relative(target, &x, &y);
switch (widget_trigger_action(target, action, x, y)) {
switch (widget_check_action(target, action, x, y)) {
case WIDGET_TRIGGER_ACTION_RESULT_IGNORED:
return FALSE;
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END:
target = NULL;
/* FALLTHRU */
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN:
state->mouse.motion_target = target;
/* FALLTHRU */
case WIDGET_TRIGGER_ACTION_RESULT_HANDLED:
return TRUE;
}
@ -918,6 +912,42 @@ gboolean rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
return FALSE;
}
void rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
guint action) {
rofi_view_set_user_timeout(NULL);
switch (scope) {
case SCOPE_GLOBAL:
rofi_view_trigger_global_action(action);
return;
case SCOPE_MOUSE_LISTVIEW:
case SCOPE_MOUSE_LISTVIEW_ELEMENT:
case SCOPE_MOUSE_EDITBOX:
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 (target == NULL) {
return;
}
widget_xy_to_relative(target, &x, &y);
switch (widget_trigger_action(target, action, x, y)) {
case WIDGET_TRIGGER_ACTION_RESULT_IGNORED:
return;
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END:
target = NULL;
/* FALLTHRU */
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN:
state->mouse.motion_target = target;
/* FALLTHRU */
case WIDGET_TRIGGER_ACTION_RESULT_HANDLED:
return;
}
break;
}
}
}
void rofi_view_handle_text(RofiViewState *state, char *text) {
if (textbox_append_text(state->text, text, strlen(text))) {
state->refilter = TRUE;

View file

@ -548,6 +548,21 @@ widget *widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y) {
return NULL;
}
WidgetTriggerActionResult widget_check_action(widget *wid, guint action,
gint x, gint y) {
if (wid == NULL) {
return FALSE;
}
if (wid->trigger_action == NULL) {
return FALSE;
}
/*
* TODO: We should probably add a check_action callback to the widgets
* to do extra checks
*/
return WIDGET_TRIGGER_ACTION_RESULT_HANDLED;
}
WidgetTriggerActionResult widget_trigger_action(widget *wid, guint action,
gint x, gint y) {
if (wid == NULL) {

@ -1 +1 @@
Subproject commit 6164bacaef10031ce77380499cfad2ae818ab6b0
Subproject commit d08fa898d71da4c11653284968ec14384dd70b6a

View file

@ -95,10 +95,13 @@ RofiViewState * rofi_view_get_active ( void )
{
return NULL;
}
gboolean rofi_view_trigger_action ( G_GNUC_UNUSED RofiViewState *state, G_GNUC_UNUSED BindingsScope scope, G_GNUC_UNUSED guint action )
gboolean rofi_view_check_action ( G_GNUC_UNUSED RofiViewState *state, G_GNUC_UNUSED BindingsScope scope, G_GNUC_UNUSED guint action )
{
return FALSE;
}
void rofi_view_trigger_action ( G_GNUC_UNUSED RofiViewState *state, G_GNUC_UNUSED BindingsScope scope, G_GNUC_UNUSED guint action )
{
}
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
{