rofi icon indicating copy to clipboard operation
rofi copied to clipboard

[REQUEST] Ability to close rofi on outside click.

Open NezarecSh opened this issue 5 months ago • 11 comments

Before opening a feature request

  • [x] I checked the next branch to see if the feature has already been implemented
  • [x] I searched existing reports to see if it is already requested.

What is the user problem or growth opportunity you want to see solved?

Currently, the only way to close rofi is by either selecting something from the menu or pressing Esc.

I'm a very big noob to this, but is it not possible to just add a "button" that fills up the entire background of rofi to close the window? Imagine clicking anywhere "outside" the rofi window to close rofi. its not like you can click outside of rofi when its open anyway. (unless you use a script)

Again, I only got into linux like 3 days ago so bear with me haha!

How do you know that this problem exists today? Why is this important?

its annoying having to reach for the escape button every time.

Who will benefit from it?

probably everyone

Rofi version (rofi -v)

Version: 1.7.9.1-dirty

Configuration

N/A

Additional information

No response

NezarecSh avatar Jul 15 '25 09:07 NezarecSh

Are you on wayland or X11.. On X11 this is already supported and the default, not sure if on wayland.

(-no-click-to-exit/-click-to-exit option).

DaveDavenport avatar Jul 15 '25 11:07 DaveDavenport

Are you on wayland or X11.. On X11 this is already supported and the default, not sure if on wayland.

(-no-click-to-exit/-click-to-exit option).

Oh sorry forgot to mention I'm on Wayland. Does that mean it's not possible on Wayland? The point is to have a clickable area instead of tracking the click events which Wayland doesn't really support.

NezarecSh avatar Jul 15 '25 11:07 NezarecSh

@lbonn Do you know if this is possible to get working on wayland?

DaveDavenport avatar Jul 15 '25 11:07 DaveDavenport

This was the original tracking issue https://github.com/lbonn/rofi/issues/22

There was an attempt here https://github.com/lbonn/rofi/pull/95 but we did not find a good solution for this yet

lbonn avatar Jul 15 '25 13:07 lbonn

This was the original tracking issue lbonn#22

There was an attempt here lbonn#95 but we did not find a good solution for this yet

wait... isnt this solved? from what i understand there was a bug in hyperland which made this method inconsistent but 2 weeks later it was fixed here and no one mentioned anything about it.

NezarecSh avatar Jul 15 '25 13:07 NezarecSh

@NezarecSh reading the original thread, the fact that it worked was actually the "bug" and after they've fixed it it should not anymore (ie: the PR was exploiting a bug)

You can research this further if you'd like, for example trying the original patch but I think it wouldn't work on recent hyprland and certainly not on other compositors.

lbonn avatar Jul 15 '25 14:07 lbonn

So what swaync does is that the layer extends to all of the monitor edges, making it cover the whole screen which allows for detecting outside clicks. It also spawns other fully transparent windows for the other monitors that close on click

ErikReider avatar Aug 17 '25 09:08 ErikReider

@ErikReider thanks! Yes that's the only reliable way that I would know about.

We were testing similar solutions for reliable scaling and on it resulted in some visual artifacts on Hyprland which has animations on layer shell spawn. But if it's properly documented and behind a switch, this sounds like the way forward.

lbonn avatar Aug 18 '25 08:08 lbonn

This combination of settings technically makes it work for me, at least on hyprland:

me-select-entry: "";
me-accept-entry: "!MousePrimary"; 
kb-cancel: "MousePrimary";

kb-cancel (closes rofi) only triggers if I am not clicking on a clickable element in this case, e.g. if I click outside the window or on empty space in the window.

Probably best to use it with this too:

hover-select: true;

Rabcor avatar Nov 20 '25 06:11 Rabcor

@Rabcor Thats cool! Kinda sucks that clicking accidentally between two elements in the rofi window would also cause it to close.

@lbonn wouldn't be easier to use this method instead but have it so that the whole rofi window is clickable so that it doesn't close when clicked between elements? It sounds easier and more efficient to use this instead of filling the whole display with a button.

NezarecSh avatar Nov 20 '25 07:11 NezarecSh

It would also be great if Rofi window would close when it loses focus. There's a similar discussion in #396, but Wayland seems to be a separate issue.

segln avatar Nov 30 '25 00:11 segln