Bug 474207

Summary: Provide a scripting API to run arbitrary commands
Product: [Plasma] kwin Reporter: coherence <niuchangcun>
Component: scriptingAssignee: KWin default assignee <kwin-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: AndyKluger, arusahni, ashark, edoubrayrie, havard.stien, kde, natalie_clarius, nate, niuchangcun
Priority: NOR    
Version: 5.27.7   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description coherence 2023-09-06 05:33:01 UTC
SUMMARY
KWin Scripts lack an API to run arbitrary commands/applications. 

I did a simple search and found at least 4 people in reddit had asked the same question and did not find out a way to do so. I see there was a way to call dbus service `org.kde.klauncher5` to execute commands. But this service is unavailable in my system. And as this post https://bugs.kde.org/show_bug.cgi?id=455515 says, it was deprecated and removed.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION
Comment 1 Daniƫl 2024-04-06 17:33:23 UTC
FWIW, I recently also ran into this and as a workaround wrote my own small helper program to run arbitrary commands via DBus.

https://github.com/DvdGiessen/dbus-app-launcher

Another (hacky) workaround to do this (without an additional dependency) is adding an DBus autostart file for the command you want to run, which will let the DBus deamon start your app for you.

But I agree having this functionality be available directly in the scripting API would be much better.