curl -o- https://gist.githubusercontent.com/endrik-exe/69131bd787a3b4cdfd862f971aaa82bc/raw/855ad141ae056c528bac0fd725351c7220c86c53/chrome-remote-desktop.patch | sudo patch /opt/google/chrome-remote-desktop/chrome-remote-desktop
sudo /opt/google/chrome-remote-desktop --stop
sudo /opt/google/chrome-remote-desktop --start
Last active
January 30, 2024 20:27
-
-
Save endrik-exe/69131bd787a3b4cdfd862f971aaa82bc to your computer and use it in GitHub Desktop.
Patch chrome-remote-desktop to use DISPLAY 0 - 2023 Version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- chrome-remote-desktop.orig 2023-08-05 01:02:02.000000000 +1000 | |
+++ chrome-remote-desktop 2023-08-05 01:27:40.000000000 +1000 | |
@@ -464,6 +464,17 @@ | |
self.crash_uploader_proc = None | |
self.crash_uploader_inhibitor = None | |
+ @staticmethod | |
+ def get_used_display_number(): | |
+ """Return a candidate display number for which there is currently a | |
+ X Server lock file""" | |
+ display = 0 | |
+ while not os.path.exists(X_LOCK_FILE_TEMPLATE % display): | |
+ display += 1 | |
+ if display > 100: | |
+ return 0 | |
+ return display | |
+ | |
def _init_child_env(self): | |
self.child_env = dict(os.environ) | |
@@ -518,10 +529,21 @@ | |
self._init_child_env() | |
self.setup_audio() | |
self._setup_gnubby() | |
- self._launch_server(server_args) | |
- if not self._launch_pre_session(): | |
- # If there was no pre-session script, launch the session immediately. | |
+ | |
+ #START CUSTOM | |
+ display = self.get_used_display_number() | |
+ logging.info(display) | |
+ if display is not None: | |
+ self.child_env["DISPLAY"] = ":%d" % display | |
+ else: | |
+ self._launch_server(server_args) | |
self.launch_desktop_session() | |
+ #END CUSTOM | |
+ | |
+ #self._launch_server(server_args) | |
+ #if not self._launch_pre_session(): | |
+ # # If there was no pre-session script, launch the session immediately. | |
+ # self.launch_desktop_session() | |
self.server_inhibitor.record_started(MINIMUM_PROCESS_LIFETIME, | |
backoff_time) | |
self.session_inhibitor.record_started(MINIMUM_PROCESS_LIFETIME, | |
@@ -1122,6 +1144,18 @@ | |
while os.path.exists(X_LOCK_FILE_TEMPLATE % display): | |
display += 1 | |
return display | |
+ | |
+ @staticmethod | |
+ def get_used_display_number(): | |
+ """Return a candidate display number for which there is currently a | |
+ X Server lock file""" | |
+ display = 0 | |
+ while not os.path.exists(X_LOCK_FILE_TEMPLATE % display): | |
+ display += 1 | |
+ if display > 100: | |
+ return 0 | |
+ return display | |
+ | |
def _init_child_env(self): | |
super(XDesktop, self)._init_child_env() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment