Bug 514340 - krunner can't execute arbitrary linux commands or scripts
Summary: krunner can't execute arbitrary linux commands or scripts
Status: NEEDSINFO WAITINGFORINFO
Alias: None
Product: krunner
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 6.5.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-08 17:22 UTC by motoschifo
Modified: 2026-01-16 19:04 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 motoschifo 2026-01-08 17:22:45 UTC
SUMMARY
Maybe krunner is application runner first, but the "run dialog" in all Linux systems is always used to run commands and scripts also. I remember Mint, Debian, etc.
I'm back to KDE Plasma and I found the krunner behaviour very strange and difficult to use.

STEPS TO REPRODUCE
1. create a script in your home/bin folder (must be in the PATH variable and +x attribute set), i.e. /home/user/bin/doc
2. press ALT+F2 (or execute krunner)
3. enter "doc"

OBSERVED RESULT
You will never see your scripts, and if you press the ENTER key you will be execute a random application or resource (depending on your configuration and addons installed). You can obtain Documents, a file that contains doc in the name, skanpage, okular, documentation center, qt assistant, places, a music file, a video file, etc.

EXPECTED RESULT
Avoid to select the first match automatically and, if ENTER pressed and no selection made, the exact command entered should use instead, including spaces, parameters, slashes, dots, etc.
If you enter extra parameters on your script (i.e. "doc -f"), you will never be able to execute it properly because parameters are always cleared.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1
Kernel Version: 6.18.2-arch2-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 255 w/ Radeon 780M Graphics
Memory: 64 GiB of RAM (58.6 GiB usable)
Graphics Processor: AMD Radeon 780M Graphics

ADDITIONAL INFORMATION
This is a bug because on KDE there is no way to enter e command without go to terminal. I use many scripts and shortcut, use the mouse or cursor to scroll down and read the screen every time is frustrating.
If I enter a command, the system must execute that command and not any application on the top of my list (cache, last used, etc).
The execution of command if none selected is the correct approach, maybe under configuration.

I suggest to add a general configuration on file ~/.config/krunnerrc: 

[General]
preselectFirstMatch=false

1. if option enabled, no match selection by default and I need to press DOWN arrow to select the first one
2. if option disabled, first line will be always selected and the ENTER key will open that application/place/document

I read documentation but I can't found this feature, let me know if there already such configuration options.
Comment 1 Marco Martin 2026-01-16 11:03:38 UTC
can't reproduce, here any script in $PATH is used.

how do you add  /home/user/bin/ in your system?
Comment 2 motoschifo 2026-01-16 19:04:24 UTC
Here is an example from .bashrc file:

--- Code Start ---
export PATH="$PATH:~/bin"
--- Code End ---

The solution I found is to replace krunner with my own scripts.
Now I can launch:
 - file manager with local folder
 - file manager with volume folder
 - any scripts/commands

This little script has no history or anything else: it execute my commands with no wait, no mouse selection, etc. and it can't introduce errors. 
For example, in krunner I need to wait the GUI to refresh (if I press Enter the app is not displayed istantaneosly) and the top selected command is often invalid or not correct, because an app is installed new and the name came first.
I don't know if krunner will introduce this kind of changes, now I replaced META+R with my script. If anyone is interested, this is the command executed as script (the script is in my user folder, it's not globally installed):
sh /home/USER/bin/run.sh


--- Code Start ---
#!/bin/bash

# defaults
FILE_MANAGER="dolphin"
TERMINAL="bash -i -c"
#TERMINAL="konsole --noclose -e bash -c"

# Display the KDE input dialog box
CMD=$(/usr/bin/kdialog --title "Quick Run" --inputbox "Enter the command or a folder name:" "")

# Exit is the command is empty
if [ $? -ne 0 ] || [ -z "$CMD" ]; then
    exit
fi

if [ -d "${CMD}" ]; then
    # It's a volume folder
    ${FILE_MANAGER} "${CMD}" &
elif [ -d "${HOME}/${CMD}" ]; then
    # it's a local user folder
    ${FILE_MANAGER} "${HOME}/${CMD}" &
else
    # it's a script or application
    ${TERMINAL} "$CMD" &
fi
--- Code End ---

I hope this can be useful to improve krunner behaviour.
Remarks: I wrote that script to use on my system, it may contains errors, please double check it before using.