Skip to content

[Suggestion] Script to change theme. #40

Description

@adamwojt

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}")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions