Merge ~rbalint/ubuntu/+source/wslu:wsl2-sound-x into ~ubuntu-core-dev/ubuntu/+source/wslu:ubuntu/master

Proposed by Balint Reczey
Status: Merged
Merged at revision: d97a77683fe52224119706fc84151456e683bb29
Proposed branch: ~rbalint/ubuntu/+source/wslu:wsl2-sound-x
Merge into: ~ubuntu-core-dev/ubuntu/+source/wslu:ubuntu/master
Diff against target: 37 lines (+20/-10)
1 file modified
debian/wsl-integration.sh (+20/-10)
Reviewer Review Type Date Requested Status
Sebastien Bacher Pending
Ubuntu Core Development Team Pending
Review via email: mp+375832@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/wsl-integration.sh b/debian/wsl-integration.sh
2index 01179a8..eb02c2d 100644
3--- a/debian/wsl-integration.sh
4+++ b/debian/wsl-integration.sh
5@@ -1,12 +1,22 @@
6-# set DISPLAY if there is an X11 server running
7-if which xvinfo > /dev/null && env DISPLAY=:0 xvinfo > /dev/null 2>&1; then
8- export DISPLAY=:0
9- export LIBGL_ALWAYS_INDIRECT=1
10-fi
11+if type pactl > /dev/null 2>&1 || type xvinfo > /dev/null 2>&1; then
12+ # detect WSL host
13+ if type systemd-detect-virt > /dev/null 2>&1 && test "$(systemd-detect-virt -c)" != wsl -a -e /etc/resolv.conf; then
14+ WSL_HOST=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null)
15+ fi
16+ WSL_HOST=${WSL_HOST:-localhost}
17+
18+ # set DISPLAY if there is an X11 server running
19+ if type xvinfo > /dev/null 2>&1 && env DISPLAY=${WSL_HOST}:0 xvinfo > /dev/null 2>&1; then
20+ export DISPLAY=${WSL_HOST}:0
21+ export LIBGL_ALWAYS_INDIRECT=1
22+ fi
23+
24+ # set up audio if pulse server is reachable only via tcp
25+ if type pactl > /dev/null 2>&1 \
26+ && (! pactl info > /dev/null 2>&1 || pactl info 2> /dev/null | grep -q 'Default Sink: auto_null' ) \
27+ && env PULSE_SERVER=tcp:${WSL_HOST} pactl info > /dev/null 2>&1; then
28+ export PULSE_SERVER=tcp:${WSL_HOST}
29+ fi
30
31-# set up audio if pulse server is reachable only via tcp
32-if which pactl > /dev/null \
33- && (! pactl info > /dev/null 2>&1 || pactl info 2> /dev/null | grep -q 'Default Sink: auto_null' ) \
34- && env PULSE_SERVER=tcp:localhost pactl info > /dev/null 2>&1; then
35- export PULSE_SERVER=tcp:localhost
36+ unset WSL_HOST
37 fi

Subscribers

People subscribed via source and target branches