Windows 10上のWSL2でFirefox開いてYouTube見られるくらいまで持ってく。
早くも記憶が薄れているので……
- Windowsを起動するごとに言語設定に
US
キーボードが勝手に入る- X410が英語ロケールでビルドされてるとか何かそんなん
- XプロトコルとPulseAudioの着信全部受けるのでIPが届くと軽くヤバい
- X410: localhostからの接続に限定する(オン・オフ)しか選べない
- PulseAudio: 172.24.0.0/12とかに絞れると思う
- https://x410.dev/cookbook/wsl/enabling-sound-in-wsl-ubuntu-let-it-sing/
- https://discourse.ubuntu.com/t/getting-sound-to-work-on-wsl2/11869
- https://gist.github.com/ThYpHo0n/349f1f6473e207b866f65aca4728da3e
- https://kazblog.hateblo.jp/entry/2018/05/28/221242
- https://superuser.com/questions/198525/how-can-i-execute-a-windows-command-line-in-background
- X410: Microsoft Storeで買う。常態的に二重価格販売されている。フリーのVcXsrvでも変わらない気もする……
- PulseAudio: https://www.freedesktop.org/wiki/Software/PulseAudio/Ports/Windows/Support/
-
Storeから入れる
-
スタートアップにショートカットを作成
- Win+Rを押して
shell:AppsFolder
[OK] - Win+Rを押して
shell:startup
[OK] - Applications から Startup へ右ドラッグ
- Win+Rを押して
-
X410を設定
- トレイアイコン → ✔ Allow Public Access
- (任意) トレイアイコン → ✔ Windowed Apps
- ファイアウォール警告が出たら許可する
-
WSL側作業
- ~/.bashrc に以下を追加
# Windows XSrv config export $(dbus-launch) export LIBGL_ALWAYS_INDIRECT=1 export WSL_VERSION=$(wsl.exe -l -v | grep -a '[*]' | sed 's/[^0-9]*//g') export WSL_HOST=$(tail -1 /etc/resolv.conf | cut -d' ' -f2) export DISPLAY=$WSL_HOST:0 # fcitx export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=@im=fcitx # pulseaudio export PULSE_SERVER=tcp:$WSL_HOST;
-
PulseAudio:
C:\PULSE~1
とか適当に展開する -
PULSE~1\etc\pulse\default.pa
をに追記- 行41:
load-module module-waveout sink_name=output source_name=input
- 行61:
load-module module-native-protocol-tcp auth-anonymous=1
- * 録音無効にしなくても大丈夫ぽい
- 行41:
-
PULSE~1\etc\pulse\daemon.conf
に追記- 末尾:
exit-idle-time = -1
- * 接続待ちタイムアウトの無効化
- 末尾:
-
PULSE~1\pulseaudio.vbs
を以下で新規作成Dim WinScriptHost Set WinScriptHost = CreateObject("WScript.Shell") WinScriptHost.Run Chr(34) & "C:\PULSE~1\bin\pulseaudio.exe" & Chr(34), 0 Set WinScriptHost = Nothing
VBSからWSH経由で叩くとウィンドウが出ない理由は謎。
-
PULSE~1\pulseaudio.vbs
へのショートカットをStartupフォルダに投げ込む -
WSL側作業
$ apt install pulseaudio
- ~/.bashrc に以下を追記 (*X410の項で追記済)
# export WSL_HOST=$(tail -1 /etc/resolv.conf | cut -d' ' -f2) export PULSE_SERVER=tcp:$WSL_HOST;
あかん忘れてもうた。
-
$ sudo apt install fcitx fcitx-mozc
-
$ fcitx-configtool
- Global Config - Trigger Input Method - Ctrl+Space を確認
-
~/.bashrc に以下を追記 (*X410の項で追記済)
export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=@im=fcitx
-
使用時に必要に応じて:
$ fcitx-autostart
-
使用時に必要に応じて: Ctrl+Space
$ sudo apt install firefox
$ firefox youtube.com