hyprlauncher

repository·main·Indexed 43 days ago

https://github.com/hyprwm/hyprlauncher

A high-performance, daemon-based launcher and picker for the Hyprland compositor. It features multi-threaded fuzzy searching and supports multiple content providers including Desktop, Unicode, Emoji, Math, and Font.

Tokens
1.9K
Snippets
11
Records
13
Agent score
57%

What's inside hyprlauncher

  1. Overview of hyprlauncher

    main
    hyprlauncher is a multipurpose and versatile launcher and picker designed specifically for Hyprland. It functions as a daemon by default to ensure instant opening and features fast, multi-threaded fuzzy searching. It supports various providers including Desktop, Unicode, Emoji, Math, and Font, and uses entry frequency caching to prioritize commonly used items.
  2. Install runtime dependencies for hyprlauncher providers

    main

    Depending on which providers you intend to use, you may need to install wl-copy to enable copying functionality:

    • Desktop provider: No additional dependencies required.
    • Unicode provider: Requires wl-copy for copying selected characters.
    • Math provider: Requires wl-copy to copy calculation results.
    • Font provider: Requires wl-copy to copy font names/results.
    # Example for Arch Linux (assuming wl-clipboard provides wl-copy)
    npm install wl-clipboard
  3. Pass explicit options via CLI

    main

    You can provide a comma-separated list of options directly using the -o or --options flag. This bypasses the standard finder logic and uses the provided list as the data source.

    hyprlauncher --options "app1,app2,app3"
  4. Run hyprlauncher in dmenu mode

    main

    When using the -m or --dmenu flag, hyprlauncher reads a newline-separated list of options from stdin instead of using its default search logic. This allows you to pipe custom lists into the launcher.

    echo -e "option1\noption2\noption3" | hyprlauncher --dmenu
  5. Manage the launcher window state with CUI

    main

    The CUI class manages the visual interface of the launcher. You can control the visibility of the launcher window using setWindowOpen(bool open) and check its current state with windowOpen(). The constructor CUI(bool open) allows you to specify the initial visibility state.

    // Example of controlling window visibility
    CUI ui(true); // Start with window open
    ui.setWindowOpen(false); // Hide the window
    if (ui.windowOpen()) {
        // Do something if window is visible
    }
  6. Manage search queries with CQueryProcessor

    main

    The CQueryProcessor class manages the asynchronous search flow. It handles incoming query strings, coordinates with different IFinder implementations, and manages query generations to ensure that stale results from previous queries are not published.

    Key operations include:

    • Scheduling a new query update.
    • Overriding the default finder with a specific IFinder instance.
    • Selecting a specific finder by name.
    // Example of scheduling a query update
    g_queryProcessor->scheduleQueryUpdate("my search term");
    
    // Example of selecting a specific finder by name
    g_queryProcessor->selectQueryProvider("app_finder");
    
    // Example of overriding the provider with a custom finder instance
    g_queryProcessor->overrideQueryProvider(myCustomFinderPtr);
  7. Update launcher results with CUI::updateResults

    main

    To populate the launcher with search results, use updateResults(std::vector<SFinderResult>&& results).

    CRITICAL: This method is NOT thread-safe and must be called from within the main thread.

    // Assuming 'results' is a vector of SFinderResult
    // This MUST be called from the main thread
    ui.updateResults(std::move(results));
  8. Reference: hyprlauncher CLI flags

    main

    The following flags are available for the hyprlauncher executable:

    -d | --daemon              | Do not open after initializing
    -o | --options "a,b,c"   | Pass an explicit option array
    -m | --dmenu               | Pass an option list in dmenu-style (stdin, newline-separated)
    -f | --finder "math"     | Use the specified finder
    -t | --toggle              | When running with this option, toggle instead of opening
    -h | --help                | Print this menu
    -v | --version             | Print version info
        | --quiet               | Disable all logging
        | --verbose             | Enable too much logging
  9. Use the hyprlauncher CLI

    main

    Hyprlauncher can be invoked via the command line with various flags to control its behavior, such as daemon mode, dmenu mode, or specific finder selection. It also supports logging level control.

    hyprlauncher [arg [...]].
    
    Arguments:
     -d | --daemon              | Do not open after initializing
     -o | --options "a,b,c"   | Pass an explicit option array
     -m | --dmenu               | Pass an option list in dmenu-style (stdin, newline-separated)
     -f | --finder "math"     | Use the specified finder
     -t | --toggle              | When running with this option, toggle instead of opening
     -h | --help                | Print this menu
     -v | --version             | Print version info
        | --quiet               | Disable all logging
        | --verbose             | Enable too much logging
  10. Override the query provider with overrideQueryProvider()

    main

    Use overrideQueryProvider(IFinder* finder) to temporarily or permanently replace the active finder with a specific IFinder implementation. This is useful for injecting custom search logic or testing specific finders.

    void overrideQueryProvider(IFinder* finder);