View previous topic :: View next topic |
Author |
Message |
yuri_sevatz n00b
Joined: 19 Jul 2020 Posts: 8
|
Posted: Fri May 19, 2023 9:29 pm Post subject: Gnome: New terminal/browser windows not focused |
|
|
Hi Gnome users!
I'm seeing a kind gnome window manager bug, where any new windows are not automatically focused for keyboard input.
This is happening in 7 out of 7 of the Gentoo installations I maintain; all running latest stable versions of gnome, mutter, gtk, wayland, etc. All in pristine condition.
Steps:
1. Launch a new Terminal from Activities.
2. Launch another new Terminal from Activities using Alt+Enter to create a new Instance. The new Instance is never selected, unless I click on it after.
I am wondering if anyone might be able to help identify the package with the bug There seems to be several layers involved in window focus here. I've also read some recent upstream "musings" about windows focus/input bugs in gtk/mutter over the last 2-3 months.
Notes:
- I can repeat the same test with Firefox, Calculator, or any combination of different apps. All never focus the newest opened window (although calculator gives off some false impressions with its blinking cursor in every window)
- I have never made any changes to the default focus behavior under dconf (e.g. org.gnome.desktop.wm.preferences, org.gnome.mutter, etc). All indicate new windows should get focus.
- Current Profile: default/linux/amd64/17.1/desktop/gnome/systemd/merged-usr
The behavior seems to have started after an update within the last 1-2 weeks.
Thoughts
Last edited by yuri_sevatz on Fri May 19, 2023 9:35 pm; edited 3 times in total |
|
Back to top |
|
|
yuri_sevatz n00b
Joined: 19 Jul 2020 Posts: 8
|
Posted: Fri May 19, 2023 9:31 pm Post subject: |
|
|
Just to be super clear:
If no windows are currently open in a workspace: The first window opened in that workspace does get selected. But the 2nd, 3rd, 4th... windows opened on a workspace don't get selected.
This could be a hint about the package that caused this. |
|
Back to top |
|
|
CooSee Veteran
Joined: 20 Nov 2004 Posts: 1455 Location: Earth
|
|
Back to top |
|
|
yuri_sevatz n00b
Joined: 19 Jul 2020 Posts: 8
|
Posted: Fri May 19, 2023 11:30 pm Post subject: |
|
|
Thanks, the extension for debugging doesn't look like it works with gnome-shell-44.1. It seems to only support gnome-shell-43, before it was EOL'd by gnome.
My gsettings for that value on all 7 installations shows this:
Code: |
$ gsettings get org.gnome.desktop.wm.preferences focus-new-windows
'smart'
|
Which is still the default, which means new instances are supposed to get focus, but they aren't. |
|
Back to top |
|
|
CooSee Veteran
Joined: 20 Nov 2004 Posts: 1455 Location: Earth
|
|
Back to top |
|
|
yuri_sevatz n00b
Joined: 19 Jul 2020 Posts: 8
|
Posted: Sat May 20, 2023 2:02 am Post subject: |
|
|
Same issue occurs with mutter-44.1-r1.
I determined that the problem seems to have started after this upgrade:
qlop -m -u -U -v -d '2023-05-05'
...
2023-05-05T04:48:54 <<< x11-wm/mutter-43.3
2023-05-05T04:47:33 >>> x11-wm/mutter-44.1
2023-05-05T04:49:27 <<< gnome-base/gnome-shell-43.3
2023-05-05T04:48:58 >>> gnome-base/gnome-shell-44.1
...
I did a bit more debugging and there's some very specific quirks about when this bug does / doesn't occur:
Never Working:
- Launching a second instance of any application to any workspace using "Activities" -> New Window or "Activities" -> alt+enter, will not focus that application, unless that application is the first application launched to that specific workspace.
I've also tried launching new instances to a fresh workspace in this order: (1) Terminal, (2) Firefox, (3) Terminal; and oddly Firefox remains focused after doing that.
Always Working:
- Launching two different applications to a completely empty gnome session will always focus the new window.
- Launching new instances of any application to a workspace with any contents using alt-f2, then typing your app, (e.g. "gnome-terminal") will always focus the new window.
- Launching new instances of any application to a workspace with any contents using "File Menu" -> New Instance/Window will always focus the new window.
- Launching new instances of any application to a workspace with any contents using built in application shortcuts (e.g. Terminal: Ctrl + Shift + N, Firefox: Ctrl + N) will always focus the new window.
There must be some kind of change in the Activities menu after this update, whenever using that to launch "new instance".
Anyway, this is useful. Hopefully I can use this description to get someone's attention at gnomeorg.
Thanks! |
|
Back to top |
|
|
CooSee Veteran
Joined: 20 Nov 2004 Posts: 1455 Location: Earth
|
Posted: Sat May 20, 2023 2:34 am Post subject: |
|
|
i read somewhere that fedora already fixed it and this only happens with apps in native wayland mode.
be patient, fix will arrive soon ... i hope !
in the mean time you should try Sway or Hyprland - you can configure almost everything you want to your liking.
emerging / updating just takes 5 min.
_________________ " Die Realität ist eine Illusion, die durch Mangel an ehrlicher Kommunikation entsteht "
---
" Der Mensch ist von Natur aus neugierig, was am Ende übrig bleibt ist die Gier " |
|
Back to top |
|
|
yuri_sevatz n00b
Joined: 19 Jul 2020 Posts: 8
|
Posted: Sat May 20, 2023 3:53 am Post subject: |
|
|
https://gitlab.gnome.org/GNOME/mutter/-/issues/2690
I should have looked more closely, this was behind one of the links you pasted earlier. 100% it.
Thank you! I might try a couple patches/reverts here to see if I can help grow understanding some more. |
|
Back to top |
|
|
yuri_sevatz n00b
Joined: 19 Jul 2020 Posts: 8
|
Posted: Sat May 20, 2023 4:22 am Post subject: |
|
|
The revert seems to work more than acceptably in the meantime:
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2952
It does have the one minor caveat mentioned in the comments, where the Activities screen can lose focus to windows opened behind it, which seems to be the old behavior from x11-wm/mutter-43. |
|
Back to top |
|
|
CooSee Veteran
Joined: 20 Nov 2004 Posts: 1455 Location: Earth
|
Posted: Sat May 20, 2023 4:24 am Post subject: |
|
|
this is the commit / code which was reverted https://gitlab.gnome.org/GNOME/mutter/-/commit/2601bf0cb856ed56f5f4b940fe983f85ca87ea35
in src/core/window.c
Code: | /* Do not focus window on map if input is already taken by the
* compositor.
*/
if (!meta_display_windows_are_interactable (window->display))
{
*takes_focus = FALSE;
return;
}
|
theoretically you could edit the specific file yourself and perform a manual emerge, e.g.
Code: | ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild unpack |
then go to the file /var/tmp/portage/x11-wm/mutter-44.1/work/mutter-44.1/src/core/window.c and search for !meta_display_windows_are_interactable and remove the part i mentioned above and save.
then
Code: | ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild prepare
ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild configure
ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild compile
ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild install
ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild qmerge
ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild clean <<< to clean up /var/tmp |
it's so easy, am i right
_________________ " Die Realität ist eine Illusion, die durch Mangel an ehrlicher Kommunikation entsteht "
---
" Der Mensch ist von Natur aus neugierig, was am Ende übrig bleibt ist die Gier " |
|
Back to top |
|
|
yuri_sevatz n00b
Joined: 19 Jul 2020 Posts: 8
|
Posted: Sat May 20, 2023 4:30 am Post subject: |
|
|
Yeah I already went ahead and deployed it to 7 Gentoos, /etc/portage/patches/ FTW
Code: | su -
mkdir -p /etc/portage/patches/x11-wm/mutter/
cd /etc/portage/patches/x11-wm/mutter/
wget https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2952.patch
emerge -1v mutter
|
(That folder alone is the single reason why I will never give up Gentoo! It is just too good!) |
|
Back to top |
|
|
CooSee Veteran
Joined: 20 Nov 2004 Posts: 1455 Location: Earth
|
Posted: Sat May 20, 2023 4:39 am Post subject: |
|
|
ok, you found it - i hope this solves it for you.
have fun with Gentoo
_________________ " Die Realität ist eine Illusion, die durch Mangel an ehrlicher Kommunikation entsteht "
---
" Der Mensch ist von Natur aus neugierig, was am Ende übrig bleibt ist die Gier " |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 21822
|
Posted: Sat May 20, 2023 3:16 pm Post subject: |
|
|
CooSee wrote: | then Code: | ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild prepare
ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild configure
ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild compile
ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild install
ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild qmerge
ebuild /var/db/repos/gentoo/x11-wm/mutter/mutter-44.1.ebuild clean <<< to clean up /var/tmp |
| This is unnecessary complexity. ebuild will run any missing prerequisite phases unless told not to, so qmerge should imply all of prepare configure compile install. Also, more than one command can be given in a single call to ebuild, so if you did want to call out all of the steps, they could be done in one line. |
|
Back to top |
|
|
CooSee Veteran
Joined: 20 Nov 2004 Posts: 1455 Location: Earth
|
Posted: Sat May 20, 2023 8:46 pm Post subject: |
|
|
you are right of course @Hu
i want to tease him a little bit and afterwords show him the link to the patch, but he was faster
from now on i will refrain do something like that again in the future.
_________________ " Die Realität ist eine Illusion, die durch Mangel an ehrlicher Kommunikation entsteht "
---
" Der Mensch ist von Natur aus neugierig, was am Ende übrig bleibt ist die Gier " |
|
Back to top |
|
|
|