### Files Provider Usage Examples Source: https://github.com/abenz1267/walker/blob/master/_autodocs/10-providers-detailed.md Examples demonstrating how to use the Files provider to browse directories and search for files. ```text /home # Browse from home directory /etc/conf # Search .d files /var/log/syslog # Auto-complete file paths ``` -------------------------------- ### Install Prerequisites for Debian/Ubuntu Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Installs necessary development libraries and tools for building Walker on Debian-based systems. ```bash sudo apt install \ libgtk-4-dev \ libgtk-layer-shell-0-dev \ libcairo2-dev \ libpoppler-glib-dev \ protobuf-compiler \ cargo ``` -------------------------------- ### Window Example Configuration Source: https://github.com/abenz1267/walker/blob/master/_autodocs/09-window-ui.md A complete example configuration for the Walker window, including shell layer, anchoring, and content area size constraints. ```toml [shell] layer = "overlay" anchor_top = true anchor_left = true anchor_right = false anchor_bottom = false exclusive_zone = 0 [window] min_content_width = 400 max_content_width = 1000 min_content_height = 100 max_content_height = 600 height = 500 width = 800 as_window = false ``` -------------------------------- ### Dmenu Mode Configuration Examples Source: https://github.com/abenz1267/walker/blob/master/_autodocs/10-providers-detailed.md Examples demonstrating how to use the Dmenu provider with different command-line options for pre-selection, index output, and password entry. ```bash # Usage (echo "Option 1"; echo "Option 2") | walker --dmenu # Pre-select item (echo "Yes"; echo "No") | walker --dmenu --current 0 # Output index instead of text echo -e "First\nSecond\nThird" | walker --dmenu --index # Password entry walker --password ``` -------------------------------- ### Actions Configuration Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/02-configuration.md Example TOML configuration for defining actions for the 'files' provider, including opening, editing, and copying paths. ```toml [providers.actions] [providers.actions.files] [[providers.actions.files]] action = "open" bind = "Return" default = true [[providers.actions.files]] action = "edit" bind = "ctrl e" [[providers.actions.files]] action = "copy_path" label = "Copy Path" ``` -------------------------------- ### Keybind Hints Display Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Shows an example of how keybind hints are displayed at the bottom of the window. These hints are dynamically generated based on available actions. ```text [Open] ⏎ [Edit] Ctrl+E [Delete] Del ``` -------------------------------- ### Vim-like Keybind Setup Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Configuration for a Vim-like keybind setup, including navigation, closing, and page scrolling actions. ```toml [keybinds] close = ["Escape"] next = ["j", "Down"] previous = ["k", "Up"] left = ["h", "Left"] right = ["l", "Right"] page_down = ["ctrl d"] page_up = ["ctrl u"] toggle_exact = ["ctrl Home"] ``` -------------------------------- ### ProviderList Provider Usage Examples Source: https://github.com/abenz1267/walker/blob/master/_autodocs/10-providers-detailed.md Examples showing how to use the ProviderList provider to switch between different data sources. ```text ;files # Switch to files provider ;calc # Switch to calculator ;bookmarks # Switch to bookmarks ``` -------------------------------- ### Placeholder Configuration Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/02-configuration.md Example TOML configuration for defining placeholder texts for default and specific providers. ```toml [placeholders] [placeholders.default] input = "Search" list = "No results" [placeholders.files] input = "Enter path" list = "No files found" ``` -------------------------------- ### Install Prerequisites for Fedora/RHEL Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Installs necessary development libraries and tools for building Walker on Fedora or RHEL-based systems. ```bash sudo dnf install \ gtk4-devel \ gtk-layer-shell-devel \ cairo-devel \ poppler-glib-devel \ protobuf-compiler \ cargo ``` -------------------------------- ### Install Prerequisites for Arch Linux Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Installs necessary development libraries and tools for building Walker on Arch Linux. ```bash sudo pacman -S \ gtk4 \ gtk-layer-shell \ cairo \ poppler \ protobuf \ cargo ``` -------------------------------- ### Enable and Start Systemd User Service Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Commands to enable the Walker systemd user service to start on boot and to start it immediately. ```bash systemctl --user enable walker systemctl --user start walker ``` -------------------------------- ### Keybind Syntax Examples Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Illustrates more complex keybind configurations including multiple keys and modifiers. ```toml [keybinds] close = ["Escape", "alt q"] next = ["Down", "Tab", "ctrl n"] previous = ["Up", "shift Tab", "ctrl p"] toggle_exact = ["ctrl slash"] quick_activate = ["super 1", "super 2", "super 3"] ``` -------------------------------- ### TOML Configuration Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/00-index.md Example of Walker's configuration file in TOML format, showing top-level settings, provider configurations, keybinds, and shell settings. ```toml # Top level theme = "default" debug = false resume_last_query = true close_when_open = false # Providers [providers] default = ["desktopapplications", "files"] max_results = 50 [[providers.prefixes]] provider = "files" prefix = "/" # Keybinds [keybinds] close = ["Escape"] next = ["Down", "Tab"] # Shell (Wayland) [shell] layer = "overlay" anchor_top = true ``` -------------------------------- ### Output Selected Index Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/05-command-line-interface.md This example demonstrates how to use the `--index` flag to get the index of a selection from a piped list in dmenu mode. ```bash # Output: "2" (index) instead of "Option 3" (text) (echo "Option 1"; echo "Option 2"; echo "Option 3") | walker --dmenu --index ``` -------------------------------- ### Install Flamegraph Profiler Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Installs the flamegraph tool, which is used for performance profiling. ```bash cargo install flamegraph ``` -------------------------------- ### Emacs-like Keybind Setup Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Configuration for an Emacs-like keybind setup, focusing on common Emacs keybindings for navigation and actions. ```toml [keybinds] close = ["ctrl c"] next = ["ctrl n"] previous = ["ctrl p"] left = ["ctrl b"] right = ["ctrl f"] toggle_exact = ["ctrl s"] resume_last_query = ["ctrl r"] ``` -------------------------------- ### Minimal Configuration Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/02-configuration.md A minimal TOML configuration file for Walker, setting theme, query resumption, default providers, and keybinds. ```toml theme = "default" resume_last_query = true [providers] default = ["desktopapplications", "files", "calc"] [[providers.prefixes]] provider = "websearch" prefix = "?" [[providers.prefixes]] provider = "files" prefix = "/" [keybinds] close = ["Escape"] next = ["Down", "Tab"] previous = ["Up", "shift Tab"] quick_activate = ["F1", "F2", "F3"] [shell] anchor_top = true anchor_left = true layer = "overlay" ``` -------------------------------- ### get_item_layout Method Example Implementation Source: https://github.com/abenz1267/walker/blob/master/_autodocs/04-provider-interface.md Example implementation of `get_item_layout` that loads the default GTK4 XML layout from a file. ```rust fn get_item_layout(&self) -> String { include_str!("../../resources/themes/default/item.xml").to_string() } ``` -------------------------------- ### Arrow-only Keybind Setup Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Configuration for an Arrow-only keybind setup, using only arrow keys and a few other keys for navigation and actions. ```toml [keybinds] close = ["Escape"] next = ["Down"] previous = ["Up"] left = ["Left"] right = ["Right"] page_down = ["Page_Down"] page_up = ["Page_Up"] toggle_exact = ["space"] ``` -------------------------------- ### Theme Setup Functions Source: https://github.com/abenz1267/walker/blob/master/_autodocs/00-index.md Functions for setting up CSS providers and applying themes. ```rust pub fn setup_css_provider() ``` ```rust pub fn setup_themes(elephant: bool, theme: &str, service: bool) ``` ```rust pub fn setup_css(theme: &str) ``` -------------------------------- ### Emergency Actions Configuration Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/02-configuration.md Example TOML configuration for defining emergency actions, specifying text and command. ```toml [[emergencies]] text = "Restart X Server" command = "sudo systemctl restart display-manager" ``` -------------------------------- ### Setup CSS Provider Function Source: https://github.com/abenz1267/walker/blob/master/_autodocs/08-theme-system.md Initializes the CSS provider for GTK4 styling. This function is part of the theme setup process. ```rust pub fn setup_css_provider() ``` -------------------------------- ### Minimal Theme Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/08-theme-system.md Demonstrates a minimal theme structure where only style.css is overridden, relying on default layouts. ```bash ~/.config/walker/themes/minimal/ └── style.css # Only override colors ``` -------------------------------- ### Calc Provider Usage Examples Source: https://github.com/abenz1267/walker/blob/master/_autodocs/10-providers-detailed.md Examples showing how to use the Calc provider for mathematical calculations, including basic arithmetic, powers, and functions. ```text =2+2 → 4 =sqrt(16) → 4 =3.14 * 2^2 → 12.56 =sin(1.57) → 1.0 ``` -------------------------------- ### Setup Walker Window Source: https://github.com/abenz1267/walker/blob/master/_autodocs/09-window-ui.md Initializes the main GTK4 window and all UI components. This function is called during the UI initialization phase. ```rust pub fn setup_window(app: &Application) ``` -------------------------------- ### Keybind Configuration Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Defines keybinds in the config.toml file under the [keybinds] section. Each keybind is an array of key names. ```toml [keybinds] close = ["Escape"] next = ["Down", "Tab"] previous = ["Up", "shift Tab"] left = ["Left"] right = ["Right"] up = ["Up"] down = ["Down"] toggle_exact = ["ctrl Home"] show_actions = ["shift Return"] resume_last_query = ["ctrl r"] quick_activate = ["F1", "F2", "F3"] page_down = ["Page_Down"] page_up = ["Page_Up"] ``` -------------------------------- ### Symbols Provider Usage Examples Source: https://github.com/abenz1267/walker/blob/master/_autodocs/10-providers-detailed.md Examples demonstrating how to use the Symbols provider to find and copy special characters and Unicode symbols. ```text .arrow → ↑ ↓ ← → ↔ .bullet → • ◦ ○ .check → ✓ ✔ ✕ ✖ .heart → ❤ ♥ ♡ ``` -------------------------------- ### Example Theme CSS Source: https://github.com/abenz1267/walker/blob/master/_autodocs/08-theme-system.md An example of a complete `style.css` file for a theme, defining primary colors, background, foreground, border, and success states. It also styles window, entry, listitem, and label elements. ```css :root { --primary: #3b82f6; --background: #ffffff; --foreground: #1f2937; --border: #e5e7eb; --success: #10b981; } window { background-color: var(--background); color: var(--foreground); font-family: "Noto Sans", sans-serif; font-size: 13px; } entry { background-color: var(--background); color: var(--foreground); border: 1px solid var(--border); border-radius: 4px; padding: 8px 12px; margin: 8px; } entry:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1); } listitem:selected { background-color: var(--primary); color: white; } label { margin: 4px; } ``` -------------------------------- ### As Window Mode Configuration Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/09-window-ui.md Example TOML configuration to disable layer shell and use a regular window. Useful for testing or specific window manager environments. ```toml as_window = true ``` -------------------------------- ### Grid Layout Column Configuration Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/09-window-ui.md Example TOML configuration for setting the number of columns in grid layout for different item types. Allows customization of display density. ```toml [columns] default = 3 files = 4 bookmarks = 5 ``` -------------------------------- ### Setup Themes Function Source: https://github.com/abenz1267/walker/blob/master/_autodocs/08-theme-system.md Discovers available themes and loads the specified theme. It takes parameters for elephant availability, theme name, and service status. ```rust pub fn setup_themes(elephant: bool, theme: &str, service: bool) ``` -------------------------------- ### Sway Window Manager Configuration for Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Provides Sway configuration examples for launching Walker, including options for setting window size. ```text # In ~/.config/sway/config bindsym $mod+space exec walker ``` ```text # With sizing bindsym $mod+shift+space exec walker --width 600 --height 400 ``` -------------------------------- ### get_name Method Example Implementation Source: https://github.com/abenz1267/walker/blob/master/_autodocs/04-provider-interface.md An example implementation of the `get_name` method, returning a static string literal for the provider's name. ```rust fn get_name(&self) -> &str { "files" } ``` -------------------------------- ### Explicitly Specify Installed Providers Source: https://github.com/abenz1267/walker/blob/master/_autodocs/12-elephant-communication.md Manually lists the providers that Walker should consider installed. This overrides auto-detection. ```toml installed_providers = [ "desktopapplications", "files", "calc", "clipboard", "symbols", "websearch", "todo", "bookmarks" ] ``` -------------------------------- ### Layer Shell Configuration Example Source: https://github.com/abenz1267/walker/blob/master/_autodocs/09-window-ui.md Example TOML configuration for Wayland layer shell properties. Specifies layer, anchors, and exclusive zone. ```toml [shell] layer = "overlay" # "top" or "overlay" anchor_top = true anchor_left = true anchor_right = false anchor_bottom = false exclusive_zone = 0 # Space to reserve for this surface ``` -------------------------------- ### Launch Walker Application Source: https://github.com/abenz1267/walker/blob/master/README.md Opens the Walker application. This command can be used after starting the Walker service. ```bash walker ``` -------------------------------- ### Launch Walker Service Source: https://github.com/abenz1267/walker/blob/master/README.md Starts Walker as a background service for improved startup performance. Ensure `elephant` and necessary providers are running. ```bash walker --gapplication-service ``` -------------------------------- ### Setup Layer Shell Integration Source: https://github.com/abenz1267/walker/blob/master/_autodocs/09-window-ui.md Configures the GTK window to use the Wayland layer shell protocol for advanced window management. Requires a `Shell` configuration. ```rust pub fn setup_layer_shell(window: &ApplicationWindow, shell_config: &Shell) ``` -------------------------------- ### Example Provider Layout Source: https://github.com/abenz1267/walker/blob/master/_autodocs/08-theme-system.md Defines a custom layout for a provider, specifying the structure and appearance of items. ```xml horizontal 8 32 vertical start bold start ["caption"] ``` -------------------------------- ### Create Test Theme CSS Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Create a new theme directory and a `style.css` file to define custom styles for the Walker application. This example sets a primary color and styles the window and entry widgets. ```css :root { --primary: #ff0000; } window { background-color: #ffffff; color: #000000; } entry { background-color: var(--primary); color: white; padding: 8px; } ``` -------------------------------- ### Pre-select Second Option in Dmenu Source: https://github.com/abenz1267/walker/blob/master/_autodocs/05-command-line-interface.md This example pipes options into Walker in dmenu mode and uses `-c 1` to pre-select the second option. ```bash # Pre-select second option (echo "Yes"; echo "No"; echo "Cancel") | walker -d -c 1 ``` -------------------------------- ### Use Walker as Dmenu Replacement Source: https://github.com/abenz1267/walker/blob/master/_autodocs/05-command-line-interface.md This example shows how to pipe text into Walker to use it as a dmenu replacement for selecting actions. ```bash # Use walker as dmenu replacement echo "Install Neofetch" | walker --dmenu --placeholder "Select action..." ``` -------------------------------- ### Install Walker as a System Package Source: https://github.com/abenz1267/walker/blob/master/README.md Add the Walker package to your system environment packages. This option does not support configuration via Nix. ```nix environment.systemPackages = [inputs.walker.packages..default]; ``` -------------------------------- ### Get and Set Application Theme Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Functions to manage the name of the currently active theme. ```rust pub fn get_theme() -> String pub fn set_theme(val: String) ``` -------------------------------- ### Function Signatures for Configuration and Socket Operations Source: https://github.com/abenz1267/walker/blob/master/_autodocs/11-types-and-structs.md Illustrates function signatures for retrieving configuration, initializing sockets, and getting query data, showcasing the use of Result and String return types. ```rust pub fn get_config() -> &'static Walker pub fn init_socket() -> Result<(), Box> pub fn get_last_query(provider: &str) -> String // Returns empty if not found ``` -------------------------------- ### Get Index Instead of Text in Dmenu Source: https://github.com/abenz1267/walker/blob/master/_autodocs/05-command-line-interface.md This example demonstrates piping options into Walker in dmenu mode and using the `--index` flag to retrieve the selection's index. ```bash # Get index instead of text (echo "Option A"; echo "Option B") | walker --dmenu --index ``` -------------------------------- ### Get and Set Available Themes Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Functions to track and manage the list of available themes discovered from theme directories. ```rust pub fn get_available_themes() -> Vec pub fn set_available_themes(val: Vec) ``` -------------------------------- ### Get Configuration Function Source: https://github.com/abenz1267/walker/blob/master/_autodocs/02-configuration.md Rust function to retrieve a reference to the loaded configuration. Panics if the configuration has not been initialized. ```rust pub fn get_config() -> &'static Walker ``` -------------------------------- ### Minimal Provider Implementation Source: https://github.com/abenz1267/walker/blob/master/_autodocs/04-provider-interface.md A basic example of implementing the `Provider` trait for a custom provider. This includes defining the provider's name. ```rust use super::Provider; #[derive(Debug)] pub struct MyProvider; impl Provider for MyProvider { fn get_name(&self) -> &str { "myprovider" } } ``` -------------------------------- ### Add Walker Binary Caches Source: https://github.com/abenz1267/walker/blob/master/README.md Configure Nix settings to include Walker's binary caches. This can improve installation and update performance by using pre-built binaries. ```nix nix.settings = { extra-substituters = ["https://walker.cachix.org" "https://walker-git.cachix.org"]; extra-trusted-public-keys = ["walker.cachix.org-1:fG8q+uAaMqhsMxWjwvk0IMb4mFPFLqHjuvfwQxE4oJM=" "walker-git.cachix.org-1:vmC0ocfPWh0S/vRAQGtChuiZBTAe4wiKDeyyXM0/7pM="]; }; ``` -------------------------------- ### Install Walker as a Package with Home Manager Source: https://github.com/abenz1267/walker/blob/master/README.md Add the Walker package to your system packages or Home Manager packages. This option does not support configuration via Nix. ```nix home.packages = [inputs.walker.packages..default]; ``` -------------------------------- ### Create Custom Item Layout XML Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Define a custom item layout using XML in `~/.config/walker/themes/test/item.xml`. This example creates a simple GtkLabel. ```xml test ``` -------------------------------- ### Action Keybind: quick_activate Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Optional array for quick-launch keybinds. Each keybind corresponds to buttons 0, 1, 2, etc., activating the associated provider directly. ```toml quick_activate = ["F1", "F2", "F3"] ``` -------------------------------- ### Build and Run Walker from Source Source: https://github.com/abenz1267/walker/blob/master/README.md Clone the repository, build the release version using Cargo, and then run the executable. ```bash # Clone the repository git clone https://github.com/abenz1267/walker.git cd walker # Build with Cargo cargo build --release # Run Walker ./target/release/walker ``` -------------------------------- ### Custom CSS Classes for Theming Source: https://github.com/abenz1267/walker/blob/master/_autodocs/09-window-ui.md Providers can add custom CSS classes to the window for advanced theming and styling. Examples include provider-specific styles. ```css window.dark # Dark theme active window.light # Light theme active window.accent-blue # Blue accent color window.grid-layout # Grid view active window.password-mode # Password input mode window.provider-files { } window.provider-calculator { } ``` -------------------------------- ### Keybind System Initialization Function Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md The setup_binds function is called from init_ui() to initialize the keybind system by loading keybinds from configuration and setting up event handlers. ```rust pub fn setup_binds() ``` -------------------------------- ### i3 Window Manager Configuration for Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Shows how to bind keys in i3 configuration to launch Walker, optionally with specific providers or quick-activation indices. ```i3 # In ~/.config/i3/config bindsym $mod+space exec walker ``` ```i3 # Or with specific provider bindsym $mod+shift+p exec walker --provider files ``` ```i3 # Quick activation bindsym $mod+1 exec walker --quick-activate 0 bindsym $mod+2 exec walker --quick-activate 1 bindsym $mod+3 exec walker --quick-activate 2 ``` -------------------------------- ### Test UI and Config Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Steps for testing the application's user interface and configuration after building. ```bash ./target/release/walker ``` -------------------------------- ### Window Creation Source: https://github.com/abenz1267/walker/blob/master/_autodocs/09-window-ui.md Sets up the main walker window and initializes all UI components. This function is responsible for building the GTK4 window, setting up event handlers, configuring layer shell integration, initializing input and list widgets, and applying initial CSS. ```APIDOC ## setup_window ### Description Initializes the main walker window and all its UI components. This function is called during the UI initialization phase. ### Method Rust Function ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```rust setup_window(app: &Application) ``` ### Response #### Success Response N/A #### Response Example N/A ``` -------------------------------- ### text_transformer Method Example Implementation Source: https://github.com/abenz1267/walker/blob/master/_autodocs/04-provider-interface.md Example implementation of `text_transformer`. It hides the label if the item text is empty, otherwise sets the label's text. ```rust fn text_transformer(&self, item: &Item, label: &Label) { if item.text.is_empty() { label.set_visible(false); return; } label.set_text(&item.text); } ``` -------------------------------- ### Enable Walker with Home Manager Module Source: https://github.com/abenz1267/walker/blob/master/README.md Import the Home Manager module for Walker and enable its service in your configuration. ```nix imports = [inputs.walker.homeManagerModules.default]; programs.walker.enable = true; ``` -------------------------------- ### Rofi Alternative using Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Shows how to alias 'rofi' to 'walker --dmenu' for a seamless transition and how to execute commands selected via Walker. ```bash # Replace rofi with walker alias rofi='walker --dmenu' # Run command cmd=$(echo -e "firefox\nneofetch\nhtop" | walker --dmenu) exec $cmd ``` -------------------------------- ### Use Custom Theme Source: https://github.com/abenz1267/walker/blob/master/_autodocs/05-command-line-interface.md Load a custom theme by specifying its name with the `-t` or `--theme` flag. ```bash # Use custom theme walker -t my_custom_theme ``` -------------------------------- ### Example QueryRequest JSON Source: https://github.com/abenz1267/walker/blob/master/_autodocs/12-elephant-communication.md Illustrates the JSON format of a QueryRequest sent from Walker to the Elephant socket. ```json { "query": "search text", "provider": "provider_name", "exact": false, } ``` -------------------------------- ### KDE Shortcut Configuration for Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Instructions for setting up Walker shortcuts in KDE System Settings. ```text # System Settings → Shortcuts → Create new shortcut walker ``` ```text walker --dmenu ``` ```text walker --provider files ``` -------------------------------- ### Get and Set Window Visibility Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Tracks whether the Walker window is currently visible to the user. ```rust pub fn is_visible() -> bool pub fn set_is_visible(val: bool) ``` -------------------------------- ### Get and Set Current Provider Set Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Manages the name of the currently active set of providers. ```rust pub fn get_current_set() -> String pub fn set_current_set(val: String) ``` -------------------------------- ### Environment Variable Overrides Source: https://github.com/abenz1267/walker/blob/master/_autodocs/02-configuration.md Examples of overriding configuration settings using environment variables with the WALKER_ prefix. ```bash # Set theme WALKER_THEME=dark walker # Set debug mode WALKER_DEBUG=true walker # Set provider list WALKER_PROVIDERS_DEFAULT="files desktopapplications" walker ``` -------------------------------- ### Get and Set Current Prefix Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Tracks the currently active prefix character used for provider selection. ```rust pub fn get_current_prefix() -> String pub fn set_current_prefix(val: String) ``` -------------------------------- ### Example QueryResponse JSON Source: https://github.com/abenz1267/walker/blob/master/_autodocs/12-elephant-communication.md Illustrates the JSON format of a QueryResponse containing an item, as received by Walker from the Elephant socket. ```json { "item": { "text": "test.txt", "subtext": "/home/user/test.txt", "score": 1000, "actions": ["open", "edit"], "provider": "files", ... } } ``` -------------------------------- ### Create Release Build and Strip Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Builds an optimized release version of the project and then strips debugging symbols to reduce file size. ```bash cargo build --release strip target/release/walker ``` -------------------------------- ### Provider Trait Definition Source: https://github.com/abenz1267/walker/blob/master/_autodocs/00-index.md Defines the `Provider` trait with methods for getting provider information, actions, and text transformation. ```rust pub fn setup_providers(elephant: bool) ``` ```rust pub trait Provider: Sync + Send + Debug { fn get_name(&self) -> &str; fn get_actions(&self) -> Vec; fn get_keybind_hint(&self, actions: &[String]) -> Vec; fn get_item_layout(&self) -> String; fn text_transformer(&self, item: &Item, label: &Label); // ... additional methods } ``` -------------------------------- ### Launch Walker in Standard Mode Source: https://github.com/abenz1267/walker/blob/master/_autodocs/05-command-line-interface.md Launches walker as a normal application. For optimal performance, ensure the elephant service is running and `walker --gapplication-service` is active. ```bash walker ``` -------------------------------- ### Set Placeholder Text Source: https://github.com/abenz1267/walker/blob/master/_autodocs/09-window-ui.md Updates the placeholder text displayed in the input field when it is empty. This can guide user input. ```rust pub fn set_placeholder_text(text: &str) ``` -------------------------------- ### Initialization Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Initializes the global application state with default values. This function should be called once during the application's startup. ```APIDOC ## init_app_state ### Description Initializes the global state with default values. Must be called once during application startup. ### Function Signature ```rust pub fn init_app_state() ``` ``` -------------------------------- ### Launch Applications with Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Opens Walker to search and launch applications from your system. ```bash walker # Search and launch applications ``` -------------------------------- ### Display Walker Version Source: https://github.com/abenz1267/walker/blob/master/_autodocs/05-command-line-interface.md Prints the application version to the console and then exits. ```bash walker --version ``` -------------------------------- ### Get Input Field Text Source: https://github.com/abenz1267/walker/blob/master/_autodocs/09-window-ui.md Retrieves the current text content of the input field. Useful for accessing user input. ```rust pub fn get_input_text() -> String ``` -------------------------------- ### Build with Size Optimization Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Builds the project using the release profile configured for size optimization. ```bash cargo build --release ``` -------------------------------- ### Perform Quick Calculations with Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Enables immediate calculation by typing an expression prefixed with '='. For example, '=2+2' will display '4'. ```bash walker # Type: =2+2 # Result: 4 shown immediately ``` -------------------------------- ### Create Walker Configuration Source: https://github.com/abenz1267/walker/blob/master/_autodocs/11-types-and-structs.md Instantiates a new Walker configuration. This is typically the first step in setting up Walker. ```rust let config = Walker::new()?; ``` -------------------------------- ### Get and Set Selected Provider Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Manages the currently selected provider. Setting the provider also triggers an update to grid settings. ```rust pub fn get_provider() -> String pub fn set_provider(val: String) ``` -------------------------------- ### Configuration Functions Source: https://github.com/abenz1267/walker/blob/master/_autodocs/00-index.md Functions for loading and accessing application configuration. ```rust pub fn load() -> Result<(), Box> ``` ```rust pub fn get_config() -> &'static Walker ``` -------------------------------- ### Dynamic Provider Selection with Dmenu Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Use a bash script with Walker's dmenu mode to dynamically select a provider based on user input, then launch Walker with the chosen provider. ```bash #!/bin/bash provider=$(echo -e "files\napplications\ncalculator" | walker --dmenu) walker --provider "$provider" ``` -------------------------------- ### UI Window Functions Source: https://github.com/abenz1267/walker/blob/master/_autodocs/00-index.md Functions for setting up and manipulating the application window, including text input and quitting. ```rust pub fn setup_window(app: &Application) ``` ```rust pub fn set_input_text(text: &str) ``` ```rust pub fn set_placeholder_text(text: &str) ``` ```rust pub fn set_keybind_hint() ``` ```rust pub fn quit(app: &Application, should_close: bool) ``` ```rust pub fn with_window(f: F) ``` -------------------------------- ### Placeholder Configuration Struct Source: https://github.com/abenz1267/walker/blob/master/_autodocs/11-types-and-structs.md Defines placeholder text for input fields and list areas within providers. Used to guide user input. ```rust pub struct Placeholder { pub input: String, // Input field placeholder pub list: String, // List area placeholder } ``` -------------------------------- ### Build and Run Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Clones the Walker repository and provides commands for building and running release or development versions. ```bash git clone https://github.com/abenz1267/walker cd walker # Release build cargo build --release # Output: target/release/walker # Dev build cargo build # Output: target/debug/walker # Run directly cargo run --release ``` -------------------------------- ### Systemd Service Configuration for Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Configure systemd to run Walker as a user service. This ensures Walker starts automatically on login and restarts if it crashes. ```systemd [Unit] Description=Walker Application Launcher After=graphical-session-started.target [Service] Type=simple ExecStart=%h/.cargo/bin/walker --gapplication-service Restart=always Environment=DISPLAY=:0 Environment=WAYLAND_DISPLAY=wayland-0 [Install] WantedBy=graphical-session.target ``` -------------------------------- ### Manage Parameter and Initial Window Width Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Functions to manage window width constraints, differentiating between command-line parameters and the original initial width. ```rust pub fn get_parameter_width() -> Option pub fn set_parameter_width(val: Option) pub fn get_initial_width() -> Option pub fn set_initial_width(val: Option) ``` -------------------------------- ### Custom Text Transformation Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Implement custom text transformation logic within the `text_transformer` method. This example formats the text and applies a CSS class. ```rust fn text_transformer(&self, item: &Item, label: &Label) { // Custom formatting let formatted = format!("[{}] {}", self.get_name(), item.text); label.set_text(&formatted); // Apply CSS classes label.add_css_class("custom-text"); } ``` -------------------------------- ### Registering a Custom Provider Source: https://github.com/abenz1267/walker/blob/master/_autodocs/10-providers-detailed.md Register a custom provider by adding it to the `providers/mod.rs` file and calling `register_provider` in `setup_providers`. ```rust mod myprovider; pub use myprovider::MyProvider; // In setup_providers(): let my_provider = Box::new(MyProvider); register_provider(my_provider); ``` -------------------------------- ### Override Item Layout with XML Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Define a custom XML interface for item layouts to control how items are displayed. This example uses a GtkBox with an Image and a Label. ```xml horizontal 8 32 start ``` -------------------------------- ### Deserialize Query Response in Rust Source: https://github.com/abenz1267/walker/blob/master/_autodocs/12-elephant-communication.md Example of deserializing a byte stream into a `QueryResponse` object using Protocol Buffers in Rust. Handles potential parsing errors. ```rust let response = QueryResponse::parse_from_bytes(&bytes)?; ``` -------------------------------- ### Action Keybind: show_actions Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Configures the keybind for displaying available actions for the current item. ```toml show_actions = ["shift Return", "alt a"] ``` -------------------------------- ### Manage Parameter and Initial Window Height Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Functions to manage window height constraints, differentiating between command-line parameters and the original initial height. ```rust pub fn get_parameter_height() -> Option pub fn set_parameter_height(val: Option) pub fn get_initial_height() -> Option pub fn set_initial_height(val: Option) ``` -------------------------------- ### Get and Set Prefix Provider Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Manages the provider selected based on a prefix (e.g., 'websearch' for '?'). This operation fetches provider state and updates grid settings if the provider changes. ```rust pub fn get_prefix_provider() -> String pub fn set_prefix_provider(val: String) ``` -------------------------------- ### Rust: Get Provider State Information Source: https://github.com/abenz1267/walker/blob/master/_autodocs/07-data-communication.md Fetches metadata for a given provider, such as its available actions and help text. This is used to display action hints when the provider context changes. ```rust pub fn get_provider_state(provider: String) ``` -------------------------------- ### Set Small Popup Window Size Source: https://github.com/abenz1267/walker/blob/master/_autodocs/05-command-line-interface.md Configure a small window size for a popup-like behavior using `--width` and `--height`. ```bash # Small popup walker --width 300 --height 150 ``` -------------------------------- ### Clipboard Provider Configuration Source: https://github.com/abenz1267/walker/blob/master/_autodocs/10-providers-detailed.md Configuration for the Clipboard provider, setting its prefix and defining the 'activate' action bound to the Return key. ```toml [[providers.prefixes]] provider = "clipboard" prefix = ":" [providers.clipboard] time_format = "%Y-%m-%d %H:%M" [providers.actions.clipboard] [[providers.actions.clipboard]] action = "activate" bind = "Return" after = "close" ``` -------------------------------- ### Apply Theme via Command Line Source: https://github.com/abenz1267/walker/blob/master/_autodocs/08-theme-system.md Applies a custom theme to Walker directly from the command line. ```bash walker --theme mytheme ``` -------------------------------- ### Process Piped Output with Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Use Walker to select items from piped input and then process the selection with other commands. Examples include selecting files for word count, processes to kill, and git branches to checkout. ```bash # Use walker to select file, then process it walker --dmenu --provider files | xargs wc -l # Select process to kill ps aux | tail -n +2 | awk '{print $2, $11}' | walker --dmenu | awk '{print $1}' | xargs kill -9 # Select from git branches git branch | walker --dmenu | xargs git checkout ``` -------------------------------- ### Run Elephant Daemon with Debug Flag Source: https://github.com/abenz1267/walker/blob/master/_autodocs/07-data-communication.md This bash command shows how to start the Elephant daemon with the debug flag enabled. This is useful for diagnosing issues related to the daemon's internal operations and its communication with clients like Walker. ```bash elephant --debug ``` -------------------------------- ### Multi-key Sequences in Keybinds Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Demonstrates how to define keybinds that use spaces. Each element in the array is treated as a separate keybind, not a sequence. ```toml quick_activate = ["F1", "F2"] # This is: Ctrl plus semicolon (one key event) toggle_exact = ["ctrl semicolon"] ``` -------------------------------- ### Configure Release Profile for Size Optimization Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Defines release build settings in Cargo.toml to enable aggressive optimizations and symbol stripping for minimal binary size. ```toml [profile.release] opt-level = 3 lto = true codegen-units = 1 strip = true ``` -------------------------------- ### Vim-like Keybinds Configuration for Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Configures Walker with Vim-like keybindings for navigation, closing, and file actions. ```toml [keybinds] close = ["Escape"] next = ["j", "Down"] previous = ["k", "Up"] left = ["h", "Left"] right = ["l", "Right"] page_down = ["ctrl d"] page_up = ["ctrl u"] toggle_exact = ["ctrl Home"] resume_last_query = ["ctrl r"] [providers.actions.files] [[providers.actions.files]] action = "open" bind = "Return" [[providers.actions.files]] action = "edit" bind = "e" ``` -------------------------------- ### Basic File Search with Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Initiates a file search using the 'files' provider. You can also type '/' in Walker to activate file search. ```bash walker --provider files ``` ```bash # Type "/" in walker to search files walker # Then type: /Documents ``` -------------------------------- ### Access Configuration Option Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Retrieve the application configuration, including newly added options, using the `get_config` function. ```rust use crate::config::get_config; let config = get_config(); if config.my_new_option { // ... } ``` -------------------------------- ### Multi-step Selection with Walker Source: https://github.com/abenz1267/walker/blob/master/_autodocs/13-examples-and-patterns.md Implement a multi-step selection process using Walker's dmenu. First, select a category, then select an option within that category. ```bash #!/bin/bash category=$(echo -e "Settings\nTools\nFiles" | walker --dmenu) case "$category" in "Settings") option=$(echo -e "Keyboard\nMouse\nDisplay" | walker --dmenu) echo "Configure: $option" ;;;; "Tools") tool=$(echo -e "Screenshot\nTimestamp\nCalculator" | walker --dmenu) echo "Launch: $tool" ;;;; "Files") walker --provider files ;;;; esac ``` -------------------------------- ### Walker Project Structure Overview Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Illustrates the directory and file layout of the Walker project, highlighting the purpose of key directories and files. ```text walker/ ├── src/ │ ├── main.rs # Entry point │ ├── config.rs # Configuration system │ ├── state/ │ │ └── mod.rs # Global state management │ ├── providers/ │ │ ├── mod.rs # Provider trait & setup │ │ ├── default_provider.rs # Applications launcher │ │ ├── files.rs # File browser │ │ ├── calc.rs # Calculator │ │ ├── clipboard.rs # Clipboard history │ │ └── ... (other providers) │ ├── ui/ │ │ ├── mod.rs # UI setup │ │ └── window.rs # Window management │ ├── data.rs # Socket communication │ ├── keybinds.rs # Keyboard input │ ├── theme/ │ │ └── mod.rs # Theme loading/CSS │ ├── preview/ │ │ └── mod.rs # Item preview │ ├── renderers/ │ │ └── mod.rs # Custom renderers │ ├── protos/ # Protocol Buffer definitions │ └── wayland_blur.rs # Wayland blur effect ├── resources/ │ ├── config.toml # Default config │ └── themes/ │ ├── default/ │ │ ├── style.css # Default CSS │ │ ├── item.xml # Default item layout │ │ └── ... (other layouts) │ └── ... (other themes) ├── Cargo.toml # Dependencies └── build.rs # Build script ``` -------------------------------- ### Create Theme Directory Source: https://github.com/abenz1267/walker/blob/master/_autodocs/08-theme-system.md Creates a new directory for a custom theme within the Walker configuration. ```bash mkdir -p ~/.config/walker/themes/mytheme ``` -------------------------------- ### Manage Initial Placeholder Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Stores the original placeholder text before any parameter overrides are applied. ```rust pub fn get_initial_placeholder() -> String public fn set_initial_placeholder(val: String) ``` -------------------------------- ### Manage Parameter and Initial Minimum Window Width Source: https://github.com/abenz1267/walker/blob/master/_autodocs/03-state-management.md Functions to manage the minimum width constraints for scrollable content, distinguishing between parameter-set and initial values. ```rust pub fn get_parameter_min_width() -> Option pub fn set_parameter_min_width(val: Option) pub fn get_initial_min_width() -> Option pub fn set_initial_min_width(val: Option) ``` -------------------------------- ### Calc Provider Configuration Source: https://github.com/abenz1267/walker/blob/master/_autodocs/10-providers-detailed.md Configuration for the Calc provider, setting its prefix and defining the 'activate' action bound to the Return key. ```toml [[providers.prefixes]] provider = "calc" prefix = "=" [providers.actions.calc] [[providers.actions.calc]] action = "activate" bind = "Return" after = "stay_open" ``` -------------------------------- ### Enable Walker with NixOS Module Source: https://github.com/abenz1267/walker/blob/master/README.md Import the NixOS module for Walker and enable its service in your configuration. Note that `runAsService` is not supported with this option. ```nix imports = [inputs.walker.nixosModules.default]; programs.walker.enable = true; ``` -------------------------------- ### Set Fixed Window Size Source: https://github.com/abenz1267/walker/blob/master/_autodocs/05-command-line-interface.md Use `--width` and `--height` to set a fixed pixel size for the Walker window. ```bash # Fixed size window walker --width 600 --height 400 ``` -------------------------------- ### Launch Walker via Socket Source: https://github.com/abenz1267/walker/blob/master/README.md Opens Walker by making a socket call, offering an even faster launch than a direct `walker` call. This method does not support command-line options. ```bash nc -U /run/user/1000/walker/walker.sock ``` -------------------------------- ### Provider-Specific Action Overrides Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Illustrates how to override default actions for specific providers like 'files' and 'calculator'. This allows customization of keybinds based on the context. ```toml [providers.actions.files] [[providers.actions.files]] action = "open" bind = "Return" after = "close" [[providers.actions.files]] action = "edit" bind = "ctrl e" after = "stay_open" [providers.actions.calculator] [[providers.actions.calculator]] action = "copy" bind = "Return" after = "stay_open" ``` -------------------------------- ### get_actions Source: https://github.com/abenz1267/walker/blob/master/_autodocs/04-provider-interface.md Retrieves the available actions for this provider. It attempts to fetch actions from the configuration, falling back to a default 'activate' action if none are defined. ```APIDOC ## get_actions ### Description Returns available actions for this provider. Fetches from config if defined, otherwise returns a default activate action. ### Signature ```rust fn get_actions(&self) -> Vec ``` ### Default Behavior ```rust fn get_actions(&self) -> Vec { get_config() .providers .actions .get(self.get_name()) .cloned() .unwrap_or_else(|| { vec![Action { unset: None, action: "activate".to_string(), default: Some(true), bind: Some("Return".to_string()), after: None, label: None, }] }) } ``` ### Action Structure ```rust pub struct Action { pub action: String, // Action identifier pub bind: Option, // Keybind (e.g., "ctrl e") pub label: Option, // Display label pub default: Option, // Is default action pub after: Option, // Post-action behavior pub unset: Option, // Remove this action (config override) } pub enum AfterAction { Close, StayOpen, } ``` ``` -------------------------------- ### Navigation Keybind: up Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Configures an alternative keybind for upward navigation. ```toml up = ["Up"] ``` -------------------------------- ### Fallback Actions Configuration Source: https://github.com/abenz1267/walker/blob/master/_autodocs/06-keybinds-system.md Shows how to define fallback actions that are used if a specific provider does not define its own actions. This ensures a default set of actions is always available. ```toml [providers.actions.fallback] [[providers.actions.fallback]] action = "preview" bind = "ctrl p" ``` -------------------------------- ### Files Provider Configuration Source: https://github.com/abenz1267/walker/blob/master/_autodocs/10-providers-detailed.md Configuration for the Files provider, setting its prefix and defining actions like 'open' and 'edit'. It also shows how to ignore file previews. ```toml [[providers.prefixes]] provider = "files" prefix = "/" [providers] ignore_preview = ["files"] # Don't show file previews by default [providers.actions.files] [[providers.actions.files]] action = "open" bind = "Return" default = true [[providers.actions.files]] action = "edit" bind = "ctrl e" ``` -------------------------------- ### Run All Tests Source: https://github.com/abenz1267/walker/blob/master/_autodocs/14-development-guide.md Executes all tests in the project. Ensure all tests pass before committing. ```bash cargo test ```