Last active
July 5, 2020 08:16
-
-
Save unlimish/d9434ff4c86669aa81c0435577484a4f to your computer and use it in GitHub Desktop.
WSL2で起動してGUIを立ち上げるときにすること
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
#!/bin/bash | |
# Prepare | |
sudo sh -c 'dbus-uuidgen > /var/lib/dbus/machine-id' | |
sudo service dbus restart | |
export DISPLAY="$(cat /etc/resolv.conf|grep nameserver|awk '{print $2}'):0" | |
# Launch VcXsrv | |
/mnt/c/Program\ Files/VcXsrv/vcxsrv.exe :0 -ac -keyhook & | |
# Start GNOME Session | |
XDG_CURRENT_DESKTOP=ubuntu:GNOME XDG_SESSION_TYPE=x11 gnome-session | |
# After End GNOME, Kill VcXsrv | |
/mnt/c/Windows/System32/taskkill.exe /IM vcxsrv.exe /T /F |
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
# UUID を更新する | |
sudo sh -c 'dbus-uuidgen > /var/lib/dbus/machine-id' | |
# DBus を再起動する | |
sudo service dbus restart | |
# DISPLAY 環境変数は以下で指定する | |
export DISPLAY="$(cat /etc/resolv.conf|grep nameserver|awk '{print $2}'):0" | |
# ココまで設定したら、VcXsrv を起動する。 | |
# DISPLAY : -1、「Dissable access control」にチェックを入れて、黒いウィンドウを出しておく | |
# VcXsrv を起動してある状態で、以下を実行する | |
XDG_CURRENT_DESKTOP=ubuntu:GNOME XDG_SESSION_TYPE=x11 gnome-session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment