add stuff

This commit is contained in:
2026-02-16 20:00:12 +01:00
parent 2fb3eb1f52
commit 0a4ff4c504
25 changed files with 2633 additions and 186 deletions

View File

@ -0,0 +1,30 @@
#!/usr/bin/env python3
import subprocess
from argparse import ArgumentParser
if __name__ == "__main__":
parser = ArgumentParser(description="GTK theme switcher")
parser.add_argument(
"mode",
help="The mode to switch the GTK theme to (e.g., 'dark' or 'light')",
)
args = parser.parse_args()
if args.mode not in ["dark", "light"]:
print("Invalid mode. Please choose 'dark' or 'light'.")
exit(1)
gtk_theme = "Adwaita-dark" if args.mode == "dark" else "Adwaita"
color_scheme = "prefer-dark" if args.mode == "dark" else "prefer-light"
# Set the GTK theme using gsettings
subprocess.run(
["gsettings", "set", "org.gnome.desktop.interface", "gtk-theme", gtk_theme],
check=True,
)
subprocess.run(
["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", color_scheme],
check=True,
)

View File

@ -0,0 +1,39 @@
#!/usr/bin/env python3
import re
from argparse import ArgumentParser
from pathlib import Path
if __name__ == "__main__":
parser = ArgumentParser(description="VS Code theme switcher")
parser.add_argument(
"mode",
help="The mode to switch the VS Code theme to (e.g., 'dark' or 'light')",
)
args = parser.parse_args()
if args.mode not in ["dark", "light"]:
print("Invalid mode. Please choose 'dark' or 'light'.")
exit(1)
settings = Path.home() / ".config/Code/User/settings.json"
if not settings.exists():
print(f"VS Code settings file not found at {settings}")
exit(1)
# We just replace the theme name in the settings file using regex,
# this way we don't have to worry about jsonc parsing.
theme = "Monokai Pro" if args.mode == "dark" else "Monokai Pro Light"
with settings.open("r") as f:
content = f.read()
new_content = re.sub(
r'"workbench\.colorTheme"\s*:\s*".*?"',
f'"workbench.colorTheme": "{theme}"',
content,
)
with settings.open("w") as f:
f.write(new_content)