Skip to content

Instantly share code, notes, and snippets.

@2KAbhishek
Last active August 6, 2019 02:24
Show Gist options
  • Save 2KAbhishek/d3bccfc38023b10b64b9297cfedc8a11 to your computer and use it in GitHub Desktop.
Save 2KAbhishek/d3bccfc38023b10b64b9297cfedc8a11 to your computer and use it in GitHub Desktop.
Chrome Remote Desktop Linux setup
#/etc/pam.d/chrome-remote-desktop
auth required pam_unix.so
account required pam_unix.so
password required pam_unix.so
session required pam_unix.so
#/opt/google/chrome-remote-desktop/chrome-remote-desktop
DEFAULT_SIZES = "1366x768,1920x1080"
DEFAULT_SIZE_NO_RANDR = "1366x768"
FIRST_X_DISPLAY_NUMBER = 0
# while os.path.exists(X_LOCK_FILE_TEMPLATE % display):
# display += 1
def launch_session(self, x_args):
self._init_child_env()
self._setup_pulseaudio()
self._setup_gnubby()
#self._launch_x_server(x_args)
#self._launch_x_session()
display = self.get_unused_display_number()
self.child_env["DISPLAY"] = ":%d" % display
--- chrome-remote-desktop.bak 2019-04-27 22:50:13.373570780 +0530
+++ chrome-remote-desktop 2019-04-27 22:54:34.259910461 +0530
@@ -75,11 +75,11 @@
# with large or multiple monitors. This is a comma-separated list of
# resolutions that will be made available if the X server supports RANDR. These
# defaults can be overridden in ~/.profile.
-DEFAULT_SIZES = "1600x1200,3840x2560"
+DEFAULT_SIZES = "1366x768,1920x1080"
# If RANDR is not available, use a smaller default size. Only a single
# resolution is supported in this case.
-DEFAULT_SIZE_NO_RANDR = "1600x1200"
+DEFAULT_SIZE_NO_RANDR = "1366x768"
SCRIPT_PATH = os.path.abspath(sys.argv[0])
SCRIPT_DIR = os.path.dirname(SCRIPT_PATH)
@@ -101,7 +101,7 @@
SYSTEM_SESSION_FILE_PATH = "/etc/chrome-remote-desktop-session"
X_LOCK_FILE_TEMPLATE = "/tmp/.X%d-lock"
-FIRST_X_DISPLAY_NUMBER = 20
+FIRST_X_DISPLAY_NUMBER = 0
# Amount of time to wait between relaunching processes.
SHORT_BACKOFF_TIME = 5
@@ -433,8 +433,8 @@
"""Return a candidate display number for which there is currently no
X Server lock file"""
display = FIRST_X_DISPLAY_NUMBER
- while os.path.exists(X_LOCK_FILE_TEMPLATE % display):
- display += 1
+ #while os.path.exists(X_LOCK_FILE_TEMPLATE % display):
+ # display += 1
return display
def _init_child_env(self):
@@ -720,8 +720,10 @@
self._init_child_env()
self._setup_pulseaudio()
self._setup_gnubby()
- self._launch_x_server(x_args)
- self._launch_x_session()
+ # self._launch_x_server(x_args)
+ # self._launch_x_session()
+ display = self.get_unused_display_number()
+ self.child_env["DISPLAY"] = ":%d" % display
def launch_host(self, host_config, extra_start_host_args):
# Start remoting host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment