aaronjanse / 3mux

Terminal multiplexer inspired by i3
MIT License
1.82k stars 45 forks source link

Environment variable for 3mux #34

Closed flipcoder closed 4 years ago

flipcoder commented 4 years ago

It might be useful to have an environment variable for 3mux, similar to $TMUX so scripts can know if they're running inside 3mux:

I've added one here:

https://github.com/flipcoder/3mux/blob/master/shell.go#L25

Ideally you'd want it to be some path or number of the current pane/window, but for now I just made it 1.

aaronjanse commented 4 years ago

This sounds useful, thanks! Would you mind listing a few use-cases for $THREEMUX that I could put in 3mux's documentation?

flipcoder commented 4 years ago

Sure. The first thing I thought of is people may want to change their shell prompt to show they're inside 3mux. This would be more useful in the future if there's a way to hide the bottom bar. This may help a bit with compatibility issues as well: a .vimrc may need to check this to change a setting or a plugin may want to load some 3mux integration. It's mostly for future/integration things.

Probably the most common use would be to autostart 3mux in their bashrc/zshrc, in which case this should prevent recursion:

if [ -z "$THREEMUX" ]; then
    3mux          
fi   

This is commonly done with tmux.

aaronjanse commented 4 years ago

Awesome! Please open a Pull Request so I can merge your addition to shell.go

aaronjanse commented 4 years ago

I'll keep this open until I document this

aaronjanse commented 4 years ago

Fixed in v0.3.0.