davatorium / rofi

Rofi: A window switcher, application launcher and dmenu replacement
https://davatorium.github.io/rofi/
Other
13.06k stars 608 forks source link

[REQUEST] A new location option: on top of the active window #1163

Closed useredsa closed 4 years ago

useredsa commented 4 years ago

I think it would be really handy to have extra location options relative to the current active window instead of the entire screen. This way, we could make rofi appear in the top or the bottom of the current window, effectively adding menus to our applicattions.

I think we should be able to adapt the width/height ton the window size as well.

When reporting a feature request include the following information:

DaveDavenport commented 4 years ago

This feature already exists. See manpage under 'monitor' you can select the 'current window' option, that does exactly what you want.

useredsa commented 4 years ago

This feature already exists. See manpage under 'monitor' you can select the 'current window' option, that does exactly what you want.

Yes. I should have noticed. Thank you!

Unfortunately, rofi always takes the first window as the reference window, instead of the active window. I'm using bspwm. May I ask if this is a known bug? Shall I start a new issue?

DaveDavenport commented 4 years ago

Rofi uses the xcb_ewmh_get_active_window command, so it depends on bspwm correctly setting this property.

(for me in i3 it works correctly.)

useredsa commented 4 years ago

Rofi uses the xcb_ewmh_get_active_window command, so it depends on bspwm correctly setting this property.

(for me in i3 it works correctly.)

However, xdo and xdotool manage to get the active/focused window without problems. How could I check via the terminal if bspwm is setting it correctly?

useredsa commented 4 years ago

@DaveDavenport Could you suggest a way of debugging the problem?

DaveDavenport commented 4 years ago

See wiki, you can get extra debug output. The info should be in the X11Helper domain.

useredsa commented 4 years ago

See wiki, you can get extra debug output. The info should be in the X11Helper domain.

For now, I've checked that rofi is actually choosing the focused window correctly. However, rofi appears at the top left border of the screen instead of the top left border of the window (even though the width is set accordingly to that of the window). I need to check what the code does with the coordinates.

DaveDavenport commented 4 years ago

Can you get the log?

G_MESSAGES_DEBUG=X11Helper rofi -show run -monitor -2
useredsa commented 4 years ago

Can you get the log?

G_MESSAGES_DEBUG=X11Helper rofi -show run -monitor -2

I had tried the option but nothing seemed important to me on the output.

[useredsa@Device002 ~]$ G_MESSAGES_DEBUG=X11Helper rofi -show run -monitor -2
(process:129473): X11Helper-DEBUG: 19:49:58.085: Query RANDR for monitor layout.
(process:129473): X11Helper-DEBUG: 19:49:58.085: Randr XCB api version: 1.6.
(process:129473): X11Helper-DEBUG: 19:49:58.085: Found randr version: 1.5
(process:129473): X11Helper-DEBUG: 19:49:58.085: Found window manager: bspwm
(process:129473): Helper-DEBUG: 19:49:58.092: Opening theme, testing: /home/useredsa/.config/rofi/config.rasi

(process:129473): Helper-DEBUG: 19:49:58.093: Opening theme, testing: /usr/share/rofi/themes/gruvbox-dark.rasi

(process:129473): Helper-DEBUG: 19:49:58.093: Opening theme, testing: gruvbox-common.rasi

(process:129473): Helper-DEBUG: 19:49:58.093: Opening theme, testing: /home/useredsa/.config/rofi/gruvbox-common.rasi

(process:129473): Helper-DEBUG: 19:49:58.093: Opening theme, testing: /home/useredsa/.local/share/rofi/themes/gruvbox-common.rasi

(process:129473): Helper-DEBUG: 19:49:58.093: Opening theme, testing: /usr/share/rofi/themes/gruvbox-common.rasi

(process:129473): X11Helper-DEBUG: 19:50:10.287: Cleaning up XCB and XKB

I think It'd be best to download the repository and start debugging using the code. I'll try to do it tonight.

DaveDavenport commented 4 years ago

ok, thanks. so it does not throw an error trying to get the info, it seems to get invalid info.

DaveDavenport commented 4 years ago

I think I might know what it is in 'monitor_active_from_id_focused' it gets the active window, then its parents and locates it based on that. if bspwm does not have this 'decorative' window it might get root window instead.

useredsa commented 4 years ago

I think I might know what it is in 'monitor_active_from_id_focused' it gets the active window, then its parents and locates it based on that. if bspwm does not have this 'decorative' window it might get root window instead.

May I ask, should bspwm create an extra window? At least I should be able to change the code then to have a working version.

DaveDavenport commented 4 years ago

It is unconfirmed yet, more an idea. This is just the difficulty trying to support many wm's.

DaveDavenport commented 4 years ago

Hmm if I run it in bspwm I get:

(process:21704): X11Helper-DEBUG: 20:22:43.014: Failed to get parent window, falling back to mouse location (-5).
(process:21704): X11Helper-DEBUG: 20:22:43.014: Failed to find monitor, fall back to monitor showing mouse.
useredsa commented 4 years ago

(process:21704): X11Helper-DEBUG: 20:22:43.014: Failed to get parent window, falling ba

:open_mouth:

I can only say I'm running rofi 1.5.4 and bspwm 0.9.10.

DaveDavenport commented 4 years ago

I seem to be getting an invalid window id back (0).

xdotools seems to agree:

xdotool getactivewindow
XGetWindowProperty[_NET_ACTIVE_WINDOW] failed (code=1)
xdo_get_active_window reported an error
useredsa commented 4 years ago

I seem to be getting an invalid window id back (0).

xdotools seems to agree:

xdotool getactivewindow
XGetWindowProperty[_NET_ACTIVE_WINDOW] failed (code=1)
xdo_get_active_window reported an error

It works perfectly for me. What's your version of bspwm?

DaveDavenport commented 4 years ago

0.9.3

It does not always go wrong, but often enough to throw off rofi. (rofi also sometimes works and sometimes not).

useredsa commented 4 years ago

0.9.3

It does not always go wrong, but often enough to throw off rofi. (rofi also sometimes works and sometimes not).

I compiled the project and saw that r->x == t->dst_x and r->y == t->dst_y and they equal the correct value, butthe substraction always gives 0. I modified the code and now it's working for me, which for the moment is very nice.

Thanks for everything.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.