Bug 477365 - KRunner immediately closes the first time it is invoked on X11
Summary: KRunner immediately closes the first time it is invoked on X11
Status: RESOLVED FIXED
Alias: None
Product: krunner
Classification: Plasma
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2023-11-22 12:51 UTC by ratijas
Modified: 2023-11-27 17:08 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ratijas 2023-11-22 12:51:13 UTC
SUMMARY

The first time I open KRunner on X11 via global keyboard shortcut (Ctrl+Space), it briefly shows up and immediately closes. Subsequent launches behave normally. If I restart it via `systemctl --user restart plasma-krunner.service` it shows up immediately as normal. There are no useful logs in journal.

I *suspect* it might be intercepting that shortcut which used to launch it, and since it is already opened, it decides to close itself normally.

STEPS TO REPRODUCE
1. Log into X11 session.
2. Press Ctrl+Space.

OBSERVED RESULT
KRunner UI window briefly shows up and immediately disappears.

EXPECTED RESULT
KRunner should open up and stay around.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.81.80
KDE Frameworks Version: 5.245.0
Qt Version: 6.6.0
Kernel Version: 6.6.1-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2
Comment 1 ratijas 2023-11-26 12:20:52 UTC
Oh, I can reproduce without rebooting by just quitting KRunner process. It is a static systemd unit, and will be restarted the next time I activate the shortcut. That should make debugging easier.
Comment 2 ratijas 2023-11-26 19:07:41 UTC
With a bunch of self-descriptive debug logs at the start/end of certain functions as well as in relevant branches, I can confirm my suspicions:
The very first time KRunner is started, it shows up its window voluntarily just because it has started, and then it receives a DBus activation request, and toggles itself off.



// Press Ctrl+Space once, KRunner blinks and immediately hides:

Nov 26 22:03:01 orange dbus-daemon[893]: [session uid=1000 pid=893] Activating via systemd: service name='org.kde.krunner' unit='plasma-krunner.service' requested by ':1.11' (uid=1000 pid=972 comm="/usr/local/kde6/lib/libexec/kglobalacceld")
Nov 26 22:03:01 orange systemd[878]: Starting KRunner...
Nov 26 22:03:02 orange dbus-daemon[893]: [session uid=1000 pid=893] Successfully activated service 'org.kde.krunner'
Nov 26 22:03:02 orange systemd[878]: Started KRunner.
Nov 26 22:03:02 orange krunner[422512]: View::View(begin)
Nov 26 22:03:02 orange krunner[422512]: objectIncubated(begin)
Nov 26 22:03:02 orange krunner[422512]: objectIncubated(end)
Nov 26 22:03:02 orange krunner[422512]: View::View(end)
Nov 26 22:03:02 orange krunner[422512]: main() updateVisibility(before)
Nov 26 22:03:02 orange krunner[422512]: main() updateVisibility() else
Nov 26 22:03:02 orange krunner[422512]: toggleDisplay(begin) isVisible() = false , QGuiApplication::focusWindow() = QWindow(0x0)
Nov 26 22:03:02 orange krunner[422512]: toggleDisplay(end)
Nov 26 22:03:02 orange krunner[422512]: main() updateVisibility(after)
Nov 26 22:03:02 orange krunner[422512]: QObject::startTimer: Timers cannot be started from another thread
Nov 26 22:03:02 orange krunner[422512]: Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
Nov 26 22:03:03 orange krunner[422512]: slotFocusWindowChanged(begin) QGuiApplication::focusWindow() = View(0x7ffe9750ef40) , m_requestedClipboardSelection = false , m_pinned = false
Nov 26 22:03:03 orange krunner[422512]: slotFocusWindowChanged(end)
Nov 26 22:03:03 orange krunner[422512]: main DBus activateRequested(begin) QList("/usr/local/kde6/bin/krunner")
Nov 26 22:03:03 orange krunner[422512]: main() updateVisibility() else
Nov 26 22:03:03 orange krunner[422512]: toggleDisplay(begin) isVisible() = true , QGuiApplication::focusWindow() = View(0x7ffe9750ef40)
Nov 26 22:03:03 orange krunner[422512]: toggleDisplay(end)
Nov 26 22:03:03 orange krunner[422512]: main DBus activateRequested(end)
Nov 26 22:03:03 orange krunner[422512]: slotFocusWindowChanged(begin) QGuiApplication::focusWindow() = QWindow(0x0) , m_requestedClipboardSelection = false , m_pinned = false
Nov 26 22:03:03 orange krunner[422512]: slotFocusWindowChanged(end)

// Press Ctrl+Space second time, KRunner shows up:

Nov 26 22:03:08 orange krunner[422512]: main DBus activateRequested(begin) QList("/usr/local/kde6/bin/krunner")
Nov 26 22:03:08 orange krunner[422512]: main() updateVisibility() else
Nov 26 22:03:08 orange krunner[422512]: toggleDisplay(begin) isVisible() = false , QGuiApplication::focusWindow() = QWindow(0x0)
Nov 26 22:03:08 orange krunner[422512]: toggleDisplay(end)
Nov 26 22:03:08 orange krunner[422512]: main DBus activateRequested(end)
Nov 26 22:03:08 orange krunner[422512]: slotFocusWindowChanged(begin) QGuiApplication::focusWindow() = View(0x7ffe9750ef40) , m_requestedClipboardSelection = false , m_pinned = false
Nov 26 22:03:08 orange krunner[422512]: slotFocusWindowChanged(end)

// Press Ctrl+Space for the third time, KRunner dismisses:

Nov 26 22:03:10 orange krunner[422512]: main DBus activateRequested(begin) QList("/usr/local/kde6/bin/krunner")
Nov 26 22:03:10 orange krunner[422512]: main() updateVisibility() else
Nov 26 22:03:10 orange krunner[422512]: toggleDisplay(begin) isVisible() = true , QGuiApplication::focusWindow() = View(0x7ffe9750ef40)
Nov 26 22:03:10 orange krunner[422512]: toggleDisplay(end)
Nov 26 22:03:10 orange krunner[422512]: main DBus activateRequested(end)
Nov 26 22:03:10 orange krunner[422512]: slotFocusWindowChanged(begin) QGuiApplication::focusWindow() = QWindow(0x0) , m_requestedClipboardSelection = false , m_pinned = false
Nov 26 22:03:10 orange krunner[422512]: slotFocusWindowChanged(end)
Comment 3 Bug Janitor Service 2023-11-27 16:44:32 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3607
Comment 4 ratijas 2023-11-27 17:08:43 UTC
Git commit 19f2d2e229c5146b8495497c60dfe8f0cc0ae6cf by ivan tkachenko.
Committed on 27/11/2023 at 17:43.
Pushed by ratijas into branch 'master'.

KRunner: Launch service in daemon mode

This prevents KRunner from showing up on launch, and immediately hiding
due to receiving an activation request.

M  +1    -1    krunner/CMakeLists.txt
M  +1    -1    krunner/plasma-krunner.service.in

https://invent.kde.org/plasma/plasma-workspace/-/commit/19f2d2e229c5146b8495497c60dfe8f0cc0ae6cf