Skip to content

Instantly share code, notes, and snippets.

@pcarrier
Last active December 26, 2021 17:23
Show Gist options
  • Save pcarrier/d235267c2ae61fd57220 to your computer and use it in GitHub Desktop.
Save pcarrier/d235267c2ae61fd57220 to your computer and use it in GitHub Desktop.
Chrome Remote Desktop
The remote desktop session has to be headless :(
- Install the deb (can convert with alien & co)
- Patch with modern_distro.diff (cherry-pick what your system needs)
- To support automatic desktop resizing:
- Works with any window manager
- Build Xvfb with xvfb-randr.diff
- Expose as /usr/bin/Xvfb-randr
- If replacing system-wide binary by repackaging, simply
# ln -sf Xvfb /usr/bin/Xvfb-randr
- Make sure the group chrome-remote-desktop exists
(your doesn't need to be a member)
- $ mkdir ~/.config/chrome-remote-desktop
- Install chrome-remote-desktop.service
in /usr/lib/systemd/user/
or in ~/.config/systemd/user/
- Enable from the Chrome extension.
- The service is automatically started.
See the service file to stop it and restart it in systemd if preferred.
To start the server in the future, use:
$ systemctl --user start chrome-remote-desktop.service
To troubleshoot:
- Start the Chrome session from a terminal to see its output (really helpful)
- Use systemctl --user status chrome-remote-desktop
[Unit]
Description="Chrome Remote Desktop host daemon"
[Service]
ExecStart=/opt/google/chrome-remote-desktop/chrome-remote-desktop --start --foreground
ExecStop=/opt/google/chrome-remote-desktop/chrome-remote-desktop --stop
ExecReload=/opt/google/chrome-remote-desktop/chrome-remote-desktop --reload
Restart=always
TimeoutStopSec=10
[Install]
WantedBy=multi-user.target
--- a/opt/google/chrome-remote-desktop/chrome-remote-desktop 2014-04-04 00:59:46.000000000 +0000
+++ b/opt/google/chrome-remote-desktop/chrome-remote-desktop 2014-07-10 06:25:43.718329477 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -493,7 +493,7 @@
# during iteration over the list.
try:
# Skip other users' processes.
- if process.uids.real != uid:
+ if process.uids().real != uid:
continue
# Skip the process for this instance.
@@ -501,12 +501,12 @@
continue
# |cmdline| will be [python-interpreter, script-file, other arguments...]
- cmdline = process.cmdline
+ cmdline = process.cmdline()
if len(cmdline) < 2:
continue
if cmdline[0] == sys.executable and cmdline[1] == sys.argv[0]:
return process.pid
- except psutil.error.Error:
+ except psutil.NoSuchProcess:
continue
return 0
@@ -994,7 +994,7 @@
logging.info("Group '%s' not found." % CHROME_REMOTING_GROUP_NAME)
if os.getenv("DISPLAY"):
- sudo_command = "gksudo --description \"Chrome Remote Desktop\""
+ sudo_command = "pkexec"
else:
sudo_command = "sudo"
command = ("sudo -k && exec %(sudo)s -- sh -c "
From: Lambros Lambrou <[email protected]>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=26391
Signed-off-by: Lambros Lambrou <[email protected]>
Signed-off-by: Mike Frysinger <[email protected]>
Signed-off-by: Michal Srb <[email protected]>
---
Second version, modified according to Keith suggestion.
Tested by adding second mode and switching - worked correctly.
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 97eccfd..bfca068 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -66,6 +66,7 @@ from The Open Group.
#include "dix.h"
#include "miline.h"
#include "glx_extinit.h"
+#include "randrstr.h"
#define VFB_DEFAULT_WIDTH 1280
#define VFB_DEFAULT_HEIGHT 1024
@@ -785,6 +786,125 @@ vfbCloseScreen(ScreenPtr pScreen)
}
static Bool
+vfbRROutputValidateMode(ScreenPtr pScreen,
+ RROutputPtr output,
+ RRModePtr mode)
+{
+ rrScrPriv(pScreen);
+
+ if (pScrPriv->minWidth <= mode->mode.width &&
+ pScrPriv->maxWidth >= mode->mode.width &&
+ pScrPriv->minHeight <= mode->mode.height &&
+ pScrPriv->maxHeight >= mode->mode.height)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+static Bool
+vfbRRScreenSetSize(ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth,
+ CARD32 mmHeight)
+{
+ // Prevent screen updates while we change things around
+ SetRootClip(pScreen, FALSE);
+
+ pScreen->width = width;
+ pScreen->height = height;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
+
+ // Restore the ability to update screen, now with new dimensions
+ SetRootClip(pScreen, TRUE);
+
+ RRScreenSizeNotify (pScreen);
+ RRTellChanged(pScreen);
+
+ return TRUE;
+}
+
+static Bool
+vfbRRCrtcSet(ScreenPtr pScreen,
+ RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y,
+ Rotation rotation,
+ int numOutput,
+ RROutputPtr *outputs)
+{
+ return RRCrtcNotify(crtc, mode, x, y, rotation, NULL, numOutput, outputs);
+}
+
+static Bool
+vfbRRGetInfo(ScreenPtr pScreen, Rotation *rotations)
+{
+ return TRUE;
+}
+
+static Bool
+vfbRandRInit(ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+#if RANDR_12_INTERFACE
+ RRModePtr mode;
+ RRCrtcPtr crtc;
+ RROutputPtr output;
+ xRRModeInfo modeInfo;
+ char name[64];
+#endif
+
+ if (!RRScreenInit (pScreen))
+ return FALSE;
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = vfbRRGetInfo;
+#if RANDR_12_INTERFACE
+ pScrPriv->rrCrtcSet = vfbRRCrtcSet;
+ pScrPriv->rrScreenSetSize = vfbRRScreenSetSize;
+ pScrPriv->rrOutputSetProperty = NULL;
+#if RANDR_13_INTERFACE
+ pScrPriv->rrOutputGetProperty = NULL;
+#endif
+ pScrPriv->rrOutputValidateMode = vfbRROutputValidateMode;
+ pScrPriv->rrModeDestroy = NULL;
+
+ RRScreenSetSizeRange (pScreen,
+ 1, 1,
+ pScreen->width, pScreen->height);
+
+ sprintf (name, "%dx%d", pScreen->width, pScreen->height);
+ memset (&modeInfo, '\0', sizeof (modeInfo));
+ modeInfo.width = pScreen->width;
+ modeInfo.height = pScreen->height;
+ modeInfo.nameLength = strlen (name);
+
+ mode = RRModeGet (&modeInfo, name);
+ if (!mode)
+ return FALSE;
+
+ crtc = RRCrtcCreate (pScreen, NULL);
+ if (!crtc)
+ return FALSE;
+
+ output = RROutputCreate (pScreen, "screen", 6, NULL);
+ if (!output)
+ return FALSE;
+ if (!RROutputSetClones (output, NULL, 0))
+ return FALSE;
+ if (!RROutputSetModes (output, &mode, 1, 0))
+ return FALSE;
+ if (!RROutputSetCrtcs (output, &crtc, 1))
+ return FALSE;
+ if (!RROutputSetConnection (output, RR_Connected))
+ return FALSE;
+ RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, NULL, 1, &output);
+#endif
+ return TRUE;
+}
+
+static Bool
vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
{
vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
@@ -860,6 +980,9 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
if (!ret)
return FALSE;
+ if (!vfbRandRInit(pScreen))
+ return FALSE;
+
pScreen->InstallColormap = vfbInstallColormap;
pScreen->UninstallColormap = vfbUninstallColormap;
pScreen->ListInstalledColormaps = vfbListInstalledColormaps;
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment