zhengqunkoo avatar

via

0 subscribers
ShellMakefile

Created Aug 2020

GPL-3.0 license

Live activities

Updated the via-feed script to dynamically read excluded paths from a blacklist file rather than using a hardcoded ~/code/* exclusion. This change allows for more flexible directory management by parsing ~/.config/via/feed.blacklist to determine which paths the indexer should ignore. It gives users granular control over their search index content.

The via-feed script now includes results from the existing dmenu_run cache when generating its own application cache. By appending ~/.cache/dmenu_run to the generated file, the tool provides a more comprehensive list of available applications and scripts for quick execution. This makes it easier to keep a unified command launcher index.

The via-open script now proactively checks if a file is executable before falling back to MIME-type detection. This allows for direct execution of scripts or binaries that don't match specific file extensions, making the utility more flexible for handling custom launchers or local tools.

The via utility now supports -r and -ro flags to trigger a cache rebuild via via-feed. The -r flag performs a refresh before proceeding to the menu, while -ro handles a refresh only. This makes it easier to ensure your feed data is up-to-date without needing to manually manage the cache.

The via script now supports dedicated command-line flags to manage cache rebuilding instead of relying on the REBUILD environment variable. Passing -r will rebuild the cache before opening the menu, while -ro performs a background rebuild and exits without presenting the UI. This provides a cleaner and more idiomatic way to manage cache updates directly from the terminal or your defined shortcuts.

Generating the results feed previously required traversing parts of the home directory on every run, which could slow things down. This update introduces a simple caching mechanism to via-feed, storing the output in ~/.cache/via to drastically speed up future executions. To force a manual reconstruction of the cache, you can now run it with the REBUILD=y environment variable. This should make the tool feel noticeably snappier in day-to-day use.

This commit substantially improves the project documentation by clarifying what via does, how its three parts interact, and how each piece can be customized under $HOME/.config/via. It also expands the usage examples and gives more concrete guidance on tuning via-feed, swapping out menu backends like dmenu, fzf, or rofi, and understanding how via-open handles files, folders, URLs, and commands. There’s no code change here, but the rewrite makes the tool much easier to adopt and adapt. Practical effect: new users should be able to get productive faster, and existing users have a clearer path to customization.

This change removes the special ; suffix convention that was previously used to distinguish shell commands from paths, URLs, and app launches. The via script now always routes selections through vopen, and the example shortcuts plus README were updated to match the simpler format. Practically, the launcher config is easier to read and maintain, with one less parsing rule to remember.

The vopen utility was updated to automatically interpret and execute arguments as shell commands (sh -c) if they do not begin with a forward slash. This removes the previous requirement of using a semicolon prefix to explicitly mark commands, relying instead on the script's pattern matching to guess the user's intent. This streamlines usage by allowing direct execution of commands without extra syntax.

Managing the setup for this project just got easier with the addition of a Makefile. It provides standard install and uninstall targets to quickly copy the via, via-feed, and vopen tools to your system's bin directory. This saves developers from manually placing scripts and streamlines uninstallation.

The main via script has been refactored into three distinct, composable parts: via-feed for generating menu options, via-menu for handling user interaction, and via-open (previously vopen) for launching the selection. The primary command now elegantly chains these operations together using standard piping (via-feed | via-menu | via-open). This architectural change improves modularity, making it easier to swap out individual components like the menu interface in the future.

Unix Philosophy

A subtle directory traversal issue was causing vopen to fail when opening multiple relative paths. When an argument was a directory, the script would cd into it to spawn a terminal but failed to navigate back, which broke the resolution of any subsequent relative paths. Adding a simple cd - ensures the original working directory is restored, keeping multi-file opening reliable.

The data gathering logic, which compiles shortcuts, websites, and user files, has been decoupled from the main via launcher and isolated into a new via-feed script. This refactor allows users to completely customize the inputs fed into dmenu without needing to modify the core launcher code. By cleanly separating data generation from execution, modifying or extending the tool's search capabilities is now much more straightforward and modular.

- End of feed -