angr-management icon indicating copy to clipboard operation
angr-management copied to clipboard

Application title not set correctly on macOS

Open twizmwazin opened this issue 3 years ago • 1 comments

When I launch angr management on macOS, the title is just the name of the python interpreter it is running with.

twizmwazin avatar Aug 03 '22 01:08 twizmwazin

It seems this is set by macOS and not changeable by the application directly. macOS will set it based on a parameter in the .app directory, defaulting to the executable name when that metadata is missing.

twizmwazin avatar Aug 03 '22 19:08 twizmwazin

This can be dynamically adjusted fixed by interfacing with mac via Cocoa.

pip install pyobjc-framework-Cocoa

from pathlib import Path
if sys.platform.startswith("darwin"):
  from Foundation import NSBundle
  bundle = NSBundle.mainBundle()
  if bundle:
    app_info = bundle.localizedInfoDictionary() or bundle.infoDictionary()
    if app_info:
      app_info['CFBundleName'] = Path(sys.argv[0]).stem

zwimer avatar Nov 19 '22 00:11 zwimer

Note this only changes the application title- not the name (which is shown in the dock and tab-switcher)

zwimer avatar Nov 19 '22 00:11 zwimer

It has to be execute before qt stuff sets up the app though; i.e. before this line: https://github.com/angr/angr-management/blob/d1701ae13273bc46960b917b240b68b7a196436f/angrmanagement/main.py#L142

zwimer avatar Nov 19 '22 00:11 zwimer