hyprlauncher
repository·main·Indexed 43 days ago
https://github.com/hyprwm/hyprlauncherA 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.
What's inside hyprlauncher
- 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.
Install runtime dependencies for hyprlauncher providers
mainDepending on which providers you intend to use, you may need to install
wl-copyto enable copying functionality:- Desktop provider: No additional dependencies required.
- Unicode provider: Requires
wl-copyfor copying selected characters. - Math provider: Requires
wl-copyto copy calculation results. - Font provider: Requires
wl-copyto copy font names/results.
# Example for Arch Linux (assuming wl-clipboard provides wl-copy) npm install wl-clipboardPass explicit options via CLI
mainYou can provide a comma-separated list of options directly using the
-oor--optionsflag. This bypasses the standard finder logic and uses the provided list as the data source.hyprlauncher --options "app1,app2,app3"Run hyprlauncher in dmenu mode
mainWhen using the
-mor--dmenuflag, hyprlauncher reads a newline-separated list of options fromstdininstead of using its default search logic. This allows you to pipe custom lists into the launcher.echo -e "option1\noption2\noption3" | hyprlauncher --dmenuRefresh the launcher query with CUI::scheduleQueryRefresh
mainUsescheduleQueryRefresh()to trigger a refresh of the current query. This is typically used when the input state changes and the underlying search engine needs to be re-queried.Manage the launcher window state with CUI
mainThe
CUIclass manages the visual interface of the launcher. You can control the visibility of the launcher window usingsetWindowOpen(bool open)and check its current state withwindowOpen(). The constructorCUI(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 }Manage search queries with CQueryProcessor
mainThe
CQueryProcessorclass manages the asynchronous search flow. It handles incoming query strings, coordinates with differentIFinderimplementations, 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
IFinderinstance. - 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);Update launcher results with CUI::updateResults
mainTo 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));Reference: hyprlauncher CLI flags
mainThe following flags are available for the
hyprlauncherexecutable:-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 loggingUse the hyprlauncher CLI
mainHyprlauncher 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 loggingSelect a query provider with selectQueryProvider()
mainUse
selectQueryProvider(const std::string& finder)to switch the active search provider to one identified by the provided name.void selectQueryProvider(const std::string& finder);Override the query provider with overrideQueryProvider()
mainUse
overrideQueryProvider(IFinder* finder)to temporarily or permanently replace the active finder with a specificIFinderimplementation. This is useful for injecting custom search logic or testing specific finders.void overrideQueryProvider(IFinder* finder);