Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@YusukeIwaki
Created March 26, 2017 23:43
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save YusukeIwaki/b7a6d81d6493ae52e1579506bef5700f to your computer and use it in GitHub Desktop.
Save YusukeIwaki/b7a6d81d6493ae52e1579506bef5700f to your computer and use it in GitHub Desktop.
chrome-remote-desktopをdisplay 0表示するように改造するための修正ポイント
diff --git a/chrome-remote-desktop.orig b/chrome-remote-desktop
index a40063b..de1b3b0 100755
--- a/chrome-remote-desktop.orig
+++ b/chrome-remote-desktop
@@ -66,11 +66,11 @@ XORG_DUMMY_VIDEO_RAM = 1048576 # KiB
# 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 = "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 = "1920x1080"
SCRIPT_PATH = os.path.abspath(sys.argv[0])
SCRIPT_DIR = os.path.dirname(SCRIPT_PATH)
@@ -90,7 +90,7 @@ SESSION_FILE_PATH = os.path.join(HOME_DIR, ".chrome-remote-desktop-session")
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
@@ -355,8 +355,6 @@ class Desktop:
"""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
return display
def _init_child_env(self):
@@ -484,18 +482,6 @@ class Desktop:
if not xvfb:
xvfb = "Xvfb"
- logging.info("Starting %s on display :%d" % (xvfb, display))
- screen_option = "%dx%dx24" % (max_width, max_height)
- self.x_proc = subprocess.Popen(
- [xvfb, ":%d" % display,
- "-auth", x_auth_file,
- "-nolisten", "tcp",
- "-noreset",
- "-screen", "0", screen_option
- ] + extra_x_args, env=self.child_env)
- if not self.x_proc.pid:
- raise Exception("Could not start Xvfb.")
-
self._wait_for_x()
with open(os.devnull, "r+") as devnull:
@@ -653,8 +639,8 @@ class Desktop:
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
def launch_host(self, host_config):
# Start remoting host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment