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

Keyboard input goes to window under cursor instead of focused window (GPG pinentry) #3788

Open
randalloveson opened this issue Sep 4, 2019 · 2 comments

Comments

@randalloveson
Copy link

commented Sep 4, 2019

I'm submitting a…

[x] Bug
[ ] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

I run a shell script (passmenu) with an i3 exec (from a keybind), it runs dmenu and then attempts to use GPG to decrypt a password, which causes the GPG daemon to run pinentry-gtk-2. This window receives focus, but it only receives keyboard input if the mouse is on it.

If the mouse cursor was over another window when pinentry spawned, even if that other window did not have focus before, it now receives my keyboard input. So if my mouse happened to be on a chat program... it's bad.

This only occurs if pinentry spawns due to an i3 exec. If I run the script from an X terminal emulator, pinentry receives focus and also receives keyboard input, regardless of where my cursor was when it spawned. However, if I then move my cursor outside of it, it loses focus, no matter how I spawned it. This is unexpected because I have set focus_follows_mouse no, and focus never follows the mouse in any other situation.

Expected Behavior

  1. The focused window should always receive the keyboard input.
  2. Windows spawned from i3 exec vs. from the terminal should have the same focus behavior.
  3. Focus should not follow the mouse if focus_follows_mouse is no.

Reproduction Instructions

All packages are from the Arch Linux official repositories.
i3-wm 4.17-1
pass 1.7.3-1
xorg-server 1.20.5-2
gnupg 2.2.17-2

Environment

Output of i3 --moreversion 2>&-:

Binary i3 version:  4.17 (2019-08-03) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.17 (2019-08-03) (pid 29842) abort…)
Loaded i3 config: /home/username/.config/i3/config (Last modified: Wed 04 Sep 2019 12:52:40 PM MDT, 915 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: /usr/bin/i3

Issue is reproducible with no config file at all as well as with:

focus_follows_mouse no
- Linux Distribution & Version: Arch Linux (5.2.9-arch1-1-ARCH)
- Are you using a compositor (e.g., xcompmgr or compton): No compositor.

Output of xprop for the pinentry window when spawned by i3 exec:

_NET_WM_DESKTOP(CARDINAL) = 1
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0
I3_FLOATING_WINDOW(CARDINAL) = 1
_NET_WM_STATE(ATOM) = _NET_WM_STATE_ABOVE
WM_HINTS(WM_HINTS):
		Client accepts input or input focus: True
		Initial state is Normal State.
		window id # of group leader: 0x2e00001
XdndAware(ATOM) = BITMAP
_MOTIF_DRAG_RECEIVER_INFO(_MOTIF_DRAG_RECEIVER_INFO) = 0x6c, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0
WM_TRANSIENT_FOR(WINDOW): window id # 0x1e8
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 48234501
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x2e00004
WM_CLIENT_LEADER(WINDOW): window id # 0x2e00001
_NET_WM_PID(CARDINAL) = 26417
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "hostname"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
		program specified location: 0, 0
		program specified minimum size: 468 by 213
		program specified maximum size: 10000 by 213
		window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "pinentry-gtk-2", "Pinentry-gtk-2"
WM_ICON_NAME(STRING) = "[26413]@hostname"
_NET_WM_ICON_NAME(UTF8_STRING) = "[26413]@hostname"
WM_NAME(STRING) = "[26413]@hostname"
_NET_WM_NAME(UTF8_STRING) = "[26413]@hostname"

Output when spawned from terminal:

_NET_WM_DESKTOP(CARDINAL) = 1
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0
I3_FLOATING_WINDOW(CARDINAL) = 1
_NET_WM_STATE(ATOM) = _NET_WM_STATE_ABOVE
WM_HINTS(WM_HINTS):
		Client accepts input or input focus: True
		Initial state is Normal State.
		window id # of group leader: 0x2e00001
XdndAware(ATOM) = BITMAP
_MOTIF_DRAG_RECEIVER_INFO(_MOTIF_DRAG_RECEIVER_INFO) = 0x6c, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 48234501
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x2e00004
WM_CLIENT_LEADER(WINDOW): window id # 0x2e00001
_NET_WM_PID(CARDINAL) = 26471
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "hostname"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
		program specified location: 0, 0
		program specified minimum size: 468 by 213
		program specified maximum size: 10000 by 213
		window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "pinentry-gtk-2", "Pinentry-gtk-2"
WM_ICON_NAME(STRING) = "[26467]@hostname"
_NET_WM_ICON_NAME(UTF8_STRING) = "[26467]@hostname"
WM_NAME(STRING) = "[26467]@hostname"
_NET_WM_NAME(UTF8_STRING) = "[26467]@hostname"

WM_TRANSIENT_FOR is the only non-trivial diff, I believe.

@i3bot

This comment has been minimized.

Copy link

commented Sep 4, 2019

I don’t see a link to logs.i3wm.org. Did you follow https://i3wm.org/docs/debugging.html? (In case you actually provided a link to a logfile, please ignore me.)

@i3bot i3bot added the 4.17 label Sep 4, 2019

@randalloveson

This comment has been minimized.

Copy link
Author

commented Sep 4, 2019

To anybody else affected (like this lone redditor from February), here is how I have mitigated this:

for_window [class="(?i)pinentry"] move position mouse; fullscreen enable; focus

I'd prefer to move the mouse to the window rather than the other way around, but I can't find an i3 command for that. If you only have one output, the fullscreen is sufficient; you don't need to move the window or the mouse.

EDIT: chain commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.