tmux-resurrect icon indicating copy to clipboard operation
tmux-resurrect copied to clipboard

$DISPLAY is wrong in resurrected session

Open zori opened this issue 4 years ago • 5 comments

Hi, I've tried both with and without DISPLAY in the update-environment option:

set-option -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"

Either way after rebooting my machine and attaching to a (resurrected) session, the DISPLAY variable is wrong (:0 while it should be :1).

I also use continuum, if that changes anything, with the following settings:

set -g @plugin 'tmux-plugins/tmux-continuum' # Continuous saving of tmux environment. https://github.com/tmux-plugins/tmux-continuum set -g @continuum-save-interval '20' # Save the current session every 20 minutes set -g @continuum-boot 'on' set -g @continuum-restore 'on'

Any known work-arounds?

zori avatar Mar 30 '20 02:03 zori

Is that env variable updated while your session is running? Because as far as I know this plugin does not persist environment variables (though in my opinion it should).

You can try this plugin but you would have to probably bootstrap the variables back into the environment: https://github.com/tmux-plugins/tmux-resurrect/issues/312.

chrischen avatar Apr 29 '20 06:04 chrischen

I am facing the same issue with DISPLAY variable. The variable is updated using the following statement in .tmux.conf file.

set-option -g update-environment 'DISPLAY'

anindyaspaul avatar May 24 '20 09:05 anindyaspaul

I also experienced a similar issue with the DISPLAY environment variable although the variable is not being updated as per my knowledge. The DISPLAY variable is properly set when SSHed into the server. The environment variable is properly set when creating a new tmux session/window/pane. When the session is resurrected, the DISPLAY environment variable is empty in the resurrected windows/panes. Although creating new windows/panes in the resurrected session imports the correct value of the environment variable.

atifraza avatar Jul 14 '20 18:07 atifraza

Update:

Apparently, my problem was possibly related to an outdated version of tmux. I had tmux 1.9 running on a Debian Jessie server. Updating tmux to 2.3 resolved this issue for me.

atifraza avatar Jul 15 '20 15:07 atifraza

Issue is still happening. This is causing the resurrected vim's clipboard to not work and also making GUI applications fail

I tried the following to no avail.

run-shell 'DISPLAY=$(cat /proc/$(pgrep -u $USER "^gnome-shell$")/environ | tr "\0" "\n" | grep ^DISPLAY= | cut -d "=" -f 2)'

I believe the problem actually lies in tmux-continuum and not tmux-resurrect. tmux-continuum starts the tmux server before Gnome (or any user GUI). There is no way to know what the correct DISPLAY variable should be. (This is also because tmux is made to work in non-GUI environments as well)

In the end, I just had to remove the line

set -g @continuum-boot 'on'

and the DISPLAY variable was set correctly

rcywongaa avatar Apr 03 '21 02:04 rcywongaa