espanso icon indicating copy to clipboard operation
espanso copied to clipboard

Create an extension for KDE's KRunner Command Pallete #2302

Open AucaCoyan opened this issue 8 months ago • 4 comments

Description

same as #2302 but for KRunner

krunner repo https://github.com/KDE/krunner

and tutorial for a C++ plugin https://develop.kde.org/docs/plasma/krunner/

store of runners https://store.kde.org/find?search=krunner&f=tags

sample for KDE 4 (legacy) in Python https://techbase.kde.org/Development/Tutorials/Plasma4/PythonRunner

and the most current project I could find: https://github.com/alex1701c/EmojiRunner

unnofficial for steam, in python, (unknown version) https://github.com/xTibor/krunner-steam

hey, and there is one in rust! https://github.com/jaanonim/BibleRunner-rs https://crates.io/crates/krunner

Motivation

Integrations are cool

Have you tried building it? Or would you like it?

  • [ ] I'd be willing to contribute this feature to Espanso myself.

AucaCoyan avatar Apr 17 '25 22:04 AucaCoyan

I would like to take a swing at this. I use KDE on Arco Linux. My question is: what features do you envision for the integration? What would you expect from this integration if it were to exist?

jwliles avatar Apr 30 '25 03:04 jwliles

Thank you! I use KDE too, version 5, and I would like to drive espanso to be easier to use everywhere 💯 . I was thinking in having the search bar functionality in KRunner, so, when you press some key shortcut (esps espanso search for example) you can see the available matches. Does it sound good to you?

For the implementation:

  • I would like it to be in rust (because I can't maintain C++). Python and javascript/typescript are also an option, though I prefer compiled languages
  • I created https://github.com/espanso/espanso-krunner for storing the code there 😊

And let me know if you need something of espanso/espanso, so you can integrate better with KRunner, maybe a new CLI command, or a different output format, anything!

AucaCoyan avatar Apr 30 '25 11:04 AucaCoyan

BTW, we recently discovered https://deepwiki.com/espanso/espanso It's a wiki created by AI. It's not completely revised, though it's very accurate in the parts I could read from. Have fun!

AucaCoyan avatar Apr 30 '25 11:04 AucaCoyan

Espanso KRunner Integration - Implementation Proposal

Overview

This feature will integrate Espanso with KDE's KRunner, allowing users to search and execute Espanso matches through KDE's universal search interface. The integration respects both Espanso's text expansion capabilities and KDE's user experience patterns.

Key Implementation Details

  • Implemented as a cross-process KRunner plugin using D-Bus and Rust
  • Uses existing Espanso CLI commands (match list -j and match exec)
  • No modifications needed to Espanso core functionality
  • Follows KDE's shortcut management philosophy

User Experience Options

Two integration paths are available. Which should we support, or should we support both?

  1. Dedicated Mode: Custom shortcut launches KRunner, showing only Espanso matches known as a single runner
  2. Prefix Mode: Type "esp:" in regular KRunner to filter for Espanso matches

Technical Approach

  • D-Bus service implementing the org.kde.krunner1 interface
  • Efficient match caching with configurable refresh intervals
  • Proper error handling and user feedback
  • Standard KDE desktop and service files for integration

Installation Options

  • Can be implemented as a separate package or integrated into the Espanso installation
  • Supports both system-wide and user-local installations

Benefits

  • Enhanced usability for KDE users
  • Native-feeling experience in the KDE environment
  • Quick access to Espanso functionality through KDE's search interface
  • Potential for future enhancements like using KRunner for disambiguation

The full technical specification includes detailed code examples, implementation plans, and installation scripts which can be found here in a GitHub Gist.

jwliles avatar May 01 '25 20:05 jwliles

Not sure if of any help: https://github.com/domschrei/krunner-symbols offers similar functionality for KRunner.

It's in C++ so probably nothing you want to build upon if you prefer Rust.

When using krunner-symbols (which I did before I recently discovered espanso), the result is pasted to the clipboard, so you don't have direct the replacement. In this respect I prefer using espanso directly! 😄

ptandler avatar Jun 29 '25 12:06 ptandler

Hello @jwliles ! I like that plan 😊. I'm sorry for the delay, maybe if you don't have the time right now it's allright. No problem.

@ptandler Thank you for offering! but your intuition is correct. I have an aversion with non-memory safe languages 😁. I would read C++ code, but I would have difficulties maintaining it and having to review it over time 😕

AucaCoyan avatar Aug 03 '25 21:08 AucaCoyan