aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2016-06-07 10:59:35 -0700
committerPatrick Walton <pcwalton@mimiga.net>2016-06-08 12:29:46 -0700
commit8d5ff5cae765ff9f7711c564685ebb15a52ee96f (patch)
treee4ad44e7fe015c930db32b8607d36e472984fde0 /python/servo
parent0d963f5bf820f4ee604c2ee059d19e031237a4de (diff)
downloadservo-8d5ff5cae765ff9f7711c564685ebb15a52ee96f.tar.gz
servo-8d5ff5cae765ff9f7711c564685ebb15a52ee96f.zip
mach: Set a nice icon for the binary on the Mac.
There's actually a practical reason for this: it helps me pick out the app in Instruments.app. See: http://apple.stackexchange.com/questions/6901/how-can-i-change-a-file-or-folder-icon-using-the-terminal/161984#161984
Diffstat (limited to 'python/servo')
-rw-r--r--python/servo/build_commands.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 7e2845b598f..1d4931dc78c 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -186,6 +186,10 @@ class MachCommands(CommandBase):
if release:
opts += ["--release"]
+ servo_path = release_path
+ else:
+ servo_path = dev_path
+
if jobs is not None:
opts += ["-j", jobs]
if verbose:
@@ -241,6 +245,20 @@ class MachCommands(CommandBase):
shutil.copy(path.join(self.get_top_dir(), "components", "servo", "servo.exe.manifest"),
path.join(base_path, "debug" if dev else "release"))
+ # On the Mac, set a lovely icon. This makes it easier to pick out the Servo binary in tools
+ # like Instruments.app.
+ if sys.platform == "darwin":
+ try:
+ import Cocoa
+ icon_path = path.join(self.get_top_dir(), "resources", "servo.png")
+ icon = Cocoa.NSImage.alloc().initWithContentsOfFile_(icon_path)
+ if icon is not None:
+ Cocoa.NSWorkspace.sharedWorkspace().setIcon_forFile_options_(icon,
+ servo_path,
+ 0)
+ except ImportError:
+ pass
+
# Generate Desktop Notification if elapsed-time > some threshold value
notify_build_done(elapsed)