Environment variables in tmux options not honoured
Opened this issue · 2 comments
Environment
- OS: macOS
14.4.1
- Terminal: iTerm Build
3.5.0beta22
- Shell: zsh
5.9 (x86_64-apple-darwin23.0)
bash3.2.57(1)-release
- tmux:
3.4
Problem
If I follow the instructions and set the @dark-notify-theme-path-light
or dark equivalent as follows:
set -g @dark-notify-theme-path-light '$HOME/.config/tmux/plugins/tmux-colors-solarized/tmuxcolors-light.conf'
^^^^^
It won't work and won't be able to resolve the file because the $HOME
variable won't be expanded:
The theme_path=$(eval echo "$theme_path")
resolves to /$HOME/.config/...
instead of /Users/ramon/.config/...
:
If I add some prints to your script and change the macOS's Dark/Light system preference:
![Screenshot 2024-05-05 at 10 57 39](https://private-user-images.githubusercontent.com/6486812/328012564-847b4f50-670d-4cbc-b402-bafef090adfe.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk4MTQ2NjgsIm5iZiI6MTcxOTgxNDM2OCwicGF0aCI6Ii82NDg2ODEyLzMyODAxMjU2NC04NDdiNGY1MC02NzBkLTRjYmMtYjQwMi1iYWZlZjA5MGFkZmUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcwMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MDFUMDYxMjQ4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWIzMmViYjQzMzg4OTU5NjZhOGUzODUxYTc3MzAxMTljNjE3YmI0NWViMTFhODQ2NjcxM2Y3YzgxYmU5NjZjYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.MZUa4WYYEWmthgGb_udU-NvHxYj3EAyIQQK4mk5A4tg)
Suggested Solution
If instead of using single quotes...
set -g @dark-notify-theme-path-light '$HOME/.config/tmux/plugins/tmux-colors-solarized/tmuxcolors-light.conf'
... I use double quotes...
set -g @dark-notify-theme-path-light "$HOME/.config/tmux/plugins/tmux-colors-solarized/tmuxcolors-light.conf"
... Then this issue does not happen anymore.
I suggest making explicit in the README about this issue (at least happening on macOS) or handling the case in the tmux-theme-mode.sh
script of this project.
Strange, for me it does work to expand $HOME with single quote config. This is my working configuration on macOS:
Interesting... Well for now I will leave it with double quotes and leave it as a mystery. If any user experiences this and might help us see what causes this wrong variable expansion it would be great.
It would be nice to reproduce it in a clean macOS environment, but I don't have the time to spend and try it, so from my side if you want to close the issue I would be fine, with the double quotes it works.