Bug 505780

Summary: In Spectacle, pressing on 'Enter' and 'New Screenshot -> All Screens' unexpectedly produce different screen focus behaviors
Product: [Plasma] kwin Reporter: madness742
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: REPORTED ---    
Severity: normal CC: kde, nate
Priority: NOR Keywords: multiscreen
Version First Reported In: 6.4.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: The window that appears on the wrong monitor.
Video showcase of the behaviour.

Description madness742 2025-06-19 13:12:45 UTC
SUMMARY
When taking a fullscreen screenshot, spectacle opens on the wrong monitor. Instead of opening on the monitor where the cursor is, it opens on the other monitor.

STEPS TO REPRODUCE
1. Press shift+windows+s OR PrtScn key (behaviour is sometimes different between the two shortcuts).
2. Press on Enter.

OBSERVED RESULT
Spectacle doesn't open on the monitor where the cursor is.

EXPECTED RESULT
Spectacles should open on the monitor where the cursor is.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 42
KDE Plasma Version: 6.4.0
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.1

ADDITIONAL INFORMATION
output of `kscreen-doctor -o`

```
Output: 1 DP-1 31dfb0c2-520f-46e4-8a1c-d0aebd0619d0
        enabled
        connected
        priority 1
        DisplayPort
        replication source:0
        Modes:  1:2560x1440@144*!  2:2560x1440@120  3:2560x1440@100  4:2560x1440@60  5:1920x1200@144  6:1920x1080@75  7:1920x1080@60  8:1920x1080@60  9:1920x1080@60  10:1920x1080@50  11:1600x1200@144  12:1680x1050@60  13:1600x900@60  14:1280x1024@75  15:1280x1024@60  16:1440x900@144  17:1280x800@60  18:1152x864@60  19:1280x720@60  20:1280x720@60  21:1280x720@50  22:1024x768@75  23:1024x768@60  24:800x600@75  25:800x600@60  26:720x480@60  27:720x480@60  28:640x480@75  29:640x480@60  30:640x480@60  31:1600x1200@60  32:1280x1024@144  33:1024x768@144  34:1920x1200@60  35:1280x800@144  36:1920x1080@144  37:1600x900@144  38:1368x768@60  39:1368x768@144  40:1280x720@144 
        Geometry: 1440,620 2560x1440
        Scale: 1
        Rotation: 1
        Overscan: 0
        Vrr: Automatic
        RgbRange: unknown
        HDR: incapable
        Wide Color Gamut: incapable
        ICC profile: none
        Color profile source: sRGB
        Color power preference: prefer efficiency and performance
        Brightness control: supported, set to 50% and dimming to 100%
        DDC/CI: disallowed
        Color resolution: automatic (10), range: [8; 8] bits per color
        Allow EDR: unsupported
Output: 2 DP-2 c1c64c77-d419-4b19-9061-0cb22699908e
        enabled
        connected
        priority 2
        DisplayPort
        replication source:0
        Modes:  41:3840x2160@60*!  42:3840x2160@30  43:2560x1440@60  44:1920x1200@60  45:1920x1080@60  46:1920x1080@60  47:1600x1200@60  48:1680x1050@60  49:1600x900@60  50:1280x1024@60  51:1440x900@60  52:1280x800@60  53:1152x864@60  54:1280x720@60  55:1280x720@60  56:1024x768@60  57:800x600@60  58:720x480@60  59:720x480@60  60:640x480@60  61:640x480@60  62:2560x1600@60  63:3200x1800@60  64:2880x1620@60  65:1368x768@60 
        Geometry: 0,0 1440x2560
        Scale: 1.5
        Rotation: 2
        Overscan: 0
        Vrr: incapable
        RgbRange: unknown
        HDR: incapable
        Wide Color Gamut: incapable
        ICC profile: none
        Color profile source: sRGB
        Color power preference: prefer efficiency and performance
        Brightness control: supported, set to 50% and dimming to 100%
        DDC/CI: disallowed
        Color resolution: automatic (10), range: [8; 8] bits per color
        Allow EDR: unsupported
```
Comment 1 Nate Graham 2025-06-19 20:02:22 UTC
Do any other apps/windows behave similarly?

Are you talking about the big overlay view (which is technically a window) or the draggable traditional-looking window?

Is this a regression compared to Plasma 6.3?
Comment 2 madness742 2025-06-19 20:26:19 UTC
(In reply to Nate Graham from comment #1)
> Do any other apps/windows behave similarly?
So far, no. I haven't found any other app/window that behaves like this on Plasma 6.4.

> Are you talking about the big overlay view (which is technically a window)
> or the draggable traditional-looking window?
I'm talking about the traditional-looking window, but I'll attach a screenshot for extra clarification.

> Is this a regression compared to Plasma 6.3?
No, I can also reproduce it on 6.3.4.
Comment 3 madness742 2025-06-19 20:27:22 UTC
Created attachment 182402 [details]
The window that appears on the wrong monitor.
Comment 4 Noah Davis 2025-06-20 04:43:16 UTC
Currently, Spectacle does not choose a screen for viewer windows since it expects the window manager to choose the correct location to spawn the window. This is the normal way of handling initial window positions for most apps.

Unfortunately, I can't reproduce the window not appearing on the screen where the mouse is when using the "Centered" (default) and "Under mouse" (my usual setting) window placement behaviors (in System Settings, see Window Management->Window Behavior->Advanced). I have not tested the other modes.
Comment 5 madness742 2025-06-20 09:07:34 UTC
Setting Window Placement to "Under mouse" (System Settings -> Window Management -> Window Behavior -> Advanced) makes it appear on the correct monitor. The other modes do not make it appear on the correct monitor.

I've also tested KDE Neon Testing (neon-testing-20250617-0430.iso) and it has the same behavior.

Something interestingly I found is that when Window Placement is set to "Centered" (Default), moving the cursor while pressing enter makes it appear on the correct monitor.

I tried several different resolutions, orientations, and monitor positions but I can still reproduce the issue on every combination I tried.
Comment 6 Nate Graham 2025-06-20 16:50:02 UTC
I also can't reproduce this with a multi-monitor setup and the default window placement mode.

In System Settings > Window Management, is "separate screen focus" turned on or off? It's on by default; if you've got it off, that may be the culprit.

Does the issue reproduce in a new clean user account on the same computer? That ought to rule out configuration issues.
Comment 7 madness742 2025-06-20 21:59:46 UTC
(In reply to Nate Graham from comment #6)
> In System Settings > Window Management, is "separate screen focus" turned on
> or off? It's on by default; if you've got it off, that may be the culprit.
It was set to on, but turning it off solves this issue. Hmm...

> Does the issue reproduce in a new clean user account on the same computer?
> That ought to rule out configuration issues.
This issue is reproducible on a new clean user account on the same computer. I tested it with a Fedora 42 Live USB as well.


I've also noticed that (with the default separate screen focus option) if I click on the screen first, before pressing enter, it will *always* open on that screen.
Comment 8 Nate Graham 2025-06-25 20:40:58 UTC
Thanks. With that information, I'm not sure what you're seeing here is a bug; I think you're triggering the focus detection by pressing Enter and therefore accidentally moving focus to a screen that you weren't expecting to have focus.
Comment 9 madness742 2025-06-25 23:07:00 UTC
(In reply to Nate Graham from comment #8)
> I think you're triggering the focus detection by pressing Enter and
> therefore accidentally moving focus to a screen that you weren't expecting
> to have focus.

Yeah, I'm expecting pressing on 'Enter' and 'New Screenshot -> All Screens' to have the same behaviour. I'll upload a video showcasing the difference between the two.

Don't mind the long time it takes for Spectacle to appear, I think it's related to Bug 501949.
Comment 10 madness742 2025-06-25 23:08:04 UTC
Created attachment 182670 [details]
Video showcase of the behaviour.