From: Ismaël Bouya Date: Sun, 18 Jan 2015 21:59:13 +0000 (+0100) Subject: wrapper_display + LICENSE X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FScripts%2FPublic.git;a=commitdiff_plain;h=52b8096cabc7d512f586183266c5167d320b7719 wrapper_display + LICENSE --- diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8f083c3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +# The MIT License (MIT) +# +# Copyright (c) 2011-2015 Ismaël Bouya http://www.normalesup.org/~bouya/ +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. diff --git a/wrapper_display b/wrapper_display new file mode 100755 index 0000000..6b30447 --- /dev/null +++ b/wrapper_display @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# The MIT License (MIT) +# +# Copyright (c) 2011-2015 Ismaël Bouya http://www.normalesup.org/~bouya/ +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +eval `tmux show-env DISPLAY | grep -v "^-DISPLAY"` +if `ss -o state established sport = :5901 | grep -q "^tcp"`; then + DISPLAY=:1 +fi + +if [ $# -lt 1 ]; then + echo DISPLAY=$DISPLAY +else + exec "$@" +fi