Fix shell command substitution in binary path configuration#491
Open
BrianGreenhill wants to merge 1 commit intoJean-Tinland:masterfrom
Open
Fix shell command substitution in binary path configuration#491BrianGreenhill wants to merge 1 commit intoJean-Tinland:masterfrom
BrianGreenhill wants to merge 1 commit intoJean-Tinland:masterfrom
Conversation
Add support for shell command substitutions (e.g., $(which aerospace)) in binary path configuration options. This allows portable configuration files that work across different architectures and installation paths. Previously, the default settings advertised support for $(which ...) syntax in paths like aerospacePath, yabaiPath, etc., but this was never actually implemented. The literal string "$(which aerospace)" would be used as the command, causing execution failures. This commit adds proper expansion of shell substitutions when loading the external config file: - Expands $(which ...) patterns by setting PATH to include common Homebrew locations (/opt/homebrew/bin, /usr/local/bin) before evaluation - Works in Übersicht's restricted environment where user PATH is not available - Preserves original substitution syntax when saving config back to disk, so $(which aerospace) remains in the file rather than being replaced with the expanded path - Handles expansion failures gracefully by falling back to original value This enables truly portable configuration files that work across: - Apple Silicon Macs (Homebrew in /opt/homebrew) - Intel Macs (Homebrew in /usr/local) - Different installation methods and paths Binary path options affected: - global.aerospacePath - global.yabaiPath - global.flashspacePath - githubWidgetOptions.ghBinaryPath - mpdWidgetOptions.mpdBinaryPath - gpuWidgetOptions.gpuMacmonBinaryPath
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add support for shell command substitutions (e.g., $(which aerospace)) in binary path configuration options. This allows portable configuration files that work across different architectures and installation paths.
Previously, the default settings advertised support for
$(which ...)syntax in paths like aerospacePath, yabaiPath, etc., but this was never actually implemented. The literal string "$(which aerospace)" would be used as the command, causing execution failures.This commit adds proper expansion of shell substitutions when loading the external config file:
This enables truly portable configuration files that work across:
Binary path options affected:
Fixes # #492
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Test A: Shell substitution expansion on config load
"aerospacePath": "$(which aerospace)"in~/.simplebarrc/opt/homebrew/bin/aerospace)Test B: Config preservation on save
"aerospacePath": "$(which aerospace)"in~/.simplebarrc~/.simplebarrcstill contains"$(which aerospace)"(not the expanded path)Test C: Fallback behavior
"aerospacePath": "$(which nonexistent)"in~/.simplebarrcTest Configuration:
Additional Testing Notes:
/opt/homebrew/bin/aerospaceChecklist:
Changes to make to the documentation
Please list any changes to the documentation that are required to reflect your changes.