Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mitmproxy may not update macOS Terminal app's window title #6693

Open
thisisgk opened this issue Feb 28, 2024 · 3 comments
Open

mitmproxy may not update macOS Terminal app's window title #6693

thisisgk opened this issue Feb 28, 2024 · 3 comments

Comments

@thisisgk
Copy link

Problem Description

I usually run mitmproxy on macOS Terminal app. At times when I start mitmproxy, Terminal app's window title shows different directory than the one where I start mitmproxy. It turns out that the directory shown is where I previously ran command like man or less which draws on alternate screen. Just a minor issue, but it's a bit confusing.

Steps to reproduce the behavior:

  1. in Terminal app's "Profiles", check the box to show "Working directory or document" in "Window" and select terminal as "xterm-256color" in "Advanced". (Both should be the default.)
  2. run man or less to draw on alternate screen.
  3. cd to somewhere else.
  4. start mitmproxy. Window title should show the directory at step 2.

What I tried and found:
I tried the following code in Urwid Tutorial with urwid-mitmproxy and urwid at the above step 4.

import urwid

txt = urwid.Text("Hello World")
fill = urwid.Filler(txt, "top")
loop = urwid.MainLoop(fill)
loop.run()

Window title is shown as expected with urwid. The reason of the difference seems to be urwid PR#556. Using this PR's escape sequence, window title is updated with urwid-mitmproxy as well.

urwid.escape.SWITCH_TO_ALTERNATE_BUFFER = "\x1b[?1049h"
urwid.escape.RESTORE_NORMAL_BUFFER = "\x1b[?1049l"

Will it be possible to take this urwid fix into urwid-mitmproxy?
Sorry for the report here, urwid-mitmproxy has no issues section.

System Information

Mitmproxy: 10.2.2
Python: 3.12.2
OpenSSL: OpenSSL 3.1.4 24 Oct 2023
Platform: macOS-10.13.6-x86_64-i386-64bit

urwid-mitmproxy: 2.1.2.1

@thisisgk thisisgk added the kind/triage Unclassified issues label Feb 28, 2024
@mhils
Copy link
Member

mhils commented Feb 28, 2024

It looks like urwid is very much maintained again, which is awesome to see! 🎉🎉🎉

Could you test urwid with urwid 2.6.6 and report back if there are any issues with mitmproxy? We'd be super duper happy to switch back to vanilla urwid now that my Windows PR has been merged.

@thisisgk
Copy link
Author

I uninstalled urwid-mitmproxy, installed urwid (version 2.6.7 was installed, and typing-extensions and wcwidth were also installed) and used mitmproxy for a while.
No problems so far, and needless to say, window title is fine. Of course all I can say is "it seems to be working fine on macOS Terminal app".

@mhils
Copy link
Member

mhils commented Feb 28, 2024

Great, thanks! I'll test Windows when I get to it these days, so far it looks like we can switch back to stock urwid thanks to @penguinolog's awesome maintenance efforts there! 🙌

@mhils mhils added kind/bug area/console upstream and removed kind/triage Unclassified issues labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants