3 ms·
> ...the reliance upon environment variables being set by parent processes. That's always felt weird to me. I don't really agree. When I start a program in a
by kelnos 4y ago
> ...the reliance upon environment variables being set by parent processes. That's always felt weird to me.
I don't really agree. When I start a program in a shell, I expect it to inherit the environment of that shell. That's just how things have always worked, modulo some special cases (sudo, running a new instance of the shell in login mode, whatever).
I personally don't think that's weird, but even if I did, what I care most about software behavior is predictability. Software should do what is expected and common, and if it does not, it should have a very good reason, and should find a way to make that obvious to the user every time it does it.
This is just bad UX on tmux's part.
> When you create a new tmux window, you should know if there's already a server spawned.
What? Why? I use screen on and off, not super often. When I start a screen instance, I don't always know or care if I have another instance running somewhere. And yes, because screen follows what I'd consider a more predictable model here, I end up with the environment variables I expect.
I think whenever we attack a UX problem by saying "the user should know X", we've already lost. You can't assume that you know how the user is going to use your software, or what their state of mind will be when starting it. That's just silly.
- cauthon 4y ago> When I start a program in a shell, I expect it to inherit the environment of that shell. That's exactly how tmux works. You start a server, it inherits the environment of the current shell. You create a new session in that server, it inherits the environment of the server. I don't understand how forcing tmux to re-load the current local environment for each new shell is saner behavior. One natural consequence would be that new panes in existing sessions are also created with the new env vars, which is obviously undesirable.
- mananaysiempre 4y ago>> When I start a program in a shell, I expect it to inherit the environment of that shell. > That's exactly how tmux works. You start a server, it inherits the environment of the current shell. You create a new session in that server, it inherits the environment of the server. Whether that makes sense depends on if your mental model has starting a server and connecting to a server to create a new shell as distinct actions, as opposed to a singular action of connecting to a conceptually always-present persistent environment and starting a shell there. Admittedly tmux’s interface is mostly organized along the former lines, but given I prefer `tmux new -A`, my own model seems to follow the latter.
- ghshephard 4y agoI don't know about other people - but I spend greater than 99.9% of my time inside a tmux session. It is my windowing environment. I was reading the original post and just kept furrowing my brows wondering "Under what possible scenario could any of this possibly be a problem?" It's kind of interesting reading through the threads here and seeing how people don't spend their time inside tmux all the time but instead "start an instance on demand" - which I've never done but I guess works for some people's workflow? I'm genuinely crippled trying to use a terminal without tmux after having used it for so long - don't have the faintest clue how to copy/paste/search/organize windows without it.
- echelon 4y agoI want to echo this sentiment as well. I never use bare terminal sessions. Not locally, and especially not remotely. I think the tmux sentiment in question is held by people new to the tool or that don't use it as a normal part of their workflow or day-to-day.
- bombolo 4y agoSomething like yakuake does tabbing, splitting, and is scriptable via dbus commands. There is no strong need to learn tmux key bindings to use locally.
- ghshephard 4y agoI was a casual tmux user until I got stuck in a portable trailer in Dubai working for DEWA on their grid, and they had us using a janky remote terminal Remote Desktop setup that didn't have any form of mouse pass through to the linux terminals we were doing work on. So - copy/paste were not possible which made work a pain. I gave them a DVD (!) containing the various ncurses/libevent/tmux code - and voila - I finally had a working environment. I spent 2+ months in that trailer for 6-8 hours/day - and tmux became so embedded in my finger DNA, I never looked back. I routinely bounce between WSL, Linux, and MacOS and never have to remember any of the keyboard shortcuts for the terminal programs, or whether it's been installed, and my fingers never leave the keyboard - and I can almost always outperform someone trying to select/copy with a mouse/touch pad. My .tmux.conf is the only thing I pull along with me. Also - just thinking about it - tmux is more than just a windowing environment - it also does project management. I have a workflow where every new project/issue/incident gets its own named window - and then I break up that window into a set of 4-8 panes based on systems (or sets of systems) I'll be working on. They all share the same bash_history. As I get hit with interrupts, I bounce between sessions and when I come back - my whole thought process/work history is back in that named window with panes. It's not unusual for me to have 45-50 open panes at a time - all perfectly organized by project/named window. With the resurrect plugin, and intelligent use of my bash config - I can (and do) pull everything (scroll back history, bash history, etc..) onto another system if needed (great if you need to recreate your work history and you no longer have access to the original terminal environment). As I close off/complete projects, I terminate the window - but the bash history is kept clean in ~/.tmux/bash_history/window_name in case I ever need to start working on it again (recreating the window with the same name pulls back in the bash history) Introspecting here a little, this honestly is probably more a function of me spending 40+ hours in a terminal environment than anything a rationale casual user would ever want to do.
- crabbone 4y agoYou are not using tmux for what it's designed to be used. It's not for running long-running processes, even though you might use it this way (you could also use eg. Photoshop to run long-running processes, after all, it has an embedded JavaScript interpreter with some extra functionality that might allow you to do that). tmux serves the same purpose as DE, except w/o the whole windowing system etc. It's to allow you to switch between multiple applications which require terminal for interaction. I spend close to 100% of my time at work inside tmux, and I never needed to answer a question "where do the process variables come from?" -- it's irrelevant in the same way how you don't ask where does Gnome get its environment variables from. You simply don't rely on environmental variables when running tmux / don't care about them.
- ilyt 4y agoI disagree. tmux default behaviour suits my workflow much better. It's complex enough problem that there is no perfect default so complaining this or that doesn't fit you when you can just change it so it does is pointless.