From 88c00aa274346f445952d831e9a3ccebde5d8eda Mon Sep 17 00:00:00 2001 From: HeXiangLong <3234374354@qq.com> Date: Wed, 2 Apr 2025 13:00:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=88=E7=AB=AF=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E6=A0=87=E9=A2=98=E6=98=BE=E7=A4=BA=EF=BC=8C=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=9B=AE=E5=BD=95=E6=97=B6=E8=87=AA=E5=8A=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.py b/main.py index deffedd..100cf77 100644 --- a/main.py +++ b/main.py @@ -29,6 +29,11 @@ def pseudo_zsh(): CmdDir = '~' else: CmdDir = dir.split('/')[-1] + + # 修改终端窗口标题 + sys.stdout.write(f"\033]0;20250910553@何相龙 {CmdDir}\007") + sys.stdout.flush() + # 显示提示符并获取用户输入 cmd = input(f"20250910553@何相龙 {CmdDir} % ") @@ -46,6 +51,10 @@ def pseudo_zsh(): if args[0] == 'cd': try: os.chdir(args[1]) # 切换到指定目录 + # 更新终端窗口标题 + CmdDir = os.getcwd().split('/')[-1] + sys.stdout.write(f"\033]0;20250910553@何相龙 {CmdDir}\007") + sys.stdout.flush() except IndexError: print("cd: missing argument") # 缺少参数 except FileNotFoundError: