mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
buildFHSEnvBubblewrap: allow more varied $DISPLAY syntax
The $DISPLAY variable has a format of [host]:num[.screen]. Previously, the number would only be extracted properly if it had the form :num. Allow all forms but correctly discard the unused parts.
This commit is contained in:
parent
b3edf80d96
commit
dd99084843
@ -196,8 +196,10 @@ let
|
||||
x11_args+=(--tmpfs /tmp/.X11-unix)
|
||||
|
||||
# Try to guess X socket path. This doesn't cover _everything_, but it covers some things.
|
||||
if [[ "$DISPLAY" == :* ]]; then
|
||||
display_nr=''${DISPLAY#?}
|
||||
if [[ "$DISPLAY" == *:* ]]; then
|
||||
# recover display number from $DISPLAY formatted [host]:num[.screen]
|
||||
display_nr=''${DISPLAY/#*:} # strip host
|
||||
display_nr=''${display_nr/%.*} # strip screen
|
||||
local_socket=/tmp/.X11-unix/X$display_nr
|
||||
x11_args+=(--ro-bind-try "$local_socket" "$local_socket")
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user