From e707b4f6153029a6c727d750c1f8768a6ce4b8e9 Mon Sep 17 00:00:00 2001 From: HeXiangLong <3234374354@qq.com> Date: Wed, 2 Apr 2025 18:32:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20main.py=EF=BC=8C=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E7=BB=88=E7=AB=AF=E7=AA=97=E5=8F=A3=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 7e2dc5d..aee3259 100644 --- a/main.py +++ b/main.py @@ -17,9 +17,7 @@ def pseudo_zsh(): readline.parse_and_bind("tab: complete") readline.set_completer(completer) - # 修改终端窗口标题 - sys.stdout.write("\033]0;zsh\007") # 使用 ANSI 转义序列设置标题 - sys.stdout.flush() + os.system("clear && cd ~") # 清屏 print(f"Last login: {datetime.now().strftime('%a %b %d %H:%M:%S %Y')} on ttys000") @@ -82,6 +80,10 @@ def pseudo_zsh(): subprocess.run(args) except FileNotFoundError: print(f"zsh: command not found: {args[0]}") + + # 修改终端窗口标题 + sys.stdout.write(f"\033]0;{CmdDir}-zsh\007") # 使用 ANSI 转义序列设置标题 + sys.stdout.flush() except KeyboardInterrupt: print(f"^C") except EOFError: