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

Dan Villiom Podlaski Christiansen danchr at gmail.com
Wed Mar 23 15:00:48 CDT 2011


On 23 Mar 2011, at 20:22, Brodie Rao wrote:

> 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?

It would, but it could also cause false positives for native  
applications in an SSH session into a Mac.

I have an idea for how to deal with this; I'll send a followup patch  
which does it.

--

Dan Villiom Podlaski Christiansen
danchr at gmail.com



More information about the Mercurial-devel mailing list