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

[Suggestion] Script to change theme. #40

Open
adamwojt opened this issue Jan 24, 2021 · 1 comment
Open

[Suggestion] Script to change theme. #40

adamwojt opened this issue Jan 24, 2021 · 1 comment

Comments

@adamwojt
Copy link

With below simple script it's easier to choose your favorite theme.

Note:

  • This requires allow_remote_control yes in your kitty.conf
  • Save below to file named "random_kitty" and run sudo chmod +x random_kitty". Then you can execute it with ./random_kitty` or add it to your path.
#!/usr/bin/python
import os
import random
import subprocess

home = os.getenv("HOME")
kitty = f"{home}/.config/kitty"
choices_dir = f"{kitty}/kitty-themes/themes"
choices = os.listdir(choices_dir)
dest = f"{kitty}/theme.conf"

if os.path.islink(dest):
    os.remove(dest)

new_theme = random.choice(choices)
new_theme_path = f"{choices_dir}/{new_theme}"
os.symlink(new_theme_path, dest)

command = f"kitty @ set-colors -a -c {kitty}/kitty.conf"
subprocess.run(command, shell=True)

print(f"Kitty theme set to {new_theme}")
@adamwojt
Copy link
Author

tty

@adamwojt adamwojt reopened this Jan 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant