Bug 453374 - [Wayland] Window rules don't work with Discord
Summary: [Wayland] Window rules don't work with Discord
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: rules (show other bugs)
Version: 5.24.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-04 07:37 UTC by gudvinr+kde
Modified: 2023-01-13 00:45 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Window rules (96.15 KB, image/png)
2022-05-04 07:37 UTC, gudvinr+kde
Details
wayland_debug (128.45 KB, text/x-log)
2023-01-12 12:57 UTC, gudvinr+kde
Details
MPV rules (128.55 KB, image/png)
2023-01-12 13:03 UTC, gudvinr+kde
Details
window rules (115.10 KB, image/png)
2023-01-13 00:45 UTC, gudvinr+kde
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gudvinr+kde 2022-05-04 07:37:59 UTC
Created attachment 148550 [details]
Window rules

SUMMARY

When I apply window rules for Discord they don't work.

STEPS TO REPRODUCE
1. Run wayland session
2. Setup window rules (example in attachments)
2. Launch Discord as native wayland app (https://wiki.archlinux.org/title/Wayland#Electron)

OBSERVED RESULT
Rules are not being applied. Window has titlebar, it is on wrong screen.

EXPECTED RESULT
Rules apply according to their definition.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.93.0
Qt Version: 5.15.3
Graphics Platform: Wayland
Graphics Processor: AMD VEGAM
Comment 1 gudvinr+kde 2022-05-04 23:55:47 UTC
I am experiencing same issue with MPV (which is also native Wayland app)
Comment 2 Vlad Zahorodnii 2023-01-12 12:31:08 UTC
> I am experiencing same issue with MPV (which is also native Wayland app)

Can you show what window rules you have for MPV? (discord doesn't start on my machine in native wayland mode)
Comment 3 Celeste Liu 2023-01-12 12:37:14 UTC
I am experiencing same issue with Element in native wayland.
rule is 
[element]
Description=element
clientmachine=localhost
desktops=89fc92f3-0710-4a38-9b3f-4ea322967037
desktopsrule=2
wmclass=element
wmclassmatch=2

(In reply to Vlad Zahorodnii from comment #2)
> Can you show what window rules you have for MPV? (discord doesn't start on
> my machine in native wayland mode)

electron bundled with discord doesn't support wayland, you need an external electron (I test electron 19).
Comment 4 gudvinr+kde 2023-01-12 12:57:51 UTC
Created attachment 155231 [details]
wayland_debug

discord logs with WAYLAND_DEBUG=1
Comment 5 gudvinr+kde 2023-01-12 12:58:24 UTC
(In reply to Vlad Zahorodnii from comment #2)
> discord doesn't start on my machine in native wayland mode

It was working for a while but not anymore. I am using this package: https://aur.archlinux.org/packages/discord_arch_electron

If I use "detect window rules" now it treats discord windows as ones with "Electron" window class, or "electron Electron" whole window class.
"Electron", "electron", "electron Electron" window classes didn't make rules work.

I tried using "Discord", ".*Discord$", ".* - Discord" matches for window title with but none made it work too.

I am attaching logs taken with WAYLAND_DEBUG=1.
Comment 6 gudvinr+kde 2023-01-12 13:03:51 UTC
Created attachment 155232 [details]
MPV rules

MPV rules partially work. Window placed where it should but it's not getting resized even if I use Force attribute.
However, I think this is irrelevant to discord and should be handled separately anyway.
Comment 7 Vlad Zahorodnii 2023-01-12 13:30:25 UTC
Discord sets "Electron" app id, so the window class match fails. Discord or electron needs some fixing.

Mpv: position window rule works, but the size window rule does not. kwin asks mpv to show itself with the given size, but mpv ignores that and attaches a buffer with different size anyway. Can't fix it in kwin, please report this issue to mpv developers.
Comment 8 gudvinr+kde 2023-01-12 14:56:23 UTC
(In reply to Vlad Zahorodnii from comment #7)
> Discord sets "Electron" app id, so the window class match fails. Discord or electron needs some fixing.

If that's the case, shouldn't I be able at least have a match with class ~ 'Electron` and title ~ 'Discord'?
Comment 9 Nate Graham 2023-01-12 20:19:48 UTC
*** Bug 464189 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2023-01-12 20:20:20 UTC
*** Bug 464190 has been marked as a duplicate of this bug. ***
Comment 11 gudvinr+kde 2023-01-13 00:45:48 UTC
Created attachment 155249 [details]
window rules

For example, these rules don't work too although there is "Discord" match for title and "Electron" for app id.