Bug 411681

Summary: Yakuake always shown on second monitor on wayland
Product: [Applications] yakuake Reporter: cacarry <todaywe>
Component: generalAssignee: Eike Hein <hein>
Status: RESOLVED DUPLICATE    
Severity: normal CC: ashark, bugs.kde, claudius.ellsel, contact, georgediam, ipha00, jazzvoid, jonathanrioux, mail, nate, oded, rushpl, skobkin-ru, xavier8338
Priority: NOR Keywords: wayland
Version: 3.0.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description cacarry 2019-09-07 18:56:12 UTC
SUMMARY
When i press F12, yakuake shows on second monitor, even if mouse is on first

STEPS TO REPRODUCE
1. Place mouse on primary monitor
2. Press button to show yakuake

OBSERVED RESULT
Yakuake shown on incorrect monitor

EXPECTED RESULT
Yakuake shown on correct monitor

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.61.0
Qt Version: 5.13.0
Nvidia driver: 435.21
Card: RTX 2080 Ti

ADDITIONAL INFORMATION
My secondary monitor is left from my primary monitor, e.g.

<Secondary> <Primary>

I have only 2 monitors.
Comment 1 Claudius Ellsel 2020-09-01 21:02:35 UTC
Do you happen to have scaling enabled? Might be related to bug 383555.
Comment 2 Claudius Ellsel 2020-09-01 21:40:25 UTC
Or related to bug 343434.
Comment 3 cacarry 2020-09-02 05:43:31 UTC
Both monitors are FullHD. Happens only on wayland.
Comment 4 Claudius Ellsel 2020-09-02 23:02:12 UTC
So you don't use scaling to make contents bigger/smaller on the screens?
Comment 5 George Diamantopoulos 2021-02-17 00:05:22 UTC
I'm also having this issue. I'm on Gentoo, Plasma 5.21, Frameworks 5.79, Yakuake 20.12.2, Wayland 1.19. Here's what I've found so far:

 - Everything works fine under X11.
 - I have two 4K monitors, one is HDMI, the other is DP.
 - For these tests, scaling in kscreen was set to 100% (thus, no scaling) for both.
 - The following relevant environment variables are set:
   - PLASMA_USE_QT_SCALING=1
   - QT_AUTO_SCREEN_SCALE_FACTOR=0

Results:
* Yakuake will open on screen 1, if set to always open on screen 1
* Yakuake will open on screen 2, if set to always open on screen 2
* If configured to open at mouse location, pressing the open/retract yakuake keyboard shortcut will always result in the app appearing on the last screen on which it was last active, regardless of mouse location

Hope it helps.
Comment 6 Damian Kaczmarek 2021-02-17 22:22:32 UTC
I just tried a plasma wayland session and having the issue of Wayland always opening on my left-most monitor when Screen is set to "At mouse location".

» yakuake  --version
yakuake 20.12.2
» plasmashell --version
plasmashell 5.21.0

Please let me know if I can add any more details.
Comment 7 rekriux 2021-03-01 12:19:14 UTC
I am having the issue, clicking in the desktop or a window in the desired display will allow yakuake to pop up there. Did you try ? It doesn't follow mouse, but just use active display?

On a 3 display, I can have it on any display, but the window doesn't resize properly to the display, it always keeps the size of main display.
Comment 8 rekriux 2021-03-01 12:20:52 UTC
I must add that it will only open once in the desired display, on the second time it will be back to main display even if the mouse didn't move.
Comment 9 Andrew Shark 2021-04-25 17:54:33 UTC
I have found a workaround (not working for me) here: https://www.reddit.com/r/kde/comments/hh99xb/workaround_for_yakuake_in_wayland/
The idea is to add "env QT_QPA_PLATFORM=xcb" before "yakuake".
I have launched it, can confirm that it runs under x, because extramaus red cursor is moving. But still it ignores the option "Screen -> where is mouse".

Also, possibly the same mechanism should work with alt+f2 menu, but it also appears not at screen with mouse, but at left most.

P.S. I have several monitors attached, one of them is UHD. If I can do any testing to help developing this, just ask ;)
Comment 10 Alexey 2021-06-16 16:28:01 UTC
Same here.

Excerpt from screenfetch:
> OS: Gentoo testing
> Kernel: x86_64 Linux 5.12.10-gentoo-skobkin
> Resolution: No X Server
> DE: KDE 5.83.0 / Plasma 5.22.1
> WM: KWin
> GPU: AMD Radeon RX 6800 XT (SIENNA_CICHLID, DRM 3.40.0, 5.12.10-gentoo-skobkin, LLVM 12.0.0)

$ yakuake --version
yakuake 21.04.2

Answers for questions in the thread:

> Do you happen to have scaling enabled?

No. I have 3 displays with 100% scaling.
From left to right: 1920x1080, 2560x1080, 1920x1080.

> I am having the issue, clicking in the desktop or a window in the desired display will allow yakuake to pop up there. Did you try ? It doesn't follow mouse, but just use active display?

Doesn't work for me. Clicking on the desktop or on the window on different display doesn't help to show yakuake after hiding on different display.

But if I choose "Screen" -> "Screen X" in the menu it'll show on that screen next time I press the hotkey after hiding it.
Comment 11 Valerii Malov 2021-07-23 21:01:56 UTC
I've looked into Yakuake code, if the target screen is not fixed, it checks global cursor position to determine where to open the console.

This relies on QCursor::pos(), which is explicitly unavailable on Wayland (see https://community.kde.org/Guidelines_and_HOWTOs/Wayland_Porting_Notes#Drop_Menus). It constantly returns (0,0) so yakuake picks top left screen. I cannot find an alternative API to this, I assume wayland clients are not supposed to have access to global cursor position :/
Comment 12 Infanta Xavier 2021-09-14 14:26:31 UTC
Spectacle screenshot application is able to figure out the "current screen", but requires me to click the screen though.
Comment 13 Oded Arbel 2021-09-18 14:29:47 UTC

*** This bug has been marked as a duplicate of bug 440825 ***
Comment 14 Valerii Malov 2021-09-26 10:45:24 UTC
From what I gather, spectacle doesn't do anything under Wayland, instead it makes dbus calls to KWin asking it to take a screenshot with desired parameters
Comment 15 Damian Kaczmarek 2021-09-26 16:36:18 UTC
So web browsers already solved this. Any website can ask for permission to use the camera, record audio, etc. I imagine KWin perhaps having a DBus API for requesting permission to get the "current screen", user then allows Yakuake to use it and voilà.

Of course it's not a quick fix. Such API would need to be designed, UI for confirming permissions would need to be written and then backends for x11 and Wayland added. I imagine X11 could use QCursor::pos()
Comment 16 Damian Kaczmarek 2021-09-26 16:38:22 UTC
Alternatively installed application could register their permissions. Maybe there could be some /etc/kwin.d directory where a file /etc/kwin.d/40-yakuake.conf would whitelist the permission to query for current screen or cursor position.
Comment 17 Oded Arbel 2021-09-26 17:29:36 UTC
(In reply to Damian Kaczmarek from comment #15)
> So web browsers already solved this. Any website can ask for permission to
> use the camera, record audio, etc. I imagine KWin perhaps having a DBus API
> for requesting permission to get the "current screen", user then allows
> Yakuake to use it and voilà.

There is an API, its called KWindowSystem. Unfortunately, it is completely unimplemented for Wayland - see bug 442662.