Hacker News new | ask | show | jobs
by martin_ky 2913 days ago
> It’s 2018 and I still see people walking around with Windows laptop lids open because they presumably have no confidence in Windows’ ability to sensibly preserve state after closing the lid.

At my workplace it's about 60:40 Windows to Mac user ratio. Regardless of the machine, nobody closes the lid when moving in the office between desks and meeting rooms. So, I'd say it's probably not that.

2 comments

Probably don't want to lose their ssh connections.
Back in 2004 I had an ssh terminal open from my Mac (12" PowerBook) to my home Linux server. I closed the lid and took the laptop away with for a trip. For some reason I didn't use the laptop during the week. When I got back home 6 days later I opened the laptop and saw the ssh session. I tried it out and it still worked! I was amazed!

The ssh client had no keep alive. And the sshd had no keep alive. There was not firewall and a long DHCP lease. So it all just worked.

But because of firewalls aggressivly closing xonnections, these days we tend to need keep alives and so I don't this this would work today.

mosh doesn't support port forwarding. There is a $400+ bounty for the feature.
Great, they seem to have just solved `-R` (reverse) tunnels: https://github.com/MisterTea/EternalTerminal/pull/80
Link? I'll throw in $100 right now
I'm sure many people would appreciate that gesture

https://github.com/mobile-shell/mosh/issues/337

EternalTerminal does though, and it integrates better with tmux.
~$ 400 ? Not tempting at all.
If you have tmux or your remote machine, you can add this alias to your mac's bashrc

    alias my-server='ssh server-hostname -t "tmux new-session -s user || tmux attach-session -t user"'
It will connect to a tmux session on the remote machine if it exists or start a new one if it doesn't. If you Cmd+w your terminal window or disconnect, the tmux session stays running on the remote machine.

You could also tell it to try reconnecting every second and bind it to something easy to type like 'kj' (too bad df is already taken)

    alias kj='while true; do my-server; sleep 1; done'
There’s tmux, abduco, & screen for that on Linux.
mosh is an infinitely better user experience for certain use cases, particularly poor/intermittent connections. session establishment is very slow and requires a lot of round-trips, and if you have high latency and packet loss, it becomes painful. if you establish a session once with mosh, you don't have to establish connections after that, you just blit UDP packets.
mosh on its own doesn't handle scrollback buffer. So you're back to tacking on other things like tmux on top.
Those three are only neighbours to maintaining ssh connections problem.
You can run those on the remote side of the mosh session
Modern Standby/Connected Standby in Windows 10 won't lose any network connections while in standby.
Regardless of the reasons for people not closing their laptop lids, these issues exist and they shouldn't.