Skip to content
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

Conditional with pane_ssh_connected not working #12

Open
cvuorinen opened this issue Oct 13, 2019 · 3 comments
Open

Conditional with pane_ssh_connected not working #12

cvuorinen opened this issue Oct 13, 2019 · 3 comments

Comments

@cvuorinen
Copy link

cvuorinen commented Oct 13, 2019

I would like to change status line based on ssh connection, but I can't get the conditional working. First of all, I think the example in readme has incorrect variable name, shouldn't #{?#{pane_ssh_connection},ssh,no-ssh} be #{?#{pane_ssh_connected},ssh,no-ssh}?

But anyway, neither of those seem to work. They both just always display "no-ssh". And I've also tried just #{?pane_ssh_connected,ssh,no-ssh} but same result. The #U and #H interpolation work correctly, I can see the user and hostname of my ssh connection, but the conditional still displays "no-ssh". If I just put #{pane_ssh_connected} in the status, I see 1 when ssh is connected and nothing when no ssh connection. But still the conditional is not working.

Am I missing something here? I'm fairly new to tmux so I've not used the conditionals before.
I'm running tmux 2.9 on Ubuntu.

@soyuka
Copy link
Owner

soyuka commented Oct 14, 2019

#{pane_ssh_connected} I guess you need to cast this as a boolean somehow? Could you send me a documentation PR if you manage to make this work? Tyvm.

@cvuorinen
Copy link
Author

Yea, I can send a PR if I get it working. But don't have any idea ATM what to do to it, everything I have tried failed. I'm not familiar with casting to boolean in tmux conf.

@terrabitz
Copy link

@cvuorinen I think you need to make sure it's quoted properly in the format string. For example, the following works just fine for me:

set -g status-left '#{?#{pane_ssh_connected},ssh,no-ssh}'

One other thing I've found out the hard way is that format strings (like status bars) can use the conditional. You apparently can't use tmux conditionals for formatting (e.g. set -g window-style).

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

No branches or pull requests

3 participants