LoginSignup
6
1

More than 3 years have passed since last update.

GDPMicroPCでChrome Remote Desktopをつなぐ

Last updated at Posted at 2019-12-11

GDPMicroPCは電車内で利用できて好き。
でも開発しにくいから自宅ではChrome Remote Desktopでアクセスできるようにしたいよねって話。

詰まる原因は2点

  • 公式で配布されているubuntu mateはLXDE系
    • →仮想のディスプレイポートが貼れなくて、表示されている画面を共有するようにスクリプトの修正が必要
  • 本来縦長のディスプレイを利用しているせいで縦横が逆で表示される
    • デフォルトでxrandr -o rightを掛けなければいけない

その1

cat <<EOF >$HOME/.chrome-remote-desktop-session
DESKTOP_SESSION=mate XDG_CURRENT_DESKTOP=MATE XDG_RUNTIME_DIR=/run/user/$(id -u) exec /usr/sbin/lightdm-session mate-session
EOF

その2

  • xrandr -o rightの指定はどこかでする必要がある
    • 仮想のxorgの初期設定 ← コメントアウト済み
    • 一番最初のxrandr ← コメントアウト済み
    • リサイズ時に走るxrandr ← これを修正する
    • Chrome Remote Desktopで接続後にコンソールを叩く
      • 一応 xrandr --output DSI1 --mode 720x1280 -o right って叩くと直る
/opt/google/chrome-remote-desktop/chrome-remote-desktop のリサイズ監視部分はここ
def watch_for_resolution_changes(initial_size):
 for _ in range(30):
    time.sleep(1)
    xrandr_output = subprocess.Popen(["xrandr"],
                                     stdout=subprocess.PIPE).communicate()[0]
    matches = re.search(r'current (\d+) x (\d+), maximum (\d+) x (\d+)',
                        xrandr_output)


    if current_size != initial_size:
      if current_size == maximum_size:
        label = "%dx%d" % initial_size
        args = ["xrandr", "-s", label]
        subprocess.call(args)
        args = ["xrandr", "--dpi", "96"]
        subprocess.call(args)
        args = ["xrandr", "-o", "right"] # 追記
        subprocess.call(args) # 追記

余談

  • GDPMicroPCのデフォルト解像度は以下の種類である。
    • 720x1280,640x480,720x405,360x640,640x360
    • 増やしたいときは多分 xrandr --addmode DSI1 ... とか使う
    • 本来、Chrome Remote Desktopにも自動で解像度を増やしてくれる環境変数オプションはある。
      • CHROME_REMOTE_DESKTOP_DEFAULT_DESKTOP_SIZES
      • CHROME_REMOTE_DESKTOP_USE_XORG
        • でも、この辺の変数はスクリプトの修正をした時点でコメントアウトされた関数なので、今回は特に意味がなかったりする
  • 若干、リサイズ時の縦横比が気になるけど直せなかったので放置した。
  • /opt/google/chrome-remote-desktop/chrome-remote-desktop は更新されるときにたまに修正内容が吹き飛ぶのでバックアップはしよう
  • sytemctlでChrome Remote Desktopを明示的に扱える
    • sudo systemctl start chrome-remote-desktop.service
    • 実体は /etc/init.d/chrome-remote-desktop にあって /opt/google/chrome-remote-desktop/chrome-remote-desktop を叩くsh
      • /opt/google/chrome-remote-desktop/chrome-remote-desktop --start 的なことをしている
  • GDPMicroPCのxorgの初期設定は/usr/share/X11/xorg.conf.d/40-gpd-micropc-monitor.confに書かれてる
    • xrandrで叩いたときのoutputラベル名として、ここで設定されたDSI1とか、DSI-1とかの名前があることがわかって嬉しいね!!
    • ので、gnome系とかで仮想のxorgの初期設定が効く人は、/opt/google/chrome-remote-desktop/chrome-remote-desktopのSection "Monitor" に Option "Rotate" "right"って書くだけで行ける可能性はあるかも
# GPD MicroPC (modesetting)
Section "Monitor"
  Identifier "DSI-1"
  Option     "Rotate"  "right"
EndSection


# GPD MicroPC (xorg-video-intel)
Section "Monitor"
  Identifier "DSI1"
  Option     "Rotate"  "right"
EndSection

参考;

http://kapper1224.sblo.jp/article/186180635.html
https://wiki.archlinux.jp/index.php/Xrandr
https://webnetforce.net/ubuntu-chrome-remote-trouble/
https://qiita.com/hiro_mayo/items/db8ddcea600e8bfbdd5f
https://qiita.com/k_ikasumipowder/items/c173fb92cf12c75b2375

6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1