Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Librewolf window is not focused after launching with drun #2016

Open
2 tasks done
Kostrol opened this issue Aug 4, 2024 · 7 comments
Open
2 tasks done

[BUG] Librewolf window is not focused after launching with drun #2016

Kostrol opened this issue Aug 4, 2024 · 7 comments
Labels

Comments

@Kostrol
Copy link

Kostrol commented Aug 4, 2024

Rofi version (rofi -v)

1.7.5

Configuration

https://gist.github.com/Kostrol/e9a7aa3808b6bce40f86f2a180d757a9

Theme

https://gist.github.com/Kostrol/038e20bb18b58153fa13cd3ac1167bd3

Timing report

No response

Launch command

rofi -show drun

Step to reproduce

  1. launch drun and select librewolf to open
  2. librewolf window opens but without focus

Expected behavior

browser opens and is immediately focused

Actual behavior

browser window opens but only previous window is in focus

Additional information

No response

Using wayland display server protocol

  • No, I don't use the wayland display server protocol

I've checked if the issue exists in the latest stable release

  • Yes, I have checked the problem exists in the latest stable version
@Kostrol Kostrol added the bug label Aug 4, 2024
@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Aug 4, 2024

What window manager do you use?

With f.e. i3 focus_follow_mouse could move the focus away from the newly launched application.

@Kostrol
Copy link
Author

Kostrol commented Aug 4, 2024

Using Mutter and X11, I have click to focus enabled and have a border hint so I can tell with the window.

@DaveDavenport
Copy link
Collaborator

Can you test this patch against git? see if it helps for drun mode?

diff --git a/source/modes/drun.c b/source/modes/drun.c
index c18d8f95..5ed1a45a 100644
--- a/source/modes/drun.c
    b/source/modes/drun.c
@@ -53,6  53,8 @@
 #include "settings.h"
 #include "timings.h"
 #include "widgets/textbox.h"
 
 #include "xcb-internal.h"
 #include "xcb.h"
 
 #include "rofi-icon-fetcher.h"
@@ -1213,9  1215,13 @@ static ModeMode drun_mode_result(Mode *sw, int mretv, char **input,
     switch (rmpd->entry_list[selected_line].type) {
     case DRUN_DESKTOP_ENTRY_TYPE_SERVICE:
     case DRUN_DESKTOP_ENTRY_TYPE_APPLICATION:
       xcb->focus_revert = 0;
       rofi_view_hide();
       exec_cmd_entry(&(rmpd->entry_list[selected_line]), NULL);
       break;
     case DRUN_DESKTOP_ENTRY_TYPE_LINK:
       xcb->focus_revert = 0;
       rofi_view_hide();
       launch_link_entry(&(rmpd->entry_list[selected_line]));
       break;
     default:
@@ -1225,6  1231,9 @@ static ModeMode drun_mode_result(Mode *sw, int mretv, char **input,
              *input[0] != '\0') {
     RofiHelperExecuteContext context = {.name = NULL};
     gboolean run_in_term = ((mretv & MENU_CUSTOM_ACTION) == MENU_CUSTOM_ACTION);
     xcb->focus_revert = 0;
     rofi_view_hide();
 
     // FIXME: We assume startup notification in terminals, not in others
     if (!helper_execute_command(NULL, *input, run_in_term,
                                 run_in_term ? &context : NULL)) {

@DaveDavenport
Copy link
Collaborator

it could also be mutters focus stealing prevention.. do you get a 'window is ready' notification?

https://extensions.gnome.org/extension/2182/noannoyance/

@Kostrol
Copy link
Author

Kostrol commented Aug 4, 2024

Looking at the journal this is all I get :

rofi[3729661]: g_string_insert_len: assertion 'len == 0 || val != NULL' failed

systemd[2245]: Started `app-flatpak-io.gitlab.librewolf\x2dcommunity-3729706.scope.

It's strange because regular Firefox shifts focus the to window correctly when opening as well as all other applications I've tested, Librewolf seems to be the outlier that just wont.

Can you test this patch against git? see if it helps for drun mode?

diff --git a/source/modes/drun.c b/source/modes/drun.c

I'm sorry, I'm by no means a developer or familiar with patching and staging git. How would I go about doing and applying this?
I've cloned the next branch.

it could also be mutters focus stealing prevention.. do you get a 'window is ready' notification?

Yes that would have been a factor, I do already have a similar extension installed for just that reason however.

@DaveDavenport
Copy link
Collaborator

Is librewolf the only flatpak application that does it?

Rofi launches every application in an identical manner, so not sure why one would work, and another not.

@Kostrol
Copy link
Author

Kostrol commented Aug 4, 2024

Is librewolf the only flatpak application that does it?

Yes, it does seem that way.

Rofi launches every application in an identical manner, so not sure why one would work, and another not.

This what puzzles me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants