Skip to content

Instantly share code, notes, and snippets.

@pasbi
Last active July 24, 2024 19:53
Show Gist options
  • Save pasbi/3155067012eac354743bf92949b4c536 to your computer and use it in GitHub Desktop.
Save pasbi/3155067012eac354743bf92949b4c536 to your computer and use it in GitHub Desktop.
Modify qt6ct scheme on command line
#!/usr/bin/env python3
from PyQt6.QtCore import QSettings
import sys
import pathlib
base_path = pathlib.Path("/usr/share/qt6ct/colors/")
extension = ".conf"
def themes():
return [p.stem for p in base_path.glob(f"*{extension}")]
if len(sys.argv) < 3 or "-h" in sys.argv or "--help" in sys.argv:
sys.exit(
f"""Usage: {sys.argv[0]} CONFIG_FILE SCHEME
Set the qt6ct scheme to SCHEME.
Available schemes:
{"\n".join(themes())}
"""
)
settings = QSettings(sys.argv[1], QSettings.Format.IniFormat)
settings.beginGroup("Appearance")
settings.setValue("color_scheme_path", str(base_path / f"{sys.argv[2]}{extension}"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment