Skip to content

Commit

Permalink
Merge pull request #9 from pieqq/wayland-display-env-fix
Browse files Browse the repository at this point in the history
remote_assistant: incrementally build list of extra environment variables
  • Loading branch information
yphus committed Oct 17, 2022
2 parents d6692e8 + e320325 commit 46700a0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions checkbox-ng/plainbox/impl/session/remote_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ def _prepare_display_without_psutil(self):
}

def prepare_extra_env(self):
extra_env = {}
# If possible also set the DISPLAY env var
# i.e when a user desktop session is running
for p in psutil.pids():
Expand All @@ -255,16 +256,15 @@ def prepare_extra_env(self):
p_user != 'gdm'
): # gdm uses :1024
uid = pwd.getpwnam(self._normal_user).pw_uid
return {
'DISPLAY': p_environ['DISPLAY'],
'WAYLAND_DISPLAY': p_environ['WAYLAND_DISPLAY'],
'XAUTHORITY': p_environ['XAUTHORITY'],
'XDG_SESSION_TYPE': p_environ['XDG_SESSION_TYPE'],
'XDG_RUNTIME_DIR': '/run/user/{}'.format(uid),
'DBUS_SESSION_BUS_ADDRESS':
'unix:path=/run/user/{}/bus'.format(uid)
}
return {}
extra_env['DISPLAY'] = p_environ['DISPLAY']
extra_env['XAUTHORITY'] = p_environ['XAUTHORITY']
extra_env['XDG_SESSION_TYPE'] = p_environ['XDG_SESSION_TYPE']
extra_env['XDG_RUNTIME_DIR'] = '/run/user/{}'.format(uid)
extra_env['DBUS_SESSION_BUS_ADDRESS'] = 'unix:path=/run/user/{}/bus'.format(uid)
if "WAYLAND_DISPLAY" in p_environ:
extra_env['WAYLAND_DISPLAY'] = p_environ['WAYLAND_DISPLAY']

return extra_env

@allowed_when(Idle)
def start_session(self, configuration):
Expand Down

0 comments on commit 46700a0

Please sign in to comment.