-
-
Save nolanatearthsense/65b8733b088efdad2df92a81a27467cb to your computer and use it in GitHub Desktop.
run meld in docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#sudo apt-get install realpath # may already be installed | |
PATH1=$(realpath $1) | |
PATH2=$(realpath $2) | |
[ -d $PATH1 ] || PATH1=$(dirname $PATH1) | |
[ -d $PATH2 ] || PATH2=$(dirname $PATH2) | |
echo $PATH1 | |
echo $PATH2 | |
XAUTH=/tmp/.docker.xauth | |
echo "Preparing Xauthority data..." | |
xauth_list=$(xauth nlist :0 | tail -n 1 | sed -e 's/^..../ffff/') | |
if [ ! -f $XAUTH ]; then | |
if [ ! -z "$xauth_list" ]; then | |
echo $xauth_list | xauth -f $XAUTH nmerge - | |
else | |
touch $XAUTH | |
fi | |
chmod a+r $XAUTH | |
fi | |
docker run \ | |
-w $PWD \ | |
--env="DISPLAY=$DISPLAY" \ | |
--env="QT_X11_NO_MITSHM=1" \ | |
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ | |
--env="XAUTHORITY=$XAUTH" \ | |
--volume="$XAUTH:$XAUTH" \ | |
-v $PATH1:$PATH1 -v $PATH2:$PATH2 \ | |
guywithnose/meld meld $1 $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires docker.
Copy to
/usr/bin/
Example:
meld file1 file2