[PATCH] util: add Mac-specific check whether we're in a GUI session (issue2553)

Brodie Rao brodie at bitheap.org
Wed Mar 23 14:22:43 CDT 2011


On Wed, Mar 23, 2011 at 9:13 AM, Kevin Bullock
<kbullock+mercurial at ringworld.org> wrote:
> On Mar 23, 2011, at 5:00 AM, Mads Kiilerich wrote:
>
>> On 03/23/2011 09:46 AM, Dan Villiom Podlaski Christiansen wrote:
>> ...
>>
>>> diff --git a/mercurial/util.py b/mercurial/util.py
>>> --- a/mercurial/util.py
>>> +++ b/mercurial/util.py
>>> @@ -769,7 +769,18 @@ def splitpath(path):
>>>
>>>  def gui():
>>>      '''Are we running in a GUI?'''
>>> -    return os.name == "nt" or os.name == "mac" or os.environ.get("DISPLAY")
>>> +    if sys.platform == 'darwin':
>>> +        if 'SSH_CONNECTION' in os.environ:
>>> +            # handle SSH access to a box where the user is logged in
>>> +            return False
>>
>> Hardcore Mac users don't use X and forwarding over ssh?
>
> Note that this check only applies if your merge tool is configured with .gui=True. If you're using a Mac and forwarding X over SSH, presumably you can also set .gui=False for your favorite merge tool.
>
> All that said, I consider myself a pretty hardcore Mac user, and I never forward X over SSH. I use Remote Desktop (which is really just VNC).

Would checking DISPLAY before calling isgui() fix detection for X
forwarding over SSH?


More information about the Mercurial-devel mailing list