加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
syncbg.py 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
glepnir 提交于 2023-09-17 14:14 . update
import os
def update_tmux_conf(hexcode):
tmux_conf_path = os.path.expanduser("~/.dotfiles/config/tmux/tmux.conf")
with open(tmux_conf_path, "r") as f:
lines = f.readlines()
with open(tmux_conf_path, "w") as f:
for line in lines:
if line.strip().startswith("set -g background"):
f.write(f"set -g background {hexcode}\n")
else:
f.write(line)
def update_kitty_conf(hexcode):
kitty_conf_path = os.path.expanduser("~/.dotfiles/config/kitty/current-theme.conf")
with open(kitty_conf_path, "r") as f:
lines = f.readlines()
with open(kitty_conf_path, "w") as f:
for line in lines:
if line.strip().startswith("background "):
f.write(f"background {hexcode}\n")
else:
f.write(line)
if __name__ == "__main__":
hexcode = input("new background hexcode:")
update_tmux_conf(hexcode)
update_kitty_conf(hexcode)
print("config file updated!")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化