i3 icon indicating copy to clipboard operation
i3 copied to clipboard

Plasmashell notifications accept focus unless no_focus directive is used

Open Hi-Angel opened this issue 5 years ago • 11 comments

Per discussion here, I'm creating a separate issue. There is an alternative way to reproduce it by using picom/compton with transparency, and switching to another workspace (which makes notification to get focus).

A workaround for the problem described is to add in config this line:

no_focus [window_type="notification"]

I'm submitting a…

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

Current Behavior

A notification popup makes keyboard layout get changed again

Expected Behavior

Keyboard layout stays the same

Reproduction Instructions

  1. Start KDE Plasma
  2. Open systemsettings5 → Input Devices → Keyboard → Layouts
    1. Make sure you have more than one language layout
    2. Set "Switching policy" checkbox to "Window"
    3. Click Apply
  3. Create a /usr/share/xsessions/plasma-i3.desktop file with the following:
    [Desktop Entry]
    Type=XSession
    Exec=env KDEWM=/usr/bin/i3 /usr/bin/startplasma-x11
    DesktopNames=KDE
    Name=Plasma with i3
    Comment=Plasma with i3
    
  4. Relogin into session named "Plasma with i3" and wait for it to finish loading (a plasma panel should appear at the bottom)
  5. Write in terminal notify-send 'Hello world'
  6. Switch keyboard layout to non-default one
  7. Press enter

Environment

Output of i3 --moreversion 2>&-:

Binary i3 version:  4.18.1 (2020-04-22) © 2009 Michael Stapelberg and contributors
(Getting version from running i3, press ctrl-c to abort…)
Config file
https://pastebin.com/raw/kfhcrzua
- Linux Distribution & Version: Archlinux
- Are you using a compositor: picom, but it is reproducible with and without it.

Hi-Angel avatar May 05 '20 12:05 Hi-Angel

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 avatar May 05 '20 12:05 i3bot

Oh, I forgot to say: I tested and it is reproducible with latest git as well (commit d7d4f0a)

Hi-Angel avatar May 05 '20 12:05 Hi-Angel

Can you also upload the logs please?

orestisfl avatar May 05 '20 12:05 orestisfl

Can you also upload the logs please?

Sure. There nothing appears when notification is created. Here are the logs I'm currently getting with this config and no_focus commented out:

$ killall i3 && sleep 1 && i3 --shmlog-size=26214400
05.05.2020 15:48:28 - ERROR: PCRE regular expression compilation failed at 4: nothing to repeat
05.05.2020 15:48:28 - ERROR: Match is empty, ignoring this for_window statement
[ 05.05.2020 15:48:28.608 register_cm FATAL ERROR ] Another composite manager is already running
15:48:29 INFO: Opening in existing instance


Closing SHM log "/i3-log-163859"

Hi-Angel avatar May 05 '20 12:05 Hi-Angel

Please follow https://i3wm.org/docs/debugging.html to get the full output of the logs

orestisfl avatar May 05 '20 13:05 orestisfl

Please follow https://i3wm.org/docs/debugging.html to get the full output of the logs

Oh, so there is more to it. I read it but didn't see the paragraph "obtaining logs", so I thought that the output that i3 prints here is all I can get. Sorry, okay, here's the full log https://logs.i3wm.org/logs/5652195542302720.bz2

Hi-Angel avatar May 05 '20 13:05 Hi-Angel

Okay, so, I have redone the logs with, like, minimal possible configuration of i3

https://logs.i3wm.org/logs/5762164153384960.bz2

The configuration was just that:

$ grep -vE "#|^$" ~/.config/i3/config
set $mod Mod4
floating_modifier $mod
bindsym $mod+Return exec konsole
bindsym $mod+Shift+c kill

Hi-Angel avatar May 05 '20 13:05 Hi-Angel

So, looking at the logs I see the following:

Window gets managed:

05.05.2020 16:08:46 - manage.c:manage_window:111 - window 0x0440002b
05.05.2020 16:08:46 - WM_CLASS changed to plasmashell (instance), plasmashell (class)

nc->window->doesnt_accept_focus is set to true:

05.05.2020 16:08:46 - WM_HINTS.input changed to "0"

Focus is set:

05.05.2020 16:08:47 - manage.c:manage_window:662 - Now setting focus.

It can inferred from https://github.com/i3/i3/blob/d7d4f0a95b4bebb180071cb51534b2e8c093821b/src/manage.c#L648-L655 that nc->window->needs_take_focus is true, meaning that the WM_TAKE_FOCUS is set.

Reference: https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7

@Airblader you are the one that commited this change. When you have the time to read this, do you believe that i3 behaves correctly here according to the standard?

Maybe related: https://github.com/i3/i3/issues/2409

orestisfl avatar May 05 '20 13:05 orestisfl

I don't have a lot of time at the moment and am not fully into the whole focus topic anymore. What I do know is that i3 does not implement some of the focus scenarios correctly and changing that isn't all that easy. I'm pretty sure we also still have some issue(s?) about that.

Airblader avatar May 05 '20 14:05 Airblader

I edit-linked one.

Ok, when you have time, see if you can elaborate on how i3 should handle this case. Not urgent since we already have a workaround.

orestisfl avatar May 05 '20 14:05 orestisfl

for_window [class="plasmashell" window_type="notification"] floating enable, no_focus, border none, move position 70 ppt 81 ppt

zalox avatar Mar 06 '25 09:03 zalox