4

I am using MacBook Pro. I have set up git difftool to work with meld. Here is my ~/.gitconfig:

    [diff]
    tool = meld
    [difftool]
    prompt = false
    [difftool "meld"]
    trustExitCode = true
    cmd = open -W -a Meld --args \"$LOCAL\" \"$PWD/$REMOTE\"
    [merge]
    tool = meld
    [mergetool]
    prompt = false
    [mergetool "meld"]
    trustExitCode = true
    cmd = open -W -a Meld --args --auto-merge \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" --output=\"$PWD/$MERGED\"

When I do git difftool, meld launches in the background. I have to click on the meld icon to view the diffs. (Command + Tab doesn't work) And when I close one file, another file opens up in the background again. So I have to click on the meld icon again to see the diffs.

While this technically works, it's very inconvenient. I was wondering if there is a way to fix this issue so that meld will launch the diffs at the forefront.

techguy2000
  • 4,861
  • 6
  • 32
  • 48

2 Answers2

0

Still haven't figured out how to open meld in the forefront. But when I do Command + q to quick meld, it opens up another file automatically in the forefront. So that helps.

techguy2000
  • 4,861
  • 6
  • 32
  • 48
0

its not a fix, but it's a decent work around that has worked for me.

This message was written by munepi (probably easier to read in the original post)

move the original Mac-port starter script to Meld.distro below.

$ mv/Applications/Meld.app/Contents/MacOS/Meld

/Applications/Meld.app/Contents/MacOS/Meld.distro make a wrapper /Applications/Meld.app/Contents/MacOS/Meld of the Meld.distro below

#!/bin/bash  
## 
# $ sudo xattr -r -d com.apple.quarantine /Applications/Meld.app/  
## standard plist settings: OK
# ~/Library/Preferences/org.gnome.meld.plist
# $ defaults read org.gnome.meld
# $ defaults write org.gnome.meld "/org/gnome/meld/use-system-font" 0
# $ defaults write org.gnome.meld "/org/gnome/meld/custom-font" "Ricty, 18"  
##FIXME: ad-hoc cleanup Meld settings (cd ${HOME} rm -rf ./.local/share/meld
#rm -f ./Library/Preferences/org.gnome.meld.plist rm -rf "./Library/Saved Application State/org.gnome.meld.savedState/" )  
# export G_ENABLE_DIAGNOSTIC=1 # 0 or 1
# export GTK_THEME=Adwaita # Adwaita or Adwaita:dark
# export GTK_DEBUG=interactive   logger "/Applications/Meld.app/Contents/MacOS/Meld.distro" exec "/Applications/Meld.app/Contents/MacOS/Meld.distro" $@ 

Then, $ chmod +x /Applications/Meld.app/Contents/MacOS/Meld

I remark that

you are available some GTK-related environment variables inside the above wrapper Meld: G_ENABLE_DIAGNOSTIC, GTK_THEME, GTK_DEBUG. you are also available some tips commented in the above wrapper Meld if necessary. I also have posted how to use/change custom-font with Meld plist settings in Issue Can't change font #38. The plist file ~//Library/Preferences/org.gnome.meld.plist is just the one. Please check and try the post if necessary.

I had to change my .gitconfig as below

[mergetool]
prompt = false
[mergetool "meld"]
trustExitCode = true
cmd = /Applications/Meld.app/Contents/MacOS/Meld --auto-merge \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" --output=\"$PWD/$MERGED\"

more info/tips can be found here: https://github.com/yousseb/meld/issues/73#issuecomment-447728538