#!/bin/zsh # vim: sts=2 sw=2 et setopt no_unset warn_create_global typeset -g map=/run/display-container-map find_server_display() { local container=$1 local -a found found=( $map/*=$container(N) ) if ! (($#found)); then return 1 else typeset -g display display=${${found[1]:t}%%=*} fi } main() { local container=$1 shift find_server_display $container || exit $? exec in-xpra $display "$@" } typeset -f -t main main "$@"