Skip to content

Commit

Permalink
[Wayland] Make bindings inhibitor opt-in
Browse files Browse the repository at this point in the history
Fixes #119
  • Loading branch information
lbonn committed Feb 28, 2024
1 parent b847cb3 commit 0cec298
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Settings config = {
.scroll_method = 0,
.window_format = "{w} {c} {t}",
.click_to_exit = TRUE,
.global_kbindings = FALSE,
.theme = NULL,
.plugin_path = PLUGIN_PATH,
.max_history_size = 25,
Expand Down
3 changes: 3 additions & 0 deletions include/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ typedef struct {
/** Click outside the window to exit */
int click_to_exit;

/** Try to take over compositor's global bindings (on Wayland) */
gboolean global_kbindings;

char *theme;
/** Path where plugins can be found. */
char *plugin_path;
Expand Down
7 changes: 7 additions & 0 deletions mkdocs/docs/1.7.0/rofi.1.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,13 @@ Click the mouse outside the **rofi** window to exit.

Default: *enabled*

`-global-kbindings`
`-no-global-kbindings`

(wayland) Override the compositor's keybindings, so that **rofi** can re-use them.

Default: *disabled*

## PATTERN

To launch commands (for example, when using the ssh launcher), the user can enter the used command-line. The following keys can be used that will be replaced at runtime:
Expand Down
2 changes: 1 addition & 1 deletion source/wayland/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ static gboolean wayland_display_late_setup(void) {
zwlr_layer_surface_v1_add_listener(
wayland->wlr_surface, &wayland_layer_shell_surface_listener, NULL);

if (wayland->kb_shortcuts_inhibit_manager) {
if (config.global_kbindings && wayland->kb_shortcuts_inhibit_manager) {
g_debug("inhibit shortcuts from compositor");
GHashTableIter iter;
wayland_seat *seat;
Expand Down
6 changes: 6 additions & 0 deletions source/xrmoptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@ static XrmOption xrmOptions[] = {
NULL,
"Click outside the window to exit",
CONFIG_DEFAULT},
{xrm_Boolean,
"global-kbindings",
{.snum = &config.global_kbindings},
NULL,
"Click outside the window to exit",
CONFIG_DEFAULT},
{xrm_String,
"theme",
{.str = &config.theme},
Expand Down

0 comments on commit 0cec298

Please sign in to comment.