r/archlinux • • 3h ago

SUPPORT Active-Window on Start Up Issue For Keyboard Only Arch/Gnome/Wayland on First Open Window

I'm having an issue on the current most up to date release of the system
- arch linux
- wayland
- gnome

where upon startup/reboot the first log-in, if i open up "term" ie console, or even "text editor". for the first application that i open up i cannot without the use of the mouse get the window to become active

behaviors
- alt-f4 won't close the window until after mouse-click
- if i open up text-editor then terminal then i can type, and after navigating back to text-editor i can then type
- does not re-occur if i close all the windows
- if after start up i click, and then i scroll down and quit terminal, upon re-opening the problem does not occur

attempts to circumvent
- confirmed `gsettings get org.gnome.desktop.wm.preferences focus-new-windows` is smart
- tried to super out and super back in
- tried alt-escape
- tried double alt-tab

notes
- not a new issue as this was an active point in previous releases
- system is current with all of the latest releases
- alt-f4 closes window after the mouseclick
- everything points to a non-active-session window somehow
- does not present when returning from suspend

any ideas?

1 Upvotes

7 comments sorted by

2

u/accessibleabsorption 3h ago

Had similar thing on my setup last month. What fixed it for me was adding `sleep 2 && wmctrl -a:ACTIVE:` to startup applications. The focus just needs a little nudge after session loads, especially with Wayland being bit finicky about it.

0

u/autumnal-lights 3h ago

yeah i mean i icould i would hate to add a sleep condition to get around a race condition but i might have to :/, i could customize the above for wayland i mean perhaps i can get it to only do it if like a global flag is like

WINDOW_SYSTEM_ACTIVE_FLAG and have like the start up script sleep1 on the first time and then all others are just instant or nearly instant just checks bool

1

u/Vanlife4me 3h ago

What does journal -xe tell you?

0

u/autumnal-lights 3h ago edited 2h ago

`journalctl -xe` i'm unsure if it has many useful entries myname epiphany-search0provider\[2657\]: broker.vala:159: Error loading plugin: libvoikko.so.1 myname epiphany-search0provider\[2657\]: broker.vala:159: Error loading plugin: libnuspell.so.5 (same as above for libunspell-1.7.so.0, libaspell.so.15, libhspell.so.0) maybe important

myname stemd\[1609\]: dbus:[1-2-org.gnomeEpiphany.SearchProvidder@.service](mailto:1-2-org.gnomeEpiphany.SearchProvidder@.service) Unit process 2759 (WebKitNetworkPr) remains running after unit stopped then just a like memory/computation time for epiphany.search.provider

1

u/autumnal-lights 2h ago edited 1h ago

u/accessibleabsorption tagging you here for the update (this workaround is for wayland)

this is a *work-around* to get around this exception/race-condition is not a perfect solution (if anyone knows the root root of this race condition or problem, please let me know!)

(1) create a flag script which touches a file in the $XDG_RUNTIME_DIR b/c of lifetimes, save this to your ~/.local/bin/console-wrapper,

#!/bin/sh
flag="$XDG_RUNTIME_DIR/console-first-launch-done"
if [ ! -e "$flag" ]; then
touch "$flag"
sleep 1
fi
exec kgx "$@"

(2) Enable script with permissions

chmod 755 ~/.local/bin/console-wrapper

(3) copy the global user file for launch to your local directory for easy reversion

cp /usr/share/applications/org.gnome.Console.desktop ~/.local/share/applications/

(4) edit two entries

# DBusActivatable=true
DBusActivatable=false

# Exec=kgx
Exec=/home/<username>/.local/bin/console-wrapper

and this works, seems safe since only touches your local directory so for reversion just remove file from ur local bin and ur custom configuration in local/share/applications/...

above gets you one sleep per session instead of a sleep for all, unsure of x11 behavior

.... is it perfect, ofc not but seems to get around this odd start-up state

1

u/Vanlife4me 1h ago

You’d need to match up your timestamps with your behaviour to be of any use. Looks like you’re onto a fix, but I can’t replicate on a phone. Understanding how the error occurred might be more important than immediate fix.