Merge pull request #334 from michael-lazar/osx_display
Ignore OSX $DISPLAY variable, default to true. #166
This commit is contained in:
@@ -93,15 +93,11 @@ class Terminal(object):
|
|||||||
|
|
||||||
if self._display is None:
|
if self._display is None:
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
# OSX doesn't always set DISPLAY so we can't use this to check
|
# OS X won't set $DISPLAY unless xQuartz is installed.
|
||||||
# Note: Disabling for now, with the hope that if this
|
# If you're using OS X and you want to access a terminal
|
||||||
# is a widespread issue then people will complain and we can
|
# browser, you need to set it manually via $BROWSER.
|
||||||
# come up with a better solution. Checking for $DISPLAY is
|
# See issue #166
|
||||||
# used extensively in mailcap files, so it really *should* be
|
display = True
|
||||||
# set properly. I don't have a mac anymore so I can't test.
|
|
||||||
|
|
||||||
# display = True
|
|
||||||
display = bool(os.environ.get("DISPLAY"))
|
|
||||||
else:
|
else:
|
||||||
display = bool(os.environ.get("DISPLAY"))
|
display = bool(os.environ.get("DISPLAY"))
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ def test_terminal_properties(terminal, config):
|
|||||||
with mock.patch('rtv.terminal.sys') as sys, \
|
with mock.patch('rtv.terminal.sys') as sys, \
|
||||||
mock.patch.dict('os.environ', {'DISPLAY': ''}):
|
mock.patch.dict('os.environ', {'DISPLAY': ''}):
|
||||||
sys.platform = 'darwin'
|
sys.platform = 'darwin'
|
||||||
assert terminal.display is False
|
assert terminal.display is True
|
||||||
|
|
||||||
terminal._display = None
|
terminal._display = None
|
||||||
with mock.patch.dict('os.environ', {'DISPLAY': ':0', 'BROWSER': 'w3m'}):
|
with mock.patch.dict('os.environ', {'DISPLAY': ':0', 'BROWSER': 'w3m'}):
|
||||||
|
|||||||
Reference in New Issue
Block a user