Skip to content

Environment variables in tmux options not honoured #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eulersson
Copy link

@eulersson eulersson commented May 5, 2024

See the issue #1 for full description of what this PR is trying to address.

@eulersson
Copy link
Author

@erikw Feel free to tackle this in any way you want... I you want to discard the PR it's OK but some users, specially on macOS might face the issue of not seeing the change reflected because of the wrong variable expansion.

@eulersson
Copy link
Author

Thanks for your plugin by the way! It's very nice :)

Copy link

@ivuorinen ivuorinen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small typo fix and reformatting for easier reading.

Comment on lines +51 to +52
# `"$HOME/a/b/c"` or else this script needs to sanitize that backslack for the `eval
# echo `"$theme_path"` to properly expand the environment variables.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# `"$HOME/a/b/c"` or else this script needs to sanitize that backslack for the `eval
# echo `"$theme_path"` to properly expand the environment variables.
# `"$HOME/a/b/c"` or else this script needs to sanitize that backslack for
# the `$(eval echo "$theme_path")` to properly expand the environment variables.

Spotted a minor typo, updated the example to reflect the actual code. Otherwise 👍

@erikw
Copy link
Owner

erikw commented Jan 8, 2025

Thank you, I will need to look in to this more in detail when I have access to my own computer again (it will still take a while, hold on…).

As I showed before, single quotes works fine on my setup:
#1 (comment)

Thus I need to debug this further:)

@erikw
Copy link
Owner

erikw commented Jan 11, 2025

I had a quick look at the code now as I had a vague memory that I actually added extra code to make sure that environment variables like $HOME will be expanded, which is my config using single quote works (on my machine hehe). And indeed, I found the code:

# Expand e.g. $HOME
theme_path=$(eval echo "$theme_path")

While I don't have access to this mac machine at the moment still for a while... maybe you could debug on your machine on why your $HOME is not expanded if you set the config variable with single quotes like in the README example.

One way to do this can be to enable debug mode in bash and log it all to a file and inspect.

Edit https://github.com/erikw/tmux-dark-notify/blob/main/scripts/tmux-theme-mode.sh by inserting these two first lines at the top of the file

set -x
exec 2>/tmp/tmux-dark-notify.log

And after running the script, check the output logged to /tmp/tmux-dark-notify.log. Specifically identify this line and see how it executes on your machine, is the $HOME still not expanded after this line?

# Expand e.g. $HOME
theme_path=$(eval echo "$theme_path")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants