Open JBKahn opened 8 years ago
I need to know what behavior you're looking to get to be sure.
I believe load_workspace
and command_load
I can add a -C
and -CC
option to pass those arguments after the building is complete and you attach the session. Is that what you're looking for?
This is the integration I'd like to make use of, but it seems somewhat complicated. I don't know if it matters that it launches a new terminal to do this: https://gitlab.com/gnachman/iterm2/wikis/TmuxIntegration
not necessary, I can just create it with -d
then attach and all works.
It would be nice to be able to pass flags to tmux on startup. I would like to use it for iTerm integration like @JBKahn. I think it is reasonable for tmuxp to allow it as one of its purposes is to make it easy to start and use sessions. tmuxp load -d file.yaml && tmux attatch -t session
is a bit too long when it could be done like tmuxp -CC load file.yaml
for example.
Has anyone got this working?
tmuxp load -d …
outputs tmux: unknown option -- d
The commands aren't pass-thru at of now, but I think it makes sense for us to use tmux(1)
's args wherever possible
We recently introduced window appending, which overlaps with tmux's -a
. I assume since attach is default we're in the clear in that regard
I added a pinned label so the cleanup bot won't close this
Thanks @tony.
I'm fairly new to tmux so still stumbling around in the dark quite a lot.
Thought iTermocil might be better for iTerm but ironically it blows up when using its tmux integration.
Found a comment proposing tmuxinator and a sample config. Can tmuxp be configured similarly, my impression is pass-thru commands would be required or did I misunderstand?
I never heard of itermocil - and it's cool you bring it up
I'd need to take a peek at it, but unfortunately I don't have a mac to try it with
And... they use python, kind of interesting why they don't use tmuxp / libtmux.
So if we have a mac user that can test, maybe it'd be possible for an integration to happen
I think in the mean time if you want to use iTerm, you mean want to use teamocil / tmuxinator / etc in the meantime, unless someone else with macOS can step into help us (Any takers?)
I found this thread trying to look for how to launch tmuxp passing argument to it; the way that you could in tmuxinator. But it seems like that is rather ruby-specific.
In the mean time I guess I can just use environment variables.
@leeand00 Do either of these help?
https://tmuxp.git-pull.com/configuration/examples.html#environment-variable-replacing, https://tmuxp.git-pull.com/configuration/examples.html#environment-variables
Assume test_env_vars.yaml
:
session_name: ${SESSION_NAME}
windows:
- window_name: ${WINDOW_NAME}
panes:
-
$ env SESSION_NAME='my session' WINDOW_NAME='a window' tmuxp load ./test_env_vars.yaml
That works great except I can't pass any of the env cars to my shell cmds.
@leeand00 That may be the case - not sure. It could be something we could add
Can you give an example config file so I can try?
session_name: ${SESS_TITLE}
windows:
- window_name: ${BOX}
panes:
- shell_command:
- echo ${BOX}
echos ${BOX}
as opposed to what I passed into it.
Also it's not an available environment variable either within the shell that opens.
I was able to do it here, slightly different syntax:
session_name: ${SESSION_NAME}
windows:
- window_name: ${WINDOW_NAME}
panes:
- echo ${WINDOW_NAME}
env SESSION_NAME='my session' WINDOW_NAME='a window' tmuxp load ./test_env_vars.yaml
That work?
Also I was able to do it with this too:
session_name: ${SESSION_NAME}
windows:
- window_name: ${WINDOW_NAME}
panes:
- shell_command:
- echo ${WINDOW_NAME}
echos ${BOX} as opposed to what I passed into it.
What command are you running?
@leeand00 Forgot to tag you ^
@tony
Also I was able to do it with this too:
session_name: ${SESSION_NAME} windows: - window_name: ${WINDOW_NAME} panes: - shell_command: - echo ${WINDOW_NAME}
echos ${BOX} as opposed to what I passed into it.
What command are you running?
env SESSION_NAME='my session' BOX='CMPNAMEPOS1' tmuxp load ./me-yml-file.yml -d
@leeand00 This works for me. I think you can do it.
Maybe there's a typo somewhere? Try on a new shell / terminal without other stuff running? (e.g. kill tmux and have a new terminal window)
tmuxp -V
, tmux -V
, python -V
? What shell are you using? tmuxp debug-info
?
@tony
tmuxp 1.5.4 tmux 3.0a Python 3.8.2 (had to run python3, not python)
tmuxp debug-info Usage: tmuxp [OPTIONS] COMMAND [ARGS]... Try "tmuxp --help" for help.
Error: No such command "debug-info".
@leeand00 Where did you install tmuxp from?
Current version is 1.13.1, here's the changelog since 1.5.4: https://github.com/tmux-python/tmuxp/blob/v1.13.1/CHANGES
Any chance you can update?
@tony from apt-get WSL2, Ubuntu 20.04 LTS
Is there a dpkg? Or pip?
@tony from apt-get WSL2, Ubuntu 20.04 LTS
Is there a dpkg? Or pip?
Think you could try to use pipx to get a more recent tmuxp
version?
What shell are you using? Bash? zsh? fish? dash? echo $SHELL
may tell.
@tony I'm using bash. I never heard of pipx.
Why would I have to use it to install the latest version?
@tony Okay I installed pipx 0.12.3.1.
The command for installation I found on the main page doesn't appear to work (for me at least)
# pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force
usage: pipx [-h] [--version] {install,inject,upgrade,upgrade-all,uninstall,uninstall-all,reinstall-all,list,run,ensurepath} ...
pipx: error: unrecognized arguments: --suffix=@next
@leeand00 Hmm.
It seems pipx
's argument signature may change
pip install --user -U tmuxp
~/.local/bin/tmuxp
Does that work?
You may need to add ~/.local/bin
to PATH
:
if [ -d "$HOME/.local/bin" ]
then
export PATH=$PATH:$HOME/.local/bin
fi
In lieu of all the above: I think it depends what fits your style. I would encourage searching online for whichever angle you would like to get caught up with pip install --user
and pipx
.
My only hesitation is, if I sent more commands on their own, I'm afraid it could bork your python installation.
It may be a prerequisite to familiarize pip
and pipx
and shell configuration (e.g. ~/.bashrc
, ~/.zshrc
, depending on your shell) - since those are needed in order to reason about the above.
Tmuxinator can pass args to tmux
like so...
tmux_options: -f ~/.tmux.mac.conf
.
I thought Tmuxp could do this just as well as Tmuxinator. Am I mistaken about the method for this?
Is there a way (can't find any) to pass an arbitrary arg to tmux? I want to pass
-CC
but I don't see an easy way to do that and I'm not familiar with the packages you're using so I'm not sure where in the code this would have to be.