좋아요, 방법을 찾았습니다. 이것은 Python 코드 (from here)입니다. 그것은 약간의 청소 및 오류 처리를 사용할 수 있지만 작동합니다. 키는 ApplicationServices의 문서화되지 않은 CPSSetProcessName입니다. 당신이 바로 그것을 호출하는 경우
def _osx_set_process_name(app_title):
""" Change OSX application title """
from ctypes import cdll, c_int, pointer, Structure
from ctypes.util import find_library
app_services = cdll.LoadLibrary(find_library("ApplicationServices"))
if app_services.CGMainDisplayID() == 0:
print "cannot run without OS X window manager"
else:
class ProcessSerialNumber(Structure):
_fields_ = [("highLongOfPSN", c_int),
("lowLongOfPSN", c_int)]
psn = ProcessSerialNumber()
psn_p = pointer(psn)
if ( (app_services.GetCurrentProcess(psn_p) < 0) or
(app_services.SetFrontProcess(psn_p) < 0)):
print "cannot run without OS X gui process"
print "setting process name"
app_services.CPSSetProcessName(psn_p, app_title)
return False
, 그것은 활동 모니터의 프로세스 이름을 변경합니다. 당신이 .APP 패키지와 함께이 결합하면 당신은 파이썬 응용 프로그램의 정말 좋은 시스템 통합을 얻을 수
import gobject
gobject.timeout_add(100, _osx_set_process_name, "MyTitle")
참고 : 나는 어떤 이유로도 메뉴 모음의 이름을 변경하는 작은 타임 아웃 후 전화를했다. 아이콘, Finder 표시 이름, ..., 내가 시도한 모든 메소드를 변경하려면 "메뉴 막대에있는 CFBundleName"을 "Python"으로 남겨 둡니다. 예를 들어 This answer은 긴 이름 만 변경합니다 (도크 아이콘 위에 표시됨).
이 답변은 의도 한 결과를 제공하지만 매우 우아하지는 않습니다. 내가 왜 시간 초과가 필요한지에 대한 통찰력을 주셔서 감사합니다 ... 나는 파이썬이나 pygtk이 처음 gtk를 가져 오거나 메인 루프를 실행할 때 프로세스 이름 자체를 변경한다고 생각합니다.
출처
2013-01-02 13:41:02
jdm