Skip to content

Commit

Permalink
Suppress GLFW dock icon on macOS.
Browse files Browse the repository at this point in the history
Before this change, when GLFW is imported (e.g. via `from dm_control import suite`) on macOS, a Python rocket icon appears bouncing on the dock until the Python process quits.

PiperOrigin-RevId: 417036346
Change-Id: I24a467195c00f82da627cbbf0a31c602e6e437bd
  • Loading branch information
saran-t authored and alimuldal committed Jan 8, 2022
1 parent 304d2fc commit 73c31ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion dm_control/_render/glfw_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

"""An OpenGL renderer backed by GLFW."""

import platform

from dm_control._render import base
from dm_control._render import executor

Expand All @@ -25,7 +27,13 @@
except (ImportError, IOError, OSError) as exc:
raise ImportError from exc
try:
glfw.init()
if platform.system() == 'Darwin':
# By default, GLFW creates a Cocoa menubar on macOS, which results in a
# Python rocket icon appearing in the dock. We don't want this since
# dm_control._render only uses GLFW for offscreen rendering.
glfw.init_hint(glfw.COCOA_MENUBAR, glfw.FALSE)
else:
glfw.init()
except glfw.GLFWError as exc:
raise ImportError from exc

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def is_excluded(s):
return list(paths)

setup(
version='0.0.416999250',
version='0.0.417036346',
description='Continuous control environments and MuJoCo Python bindings.',
author='DeepMind',
license='Apache License, Version 2.0',
Expand Down

0 comments on commit 73c31ac

Please sign in to comment.