Skip to content

Repository files navigation

krunner-claude icon

krunner-claude

Ask Claude from KRunner. Press Alt+Space, type your question, get the answer in a terminal.

A KDE Plasma 6 KRunner plugin that pipes your query straight to the Claude Code CLI.

License: MIT Plasma 6 Python 3 Arch Linux

Typing 'claude what does SIGHUP do' into KRunner and getting the answer in a terminal

What it does

Type claude <anything> into KRunner and press Enter. The text after claude is handed to the claude CLI and the answer opens in a terminal window that stays open until you dismiss it.

No daemon sits in the background. KRunner starts the runner over D-Bus the first time you use it, and it costs nothing until then.

KRunner showing the Ask Claude result
The answer rendered in a Konsole window

Install

git clone --depth=1 https://github.com/Batushn/krunner-claude.git
cd krunner-claude
./install.sh

That is the whole thing. The installer:

  • installs python-dbus / python-gobject if they are missing (pacman, apt, dnf and zypper are all handled)
  • copies four files into your home directory — nothing system-wide, no root needed for the install itself
  • reloads the session D-Bus and restarts KRunner
  • verifies the runner actually answers over D-Bus before it exits, so you are never left guessing

Run ./install.sh --help for --yes (unattended) and --no-restart.

Requirements

Desktop KDE Plasma 6 (developed and tested on 6.7)
Python python-dbus, python-gobject — installed for you
CLI claude on your PATH
Terminal konsole, alacritty, kitty, wezterm, foot, ghostty, gnome-terminal, xfce4-terminal or xterm

Uninstall

./uninstall.sh          # or: make purge, to drop the workspace directory too

Arch Linux packaging

A PKGBUILD is ready in packaging/ and builds cleanly, but the package is not on the AUR yet — new account registration and package submission are currently restricted following the AUR malicious packages incident. It will be published once that lifts. To build it yourself in the meantime:

cd packaging && makepkg -si

Configuration

All optional. Set them where your Plasma session will see them — e.g. ~/.config/environment.d/krunner-claude.conf — then log out and back in.

Variable Default Effect
CLAUDE_RUNNER_TERMINAL auto-detected Force a terminal, e.g. alacritty
CLAUDE_RUNNER_CLAUDE_BIN found on PATH Absolute path to the claude binary
CLAUDE_RUNNER_PRINT unset 1 runs claude -p — print the answer and exit instead of opening the interactive session
CLAUDE_RUNNER_CWD ~/.local/share/krunner-claude/workspace Directory the session runs in
CLAUDE_RUNNER_ICON claude-runner Any icon theme name, or an absolute path
CLAUDE_RUNNER_LANG your locale en or tr

How it works

KRunner supports runners that live outside its own process and speak org.kde.krunner1 over D-Bus. This project is one of those, in about 200 lines of Python.

File Purpose
~/.local/bin/claude_runner.py The D-Bus service implementing Match, Run, Actions and Teardown
~/.local/share/krunner/dbusplugins/claude-runner.desktop Metadata telling KRunner the runner exists (X-Plasma-API=DBus2)
~/.local/share/dbus-1/services/org.kde.claude.runner.service Lets D-Bus start the runner on demand
~/.local/share/icons/hicolor/scalable/apps/claude-runner.svg The icon next to results

Match() only answers when the query starts with claude followed by a space, so it never competes with your other runners. Run() resolves the terminal and the claude binary itself, because a D-Bus-activated process inherits a minimal environment where your usual PATH does not exist.

Troubleshooting

Nothing happens / The name is not activatable

The session bus has not noticed the new .service file. This is the single most common reason a hand-rolled version of this setup silently does nothing — the files are all in the right place and the bus simply never rescanned:

busctl --user call org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus ReloadConfig

install.sh does this for you.

It answers on D-Bus but never appears in KRunner

Restart KRunner, then check it is enabled under System Settings → Search → Plasma Search:

kquitapp6 krunner; sleep 1; setsid krunner &

On some builds the metadata is read from ~/.local/share/krunner/runners/ instead of dbusplugins/. Copying the .desktop file to both is harmless.

A "Command Line — Run claude …" entry appears above the Claude result

That is Plasma's built-in shell runner (plugin id shell), which offers to run any executable on your PATH. It is unrelated to this project. Both entries report maximum relevance, so there is no way to outrank it from a plugin. Either press once, or disable the built-in:

kwriteconfig6 --file krunnerrc --group Plugins --key shellEnabled false && kquitapp6 krunner; sleep 1; setsid krunner &
Claude asks "do you trust the files in this folder?"

It asks once per directory. The runner always starts in one dedicated, otherwise-empty directory so you accept once and are never asked again. If you repoint CLAUDE_RUNNER_CWD, expect one prompt for the new directory.

claude not found when the terminal opens

A D-Bus-activated process gets a minimal environment. The runner already prepends ~/.local/bin, ~/bin and /usr/local/bin to PATH; if your CLI lives elsewhere, set CLAUDE_RUNNER_CLAUDE_BIN to its absolute path.

Reading the runner's own errors
journalctl --user -f | grep -i claude_runner

Verifying by hand

busctl --user call org.kde.claude.runner /claude org.kde.krunner1 Match s 'claude hello'

To prove KRunner itself loads the plugin — not just that D-Bus works — kill the runner and let KRunner start it:

pkill -f claude_runner; qdbus6 org.kde.krunner /App org.kde.krunner.App.querySingleRunner claude-runner "claude hello"; sleep 3; pgrep -af claude_runner

A listed claude_runner.py process means KRunner loaded the plugin and activated it over D-Bus.

Contributing

Issues and pull requests are welcome — see CONTRIBUTING.md. make check runs the shell and Python linters.

License

MIT.

The bundled icon is an original drawing made for this project. This is an unofficial community integration, not affiliated with or endorsed by Anthropic or KDE.


Keywords — KDE Plasma 6 KRunner plugin · Claude Code CLI integration · Anthropic Claude on Linux · KRunner D-Bus runner · Arch Linux · AI assistant launcher · ask AI from the desktop · Plasma search provider · Python KRunner runner example

About

Ask Claude from KRunner — a KDE Plasma 6 D-Bus runner that pipes your query to the Claude Code CLI and shows the answer in a terminal

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages