Files
owlry/data/owlry.example.lua
T
vikingowl ffa82bfed8 perf(filesearch): make file search opt-in and bound the fd walk
File search shelled out to `fd`/`locate` on every auto-mode keystroke,
walking $HOME and serialising behind a single daemon connection — observed
0.9–1.3s per keystroke, stalling every other provider's results. Gate it
behind explicit intent and bound the walk.

- DynamicProvider::runs_in_auto_mode() (default true); filesearch returns
  false, so it only runs when its `:file` prefix is active — never on a
  bare auto-mode query
- route `/` as a `:file` prefix alias in parse_query (identical ParsedQuery)
- drop the colon-less `file `/`find ` auto-triggers; `:file` / `/` cover it
  (also fixes `:file find me` searching for "me")
- bound fd: --max-depth, --exclude .git/node_modules/target/.cache,
  20 results, 750ms kill-timeout (spawn + drained stdout + reap)
- configurable providers.filesearch_roots (TOML + owlry.set; `~/` expanded,
  non-existent entries dropped); empty searches $HOME

Auto-mode typing drops from up to 1.3s to ~2–20ms; file search stays one
keystroke away.
2026-06-01 16:55:31 +02:00

150 lines
8.3 KiB
Lua

-- ~/.config/owlry/owlry.lua — example configuration.
--
-- Drop this file in place to switch from config.toml to the Lua config
-- layer. owlry.lua takes precedence over config.toml when both exist
-- (info-logged at daemon start). The daemon watches this file and
-- hot-reloads on save; broken edits surface as desktop notifications
-- and keep the previous state alive.
--
-- Spec: https://somegit.dev/Owlibou/owlry/src/branch/main/docs/lua-api.md
-- ──────────────────────────────────────────────────────────────────────
-- 1. Global settings.
-- Every key here is OPTIONAL — defaults apply for anything you omit.
-- ──────────────────────────────────────────────────────────────────────
owlry.set {
theme = "owl", -- bundled themes: owl, catppuccin-mocha,
-- nord, rose-pine, dracula, gruvbox-dark,
-- tokyo-night, solarized-dark, one-dark,
-- apex-neon. Plus any *.css under
-- ~/.config/owlry/themes/.
width = 850,
height = 650,
font_size = 14,
border_radius = 12,
-- terminal = "kitty", -- omit to auto-detect ($TERMINAL → xdg-
-- terminal-exec → DE-native → fallback).
use_uwsm = false, -- launch desktop entries via `uwsm app --`
-- for proper systemd session integration.
show_icons = true,
max_results = 100,
frecency = true, -- boost recently / frequently launched items
frecency_weight = 0.3, -- 0.0 = off, 1.0 = strong
search_engine = "duckduckgo", -- google | duckduckgo | bing |
-- startpage | searxng | brave |
-- ecosia, or a custom "{query}" URL.
-- Root dirs for file search (the :file prefix or the / alias). "~/" is
-- expanded; non-existent entries are dropped. Empty (the default) searches
-- $HOME. File search is opt-in only — it never runs on a bare query.
-- filesearch_roots = { "~/Documents", "~/code" },
}
-- ──────────────────────────────────────────────────────────────────────
-- 2. Enabled providers.
-- Omit this call to enable every built-in provider (the default).
-- Listing a subset disables anything not mentioned. Pre-v2 aliases
-- (sys / system → power; uuctl → systemd) still work.
-- ──────────────────────────────────────────────────────────────────────
owlry.providers {
"app", "cmd", -- core launchers
"calc", "conv", -- = / > triggers
"power", -- shutdown / reboot / lock
"systemd", -- user units (:uuctl)
"ssh", "websearch", "filesearch", -- search-style providers
"emoji", "clipboard", -- pickers
}
-- ──────────────────────────────────────────────────────────────────────
-- 3. Tab bar order (subset of providers).
-- Omit to give every enabled provider a tab. Order is preserved;
-- Ctrl+1 jumps to the first entry, Ctrl+2 the second, and so on.
-- ──────────────────────────────────────────────────────────────────────
owlry.tabs { "app", "cmd", "uuctl" }
-- ──────────────────────────────────────────────────────────────────────
-- 4. Theme overrides.
-- owlry.theme("name") picks a bundled / user theme.
-- owlry.theme {} layers individual colour overrides on top.
-- Both forms compose — call as many times as you like.
-- ──────────────────────────────────────────────────────────────────────
-- owlry.theme {
-- background = "#1e1e2e",
-- background_secondary = "#313244",
-- border = "#45475a",
-- text = "#cdd6f4",
-- text_secondary = "#a6adc8",
-- accent = "#cba6f7",
-- accent_bright = "#f5c2e7",
-- -- Per-provider badges (each is optional):
-- badge_app = "#a6e3a1",
-- badge_cmd = "#fab387",
-- badge_power = "#f38ba8",
-- badge_uuctl = "#9ece6a",
-- }
-- ──────────────────────────────────────────────────────────────────────
-- 5. Named profiles, selected by `owlry --profile <name>`.
-- Each profile overrides the default enabled-provider set for that
-- launch but inherits owlry.set / owlry.theme / owlry.tabs.
-- ──────────────────────────────────────────────────────────────────────
-- owlry.profiles {
-- dev = { "app", "cmd", "ssh" },
-- media = { "emoji", "clipboard" },
-- minimal = { "app" },
-- }
-- ──────────────────────────────────────────────────────────────────────
-- 6. User-defined providers.
-- Register your own search source. Every field except `id` and
-- `items` is optional. `items` is called once at startup and the
-- results cached (dynamic per-keystroke providers land in 2.2).
-- ──────────────────────────────────────────────────────────────────────
-- owlry.provider {
-- id = "hs",
-- prefix = ":hs",
-- tab_label = "Shutdown",
-- icon = "system-shutdown",
-- search_noun = "shutdown actions",
-- items = function()
-- return {
-- { name = "Lock", command = "hyprlock" },
-- { name = "Shutdown", command = "systemctl poweroff" },
-- { name = "Reboot", command = "systemctl reboot" },
-- }
-- end,
-- }
-- ──────────────────────────────────────────────────────────────────────
-- 7. Host helpers (use inside provider `items` callbacks).
-- Available under owlry.util.*:
-- shell(cmd) -> string (stdout, trimmed)
-- shell_lines(cmd) -> {string}
-- read_file(path) -> string | nil
-- glob(pattern) -> {string} (~ expansion supported)
-- env(name, default?) -> string | nil
-- hostname() -> string
-- ──────────────────────────────────────────────────────────────────────
-- owlry.provider {
-- id = "docker-ps",
-- prefix = ":docker",
-- items = function()
-- local lines = owlry.util.shell_lines(
-- "docker ps --format '{{.Names}}\t{{.Image}}'"
-- )
-- local items = {}
-- for _, line in ipairs(lines) do
-- local name, image = line:match("([^\t]+)\t(.+)")
-- if name then
-- items[#items + 1] = {
-- name = name,
-- description = image,
-- command = "docker exec -it " .. name .. " bash",
-- terminal = true,
-- }
-- end
-- end
-- return items
-- end,
-- }