Bug 437131

Summary: Terminal commands executed in KRunner that require interactivity don't do anything
Product: [Plasma] krunner Reporter: Toadfield <toadfield>
Component: generalAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: normal CC: elypter, kde, lufanzhong, nate, plasma-bugs
Priority: NOR Keywords: usability
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.24
Sentry Crash Report:
Attachments: screen recording

Description Toadfield 2021-05-15 04:07:37 UTC
So that for example I can open krunner,then type "sudo rm /path/to/file",then that command gets executed and if it needs root priviliges,then it just opens that normal window that asks for the root password,and if the command needs a terminal to properly work,then a terminal should be opened.
Comment 1 Alexander Lohnau 2021-05-15 06:39:15 UTC
It should work when you press Shift+Enter, which will launch the command in a terminal window.

Or you could use pkexec instead of sudo, this will give you a graphical prompt.
Comment 2 Toadfield 2021-05-16 00:19:43 UTC
I tried it with neofetch,if type that in krunner and then press shift+enter then nothing happens.
Comment 3 Nate Graham 2021-05-18 21:19:57 UTC
Are you sure you actually had the terminal command item selected at the time you hit Shift+Enter?
Comment 4 Toadfield 2021-05-20 04:27:20 UTC
yes
Comment 5 Nate Graham 2021-05-20 13:55:17 UTC
Can you please attach a screen recording that shows the problem happening?
Comment 6 Toadfield 2021-06-02 02:57:18 UTC
Created attachment 138936 [details]
screen recording

Here,a screen recording
Comment 7 Nate Graham 2021-06-02 16:41:09 UTC
`sudo neofetch` requires interactivity. So that's why it doesn't seem to do anything.

Also, we have a built-in system monitoring system with GUI tools and widgets and an app and everything, so hopefully running neofetch as root should be unnecessary.
Comment 8 Zhong Lufan 2021-10-18 20:59:42 UTC
This is caused by missing kinit, I'm not sure if this is a bug, but on a system without kinit, KRunner won't open the terminal.
Comment 9 Nate Graham 2021-10-19 15:41:33 UTC
Yeah, we're deleting KInit slowly. So if it provides this feature, we'll have to come up with a replacement.
Comment 10 Zhong Lufan 2021-10-19 15:43:54 UTC
(In reply to Nate Graham from comment #9)
> Yeah, we're deleting KInit slowly. So if it provides this feature, we'll
> have to come up with a replacement.

We can use KTerminalLauncherJob, like https://invent.kde.org/system/dolphin/-/commit/27bfcde4efaf936243fc41e4a61d0cac32105ef6 does.
Comment 11 elypter 2021-11-08 14:02:45 UTC
i dont know if this is related but if i start something using shift+enter the terminal shows up but i never get back to the command prompt. after execution it just sits there, accepts input but no prompt shows up, even after ctrl+c. i do however get a prompt with "sudo su"
Comment 12 Nate Graham 2021-12-26 19:33:13 UTC
Git commit 70d23b891e95bc6911389773f320a4406a12bd87 by Nate Graham, on behalf of Lufan Zhong.
Committed on 26/12/2021 at 19:33.
Pushed by ngraham into branch 'master'.

runners/shell: Port from KToolInvocation::invokeTerminal to KTerminalLauncherJob

kinit is being deprecated; this change will allow it to open a terminal and execute
commands normally without kinit being present.
FIXED-IN: 5.24

M  +13   -2    runners/shell/shellrunner.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/70d23b891e95bc6911389773f320a4406a12bd87