Balint Korosi
techproductivity

I Gaslit KRunner Into Finding My Brave Bookmarks

I've been on Brave for a looong ass time and I love it. Same with KDE (I used to use Arch, btw, but now I just use Kubuntu). KRunner is the best thing in KDE. Alt+Space, three letters, enter, done.

Except fucking bookmarks.

KDE ships a KRunner plugin that searches your browser bookmarks. It's on by default. It has never once returned a result for me. No error, no warning, no "your browser isn't on the list". It just sits there giving me nothing, forever, and eventually I stopped trying. If I switched the default browser to Firefox, it would find those bookmarks. But I don't use FF. So after years of waiting for the upstream KDE patch, I looked, mangled stuff and the one string bug is workarounded.

Why It Does Nothing

The plugin works out which browser you use by grabbing the Exec line of whatever handles x-scheme-handler/http, then string-matching that against a list: firefox, opera, chromium, chrome, falkon.

Brave's Exec line is /usr/bin/brave-browser-stable %U.

Go on, find the match. There isn't one. So the plugin gives up, falls back to Konqueror, goes hunting for a bookmarks.xml that has never existed on this machine, comes back empty and says fuck all about it. No log line, no warning, no hint.

Open bug since 2021. Vivaldi users get the same treatment.

But Brave IS Chromium. Had the plugin picked its Chrome backend it would have worked on day one, because that backend reads three files:

Brave writes all three. Same JSON, same sqlite, same everything. They just live in ~/.config/BraveSoftware/Brave-Browser/ instead.

One directory name. One string that doesn't match. Years of a dead feature over that. sigh Am I going to butcher this and twist its hand so it works as I want? Absolutely. Here we go.

Fine, I'll Make My Own Bookmarks KRunner. With Blackjack & Hookers.

Fine, I'll make my own bookmarks KRunner. With blackjack and hookers.

Two lies and some symlinks.

Lie one. Launch Brave through a symlink called chrome-brave-shim. The plugin reads that path, spots "chrome" sitting in it, and picks the Chrome backend. Brave neither knows nor cares. Same binary underneath.

Lie two. Symlink Brave's three files into ~/.config/google-chrome/, which is where the Chrome backend goes looking. Nothing is copied, nothing is written. The plugin only ever reads them.

The third piece isn't a lie, just plumbing. A local copy of brave-browser.desktop in ~/.local/share/applications/ with every Exec line pointed at the shim. It keeps the system file's name so it shadows it: your default browser setting doesn't change, and you get one Brave in the app menu instead of two.

#!/usr/bin/env bash
set -euo pipefail

BRAVE_CFG="$HOME/.config/BraveSoftware/Brave-Browser"
CHROME_CFG="$HOME/.config/google-chrome"
SHIM="$HOME/.local/bin/chrome-brave-shim"
SYS_DESKTOP="/usr/share/applications/brave-browser.desktop"
LOCAL_DESKTOP="$HOME/.local/share/applications/brave-browser.desktop"

[ -e "$BRAVE_CFG/Default/Bookmarks" ] || { echo "Brave profile not found at $BRAVE_CFG"; exit 1; }
[ -e "$SYS_DESKTOP" ] || { echo "$SYS_DESKTOP not found"; exit 1; }

# lie one: a symlink to Brave with "chrome" in its path
BRAVE_EXEC=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' "$SYS_DESKTOP" | head -n1)
mkdir -p "$HOME/.local/bin"
ln -sfn "$BRAVE_EXEC" "$SHIM"

# the shadow .desktop, every Exec routed through the shim
mkdir -p "$HOME/.local/share/applications"
sed "s#^Exec=$BRAVE_EXEC#Exec=$SHIM#" "$SYS_DESKTOP" > "$LOCAL_DESKTOP"

# lie two: point the Chrome paths at Brave's real profile
mkdir -p "$CHROME_CFG/Default"
ln -sfn "$BRAVE_CFG/Local State"       "$CHROME_CFG/Local State"
ln -sfn "$BRAVE_CFG/Default/Bookmarks" "$CHROME_CFG/Default/Bookmarks"
# Favicons is optional. Real site icons in the results, at the cost of the
# plugin copying a multi-MB sqlite file every time you open KRunner.
ln -sfn "$BRAVE_CFG/Default/Favicons"  "$CHROME_CFG/Default/Favicons"

update-desktop-database "$HOME/.local/share/applications" >/dev/null 2>&1 || true
kbuildsycoca6 --noincremental >/dev/null 2>&1 || true
systemctl --user restart plasma-krunner.service

echo "Done. Open KRunner and type part of a bookmark title."

More than one Brave profile? Repeat the Bookmarks and Favicons lines for each directory listed under profile.info_cache in Local State, keeping the names the same.

If Nothing Shows Up

Check the plugin is actually switched on, in System Settings > Search > Plasma Search > Bookmarks. Then:

~/.local/bin/chrome-brave-shim --version     # Brave still starts through the shim
sed -n 's/^Exec=/EXEC: /p' ~/.local/share/applications/brave-browser.desktop
xdg-settings get default-web-browser         # should say brave-browser.desktop
ls -lL ~/.config/google-chrome/"Local State" ~/.config/google-chrome/Default/Bookmarks

Undoing It

#!/usr/bin/env bash
set -euo pipefail

CHROME_CFG="$HOME/.config/google-chrome"

for p in "$CHROME_CFG/Local State" \
         "$CHROME_CFG/Default/Bookmarks" \
         "$CHROME_CFG/Default/Favicons" \
         "$HOME/.local/bin/chrome-brave-shim"; do
    if [ -L "$p" ]; then rm -f "$p"; echo "removed symlink $p"; fi
done

D="$HOME/.local/share/applications/brave-browser.desktop"
if [ -f "$D" ]; then rm -f "$D"; echo "removed $D"; fi

rmdir "$CHROME_CFG/Default" 2>/dev/null || true

update-desktop-database "$HOME/.local/share/applications" >/dev/null 2>&1 || true
kbuildsycoca6 --noincremental >/dev/null 2>&1 || true
systemctl --user restart plasma-krunner.service
echo "Reverted."

Symlinks and the one generated desktop file, nothing else. Anything that turns out to be a real file, it leaves alone. I wasn't about to write a script that could eat my bookmarks.

But do create a backup before you run the script. At your own risk, bla bla bla.

Three Things

Brave updates rewrite the system .desktop file and your copy won't follow. If the app menu entry ever looks stale, delete ~/.local/share/applications/brave-browser.desktop and run the script again.

The Favicons symlink costs a multi-MB file copy every time KRunner opens. If it feels sluggish, delete ~/.config/google-chrome/Default/Favicons and live with generic icons.

Install real Google Chrome later and it'll find a config directory full of somebody else's symlinks. Revert first. I don't know what it does otherwise and I'm not finding out.

So

6845 bookmarks, one keystroke away, after years of assuming the feature was just broken.

Tested on Kubuntu 26.04, Plasma 6.6.6, Brave 151.1.93.134.