-- owlry.lua — canonical owlry config (Lua-first since 2.1; TOML removed in 3.0).
-- Spec: https://somegit.dev/Owlibou/owlry/src/branch/main/docs/lua-api.md
-- Local: ~/Dev/packages/owlry/docs/lua-api.md
--
-- The daemon watches this file and hot-reloads on save — no `systemctl reload`.
-- A broken edit is logged and surfaced via `owlry doctor`; the previous good
-- state stays live. Validate explicitly with `owlry config validate`.
--
-- Everything below is set explicitly even where it matches the built-in
-- default, so this file documents intent rather than leaning on invisible
-- defaults. `owlry config show` prints the resolved effective config.

-- ──────────────────────────────────────────────────────────────────────
-- 1. Global settings  (owlry.set merges; later calls override per-key)
-- ──────────────────────────────────────────────────────────────────────
owlry.set {
  theme           = "apex-neon",  -- ~/.config/owlry/themes/{name}.css wins
                                  -- over the bundled theme of the same name.
  width           = 850,
  height          = 650,
  font_size       = 14,
  border_radius   = 12,
  terminal        = "kitty",      -- for items marked terminal=true; omit to
                                  -- autodetect ($TERMINAL → xdg-terminal-exec).
  use_uwsm        = true,         -- launch desktop entries via `uwsm app --`.
  show_icons      = true,
  max_results     = 100,
  frecency        = true,         -- boost frequently/recently launched items.
  frecency_weight = 0.5,          -- 0.0 = off … 1.0 = strong.
  search_engine   = "duckduckgo", -- google|duckduckgo|bing|startpage|searxng|
                                  -- brave|ecosia, or a custom "{query}" URL.

  -- File search is opt-in and only runs under :file / the `/` trigger.
  -- Empty searches $HOME; "~/" is expanded, missing entries are dropped.
  -- filesearch is enabled only in the `dev` profile (below), so this scopes
  -- Super+D's `/` search to the code tree.
  filesearch_roots = { "~/Dev" },
}

-- ──────────────────────────────────────────────────────────────────────
-- 2. Enabled providers  (replaces the set; not additive — use one call)
--    The global set backs bare `owlry` (Super+Space) and the `-m <mode>`
--    binds (Super+C → clipboard, Super+X → uuctl). `ssh` is omitted (SSH is
--    always done from a terminal); `filesearch` is omitted here and enabled
--    only in the `dev` profile below.
--    Built-in IDs: app cmd calc conv power systemd(uuctl) ssh clipboard
--    emoji websearch filesearch dmenu.
-- ──────────────────────────────────────────────────────────────────────
owlry.providers {
  "app", "cmd",            -- core launchers
  "calc", "conv",          -- `=` / `>` triggers
  "power",                 -- :power lock/reboot (owlry-power-menu is the modal menu)
  "systemd",               -- user units (:uuctl) — backs the -m uuctl bind
  "emoji", "clipboard",    -- pickers — clipboard backs the -m clipboard bind
  "websearch",             -- `?` trigger
}

-- ──────────────────────────────────────────────────────────────────────
-- 3. Tab bar  (subset of enabled providers; Ctrl+1..N in listed order)
--    The implicit "All" tab is always at Ctrl+0 and cannot be hidden.
--    Providers not listed are still fully searchable via their prefix /
--    trigger — they just lack a permanent tab button.
--    Tabs are GLOBAL and inherited by profiles (filtered to the active
--    enabled set), so the `dev` profile shows only [All] app as tabs.
-- ──────────────────────────────────────────────────────────────────────
owlry.tabs { "app", "clipboard", "emoji" }

-- ──────────────────────────────────────────────────────────────────────
-- 4. Theme overrides (optional) — layer colours on top of the named theme.
--    Left to themes/apex-neon.css; uncomment to tweak without editing CSS.
-- ──────────────────────────────────────────────────────────────────────
-- owlry.theme {
--   background = "#…", background_secondary = "#…", border = "#…",
--   text = "#…", text_secondary = "#…", accent = "#…", accent_bright = "#…",
--   badge_app = "#…", badge_cmd = "#…", badge_power = "#…", badge_uuctl = "#…",
-- }

-- ──────────────────────────────────────────────────────────────────────
-- 5. Named profiles — `owlry --profile <name>` swaps the enabled set for
--    that launch; inherits owlry.set / owlry.theme / owlry.tabs.
--    `dev` is bound to Super+D in Hyprland. filesearch_roots (above) scopes
--    its `/` search to ~/Dev.
-- ──────────────────────────────────────────────────────────────────────
owlry.profiles {
  dev = { "app", "cmd", "filesearch", "calc", "websearch" },
}

-- ──────────────────────────────────────────────────────────────────────
-- 6. User-defined providers (optional) — register a custom search source.
--    items() is cached at startup (static only until 2.3). Host helpers:
--    owlry.util.{shell,shell_lines,read_file,glob,env,hostname}.
-- ──────────────────────────────────────────────────────────────────────
-- owlry.provider {
--   id = "hs", prefix = ":hs", tab_label = "Shutdown", icon = "system-shutdown",
--   items = function()
--     return {
--       { name = "Lock",     command = "hyprlock" },
--       { name = "Shutdown", command = "systemctl poweroff" },
--       { name = "Reboot",   command = "systemctl reboot" },
--     }
--   end,
-- }
