title: Updating DISPLAY with ssh and byobu
body: <p>I have the following scenario:</p>
  
  <p>In my work computer (A) I open a byobu (tmux) session.</p>
  
  <p>Inside byobu, I open several terminals. Some of them are local to (A), but in others I ssh to a different computer (B).</p>
  
  <p>I go home, and from my my home computer (C) I ssh to (A), run "byobu" and find all my sessions in (A) or (B).</p>
  
  <p>This works perfectly, except for running X11 applications. I don't leave any X11 application running when I change computers, but just running "xclock" sometimes works and sometimes doesn't ("cannot connect to X server localhost:<em>n</em>.0").</p>
  
  <p>I understand this depends on the <code>DISPLAY</code> variable, and that it would be set up such that X11 would connect to the computer where I ran "byobu" last before creating the session inside byobu, and that could be (A) or (C). My problem is that often I don't know how to fix a session that's not working any more. Sometimes I can just open another session (another tab in byobu) and use the value of <code>$DISPLAY</code> in other sessions, but that only works as long as the new session is open, and not always. In other cases I've been able to detach byobu (F6), re-attach it (run "byobu") and open a new ssh connection to (B), and then that one works, but not the already existing sessions.</p>
  
  <p>I have read some documents like <a href="http://alexteichman.com/octo/blog/2014/01/01/x11-forwarding-and-terminal-multiplexers/" rel="noreferrer">SSH, X11 Forwarding, and Terminal Multiplexers</a> or <a href="https://www.reddit.com/r/commandline/comments/220qsr/how_to_get_tmux_x_display_to_come_back/" rel="noreferrer">How to get tmux X display to come back?</a>, but it is unclear to me how they apply (if they do) to my situation. For instance, the <code>.bashrc</code> code of the former, should it be in (A), (B), or (C)?</p>