From cf48d53c57808804107bfcded209f27ffb83de20 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Sun, 28 Dec 2025 19:05:35 +0100 Subject: [PATCH] fix: enable new providers in filter by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added config options for all new providers (system, ssh, clipboard, bookmarks, emoji, scripts, files) with default=true via serde. Updated filter to add these providers to enabled set based on config. Also updated README with comprehensive documentation for all providers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- README.md | 185 +++++++++++++++++++++++++++++++------------- config.example.toml | 21 +++++ src/config/mod.rs | 28 +++++++ src/filter.rs | 20 +++++ 4 files changed, 199 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 6f170e6..311ff8c 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,14 @@ A lightweight, owl-themed application launcher for Wayland, built with GTK4 and ## Features -- **Provider-based architecture** - Search applications, PATH commands, and systemd user services +- **Provider-based architecture** - Search applications, commands, system actions, SSH hosts, clipboard history, bookmarks, emoji, and more - **Fuzzy search** - Fast, typo-tolerant matching across all providers -- **Filter tabs & prefixes** - Scope searches with UI tabs or `:app`, `:cmd`, `:uuctl` prefixes -- **Systemd integration** - Manage user services with submenu actions (start/stop/restart/status/journal) +- **Filter tabs & prefixes** - Scope searches with UI tabs or `:app`, `:cmd`, `:sys` prefixes +- **Calculator** - Quick math with `= 5+3` or `calc sin(pi/2)` +- **Web search** - Search the web with `? query` or `web query` +- **File search** - Find files with `/ filename` or `find config` (requires `fd` or `locate`) +- **Frecency ranking** - Frequently/recently used items rank higher - **GTK4 theming** - Respects system theme by default, with optional custom themes -- **CSS variables** - Full customization via config or custom stylesheets - **Wayland native** - Uses Layer Shell for proper overlay behavior ## Installation @@ -45,6 +47,16 @@ sudo apt install libgtk-4-dev libgtk4-layer-shell-dev sudo dnf install gtk4-devel gtk4-layer-shell-devel ``` +#### Optional dependencies + +```bash +# For clipboard history +sudo pacman -S cliphist wl-clipboard + +# For file search +sudo pacman -S fd # or: mlocate +``` + #### Build Requires Rust 1.90 or later. @@ -79,7 +91,7 @@ owlry --help |-----|--------| | `Enter` | Launch selected item | | `Escape` | Close launcher / exit submenu | -| `↑` / `↓` | Navigate results | +| `Up` / `Down` | Navigate results | | `Tab` | Cycle filter modes | | `Shift+Tab` | Cycle filter modes (reverse) | | `Ctrl+1` | Toggle Applications filter | @@ -88,20 +100,108 @@ owlry --help ### Search Prefixes -| Prefix | Scope | -|--------|-------| -| `:app ` | Applications only | -| `:cmd ` | PATH commands only | -| `:uuctl ` | systemd user services only | +Filter results by provider using prefixes: -Example: `:cmd git` searches only PATH commands for "git" +| Prefix | Provider | Example | +|--------|----------|---------| +| `:app` | Applications | `:app firefox` | +| `:cmd` | PATH commands | `:cmd git` | +| `:sys` | System actions | `:sys shutdown` | +| `:ssh` | SSH hosts | `:ssh server` | +| `:clip` | Clipboard history | `:clip password` | +| `:bm` | Browser bookmarks | `:bm github` | +| `:emoji` | Emoji picker | `:emoji heart` | +| `:script` | Custom scripts | `:script backup` | +| `:file` | File search | `:file config.toml` | +| `:calc` | Calculator | `:calc 5+3` | +| `:web` | Web search | `:web rust docs` | +| `:uuctl` | systemd services | `:uuctl docker` | + +### Trigger Prefixes + +Some providers can be triggered directly without filter mode: + +| Trigger | Provider | Example | +|---------|----------|---------| +| `=` | Calculator | `= 5+3` or `=5*2` | +| `calc ` | Calculator | `calc sqrt(16)` | +| `?` | Web search | `? rust programming` | +| `web ` | Web search | `web linux tips` | +| `search ` | Web search | `search owlry` | +| `/` | File search | `/ .bashrc` | +| `find ` | File search | `find config` | + +## Providers + +### Applications +Searches `.desktop` files from standard XDG directories. + +### Commands +Searches executable files in `$PATH`. + +### System +Quick access to system actions: +- Shutdown, Reboot, Suspend, Hibernate +- Lock Screen, Log Out +- **Reboot into BIOS** - Restart directly into UEFI/BIOS setup + +### SSH +Parses `~/.ssh/config` and offers quick connections to configured hosts. Opens in your configured terminal. + +### Clipboard (requires cliphist) +Search and paste from clipboard history. Requires `cliphist` and `wl-clipboard`: +```bash +sudo pacman -S cliphist wl-clipboard +``` + +### Bookmarks +Reads bookmarks from Chromium-based browsers: +- Chrome, Chromium, Brave, Edge, Vivaldi + +### Emoji +Search 300+ emojis by name or keywords. Selected emoji is copied to clipboard via `wl-copy`. + +### Scripts +Runs executable scripts from `~/.config/owlry/scripts/`. Create the directory and add your scripts: +```bash +mkdir -p ~/.config/owlry/scripts +echo '#!/bin/bash +# My backup script +rsync -av ~/Documents /backup/' > ~/.config/owlry/scripts/backup +chmod +x ~/.config/owlry/scripts/backup +``` + +### Calculator +Evaluate math expressions with `= expr` or `calc expr`: +- Basic: `= 5+3`, `= 10/3` +- Functions: `= sqrt(16)`, `= sin(pi/2)` +- Constants: `= pi`, `= e` + +### Web Search +Search the web with `? query` or `web query`. Configurable search engine: +- Google, DuckDuckGo, Bing, Brave, Ecosia, Startpage, SearXNG +- Or custom URL with `{query}` placeholder + +### File Search (requires fd or locate) +Search files with `/ pattern` or `find pattern`: +```bash +sudo pacman -S fd # recommended, faster +# or +sudo pacman -S mlocate && sudo updatedb +``` + +### systemd User Services +Lists and controls user-level systemd services. Select a service to access actions: +- Start / Stop / Restart / Reload +- Kill (force stop) +- Status (opens in terminal) +- Journal (live logs in terminal) +- Enable / Disable (autostart) ## Configuration Configuration file: `~/.config/owlry/config.toml` -An example config is installed at `/usr/share/doc/owlry/config.example.toml`: - ```bash mkdir -p ~/.config/owlry cp /usr/share/doc/owlry/config.example.toml ~/.config/owlry/config.toml @@ -112,7 +212,7 @@ cp /usr/share/doc/owlry/config.example.toml ~/.config/owlry/config.toml show_icons = true max_results = 10 # terminal_command = "kitty" # Auto-detected if not set -# launch_wrapper = "uwsm app --" # Auto-detected for uwsm/hyprland sessions +# launch_wrapper = "uwsm app --" # Auto-detected for uwsm/hyprland [appearance] width = 600 @@ -121,15 +221,22 @@ font_size = 14 border_radius = 12 # theme = "owl" # Optional: "owl" or custom theme name -# [appearance.colors] -# Override individual colors (optional) -# accent = "#e0af68" -# background = "#1a1b26" - [providers] applications = true commands = true uuctl = true +calculator = true +websearch = true +search_engine = "duckduckgo" # google, bing, brave, ecosia, startpage, searxng +system = true +ssh = true +clipboard = true +bookmarks = true +emoji = true +scripts = true +files = true +frecency = true +frecency_weight = 0.3 # 0.0 = disabled, 1.0 = strong boost ``` ### Default Values @@ -138,8 +245,8 @@ uuctl = true |---------|---------| | `show_icons` | `true` | | `max_results` | `10` | -| `terminal_command` | Auto-detected ($TERMINAL → xdg-terminal-exec → kitty/alacritty/etc) | -| `launch_wrapper` | Auto-detected (uwsm → hyprctl → none) | +| `terminal_command` | Auto-detected ($TERMINAL -> xdg-terminal-exec -> kitty/alacritty/etc) | +| `launch_wrapper` | Auto-detected (uwsm -> hyprctl -> none) | | `width` | `600` | | `height` | `400` | | `font_size` | `14` | @@ -148,7 +255,7 @@ uuctl = true ### Launch Wrapper -When running in uwsm-managed or Hyprland sessions, owlry auto-detects and uses the appropriate launch wrapper for proper session integration: +When running in uwsm-managed or Hyprland sessions, owlry auto-detects and uses the appropriate launch wrapper: | Session | Wrapper | Purpose | |---------|---------|---------| @@ -156,8 +263,6 @@ When running in uwsm-managed or Hyprland sessions, owlry auto-detects and uses t | Hyprland | `hyprctl dispatch exec --` | Native Hyprland window management | | Other | None (direct `sh -c`) | Standard shell execution | -You can override this with `launch_wrapper` in config, or set to empty string `""` to disable. - ## Theming ### GTK Theme (Default) @@ -219,13 +324,6 @@ Create a custom theme file at `~/.config/owlry/themes/mytheme.css`: } ``` -Then reference it in config: - -```toml -[appearance] -theme = "mytheme" -``` - ### CSS Variables Reference | Variable | Description | @@ -239,35 +337,12 @@ theme = "mytheme" | `--owlry-accent-bright` | Bright accent | | `--owlry-font-size` | Base font size | | `--owlry-border-radius` | Border radius | -| `--owlry-badge-app` | Application badge color | -| `--owlry-badge-cmd` | Command badge color | -| `--owlry-badge-dmenu` | Dmenu badge color | -| `--owlry-badge-uuctl` | systemd badge color | +| `--owlry-badge-*` | Provider badge colors (app, cmd, sys, ssh, clip, emoji, etc.) | ### Custom Stylesheet For full control, create `~/.config/owlry/style.css` with any GTK4 CSS. -## Providers - -### Applications - -Searches `.desktop` files from standard XDG directories. - -### Commands - -Searches executable files in `$PATH`. - -### systemd User Services - -Lists and controls user-level systemd services. Select a service to access actions: - -- Start / Stop / Restart / Reload -- Kill (force stop) -- Status (opens in terminal) -- Journal (live logs in terminal) -- Enable / Disable (autostart) - ## License This project is licensed under the GNU General Public License v3.0 or later - see [LICENSE](LICENSE) for details. diff --git a/config.example.toml b/config.example.toml index cdc246b..89b8e6e 100644 --- a/config.example.toml +++ b/config.example.toml @@ -54,3 +54,24 @@ websearch = true # Options: google, duckduckgo, bing, startpage, searxng, brave, ecosia # Or custom URL with {query} placeholder, e.g. "https://search.example.com/?q={query}" search_engine = "duckduckgo" + +# System commands (shutdown, reboot, lock, suspend, hibernate, logout, BIOS) +system = true + +# SSH connections from ~/.ssh/config +ssh = true + +# Clipboard history (requires cliphist) +clipboard = true + +# Browser bookmarks (Chrome, Chromium, Brave, Edge, Vivaldi) +bookmarks = true + +# Emoji picker (copies to clipboard) +emoji = true + +# Custom scripts from ~/.config/owlry/scripts/ +scripts = true + +# File search (requires fd or locate, trigger with "/ pattern" or "find pattern") +files = true diff --git a/src/config/mod.rs b/src/config/mod.rs index 0cef0a7..0fe5c21 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -85,6 +85,27 @@ pub struct ProvidersConfig { /// Or custom URL with {query} placeholder #[serde(default = "default_search_engine")] pub search_engine: String, + /// Enable system commands (shutdown, reboot, etc.) + #[serde(default = "default_true")] + pub system: bool, + /// Enable SSH connections from ~/.ssh/config + #[serde(default = "default_true")] + pub ssh: bool, + /// Enable clipboard history (requires cliphist) + #[serde(default = "default_true")] + pub clipboard: bool, + /// Enable browser bookmarks + #[serde(default = "default_true")] + pub bookmarks: bool, + /// Enable emoji picker + #[serde(default = "default_true")] + pub emoji: bool, + /// Enable custom scripts from ~/.config/owlry/scripts/ + #[serde(default = "default_true")] + pub scripts: bool, + /// Enable file search (requires fd or locate) + #[serde(default = "default_true")] + pub files: bool, } fn default_search_engine() -> String { @@ -215,6 +236,13 @@ impl Default for Config { frecency_weight: 0.3, websearch: true, search_engine: "duckduckgo".to_string(), + system: true, + ssh: true, + clipboard: true, + bookmarks: true, + emoji: true, + scripts: true, + files: true, }, } } diff --git a/src/filter.rs b/src/filter.rs index a4a3c27..d5aab49 100644 --- a/src/filter.rs +++ b/src/filter.rs @@ -42,6 +42,26 @@ impl ProviderFilter { if config_providers.uuctl { set.insert(ProviderType::Uuctl); } + if config_providers.system { + set.insert(ProviderType::System); + } + if config_providers.ssh { + set.insert(ProviderType::Ssh); + } + if config_providers.clipboard { + set.insert(ProviderType::Clipboard); + } + if config_providers.bookmarks { + set.insert(ProviderType::Bookmarks); + } + if config_providers.emoji { + set.insert(ProviderType::Emoji); + } + if config_providers.scripts { + set.insert(ProviderType::Scripts); + } + // Note: Files, Calculator, WebSearch are dynamic providers + // that don't need to be in the filter set - they're triggered by prefix // Default to apps if nothing enabled if set.is_empty() { set.insert(ProviderType::Application);