···196196 x11_args+=(--tmpfs /tmp/.X11-unix)
197197198198 # Try to guess X socket path. This doesn't cover _everything_, but it covers some things.
199199- if [[ "$DISPLAY" == :* ]]; then
200200- display_nr=''${DISPLAY#?}
199199+ if [[ "$DISPLAY" == *:* ]]; then
200200+ # recover display number from $DISPLAY formatted [host]:num[.screen]
201201+ display_nr=''${DISPLAY/#*:} # strip host
202202+ display_nr=''${display_nr/%.*} # strip screen
201203 local_socket=/tmp/.X11-unix/X$display_nr
202204 x11_args+=(--ro-bind-try "$local_socket" "$local_socket")
203205 fi