更新 main.py,恢复终端窗口标题设置功能
This commit is contained in:
8
main.py
8
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:
|
||||
|
||||
Reference in New Issue
Block a user