Rationale

Emacs users try to avoid leaving their editor for other tasks. There is an shell (Eshell: The Emacs Shell), an integration into Secret Service API (Emacs auth-source Library 0.3) and countless other integrations.

Search is a central element of the Gnome desktop environment. Many applications implement the Search Provider dbus interface to provide suitable results.

The aim of this package is to make these search results also available within the Emacs editor.

Implementation

To implement the interactive command consult-gnome-search i used the awesome minad/consult - Consulting completing-read package.

consult--read enhances the existing Emacs completing-read with live previews of candidates, narrowing capabilities to candidate groups and asynchronously generated candidate lists.

Screenshot

A screenshot is worth a thousand words:

../../img/gnome-search-minibuffer.png

Result Activation

The dbus-method ActivateResult is used to open the selected result in the application implementing the Search Provider. Nautilus for example leverages xdg-mime to delelegate the activation to the configured application.

You most likely wan't to set:

xdg-mime default emacsclient.desktop text/plain
xdg-mime default emacsclient.desktop text/x-csrc

to edit edit the selected files within Emacs.

Installation

Available via package-vc-install (Emacs 29):

  (package-vc-install "https://github.com/juergenhoetzel/consult-gnome-search")

I plan to publish the package later on MELPA.