Skip to content

Commit b481018

Browse files
gh-88516: show file proxy icon in IDLE editor windows on macOS (#112894)
The platform standard on macOS is to show a proxy icon for open files in the titlebar of Windows. Make sure IDLE matches this behaviour. Don't use both the long and short names in the window title. The behaviour of other editors (such as Text Editor) is to show only the short name with the proxy icon. Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent 4ee6bdf commit b481018

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Lib/idlelib/editor.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,9 @@ def open_recent_file(fn_closure=file_name):
10441044
def saved_change_hook(self):
10451045
short = self.short_title()
10461046
long = self.long_title()
1047-
if short and long:
1047+
if short and long and not macosx.isCocoaTk():
1048+
# Don't use both values on macOS because
1049+
# that doesn't match platform conventions.
10481050
title = short + " - " + long + _py_version
10491051
elif short:
10501052
title = short
@@ -1059,6 +1061,13 @@ def saved_change_hook(self):
10591061
self.top.wm_title(title)
10601062
self.top.wm_iconname(icon)
10611063

1064+
if macosx.isCocoaTk():
1065+
# Add a proxy icon to the window title
1066+
self.top.wm_attributes("-titlepath", long)
1067+
1068+
# Maintain the modification status for the window
1069+
self.top.wm_attributes("-modified", not self.get_saved())
1070+
10621071
def get_saved(self):
10631072
return self.undo.get_saved()
10641073

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
On macOS show a proxy icon in the title bar of editor windows to match
2+
platform behaviour.

0 commit comments

Comments
 (0)