This commit is contained in:
Zacharias-Brohn
2026-03-07 18:13:07 +01:00
parent 1d84248295
commit 7eb7cecf1e
2 changed files with 56 additions and 3 deletions
+3 -3
View File
@@ -19,20 +19,20 @@ Searcher {
function preview(path: string): void { function preview(path: string): void {
previewPath = path; previewPath = path;
if (Config.general.color.schemeGeneration) if (Config.general.color.schemeGeneration)
Quickshell.execDetached(["sh", "-c", `zshell-cli scheme generate --image-path ${previewPath} --scheme ${Config.colors.schemeType} --mode ${Config.general.color.mode}`]); Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${previewPath}`, "--scheme", `${Config.colors.schemeType}`, "--mode", `${Config.general.color.mode}`]);
showPreview = true; showPreview = true;
} }
function setWallpaper(path: string): void { function setWallpaper(path: string): void {
actualCurrent = path; actualCurrent = path;
WallpaperPath.currentWallpaperPath = path; WallpaperPath.currentWallpaperPath = path;
Quickshell.execDetached(["sh", "-c", `zshell-cli wallpaper lockscreen --input-image=${root.actualCurrent} --output-path=${Paths.state}/lockscreen_bg.png --blur-amount=${Config.lock.blurAmount}`]); Quickshell.execDetached(["zshell-cli", "wallpaper", "lockscreen", "--input-image", `${root.actualCurrent}`, "--output-path", `${Paths.state}/lockscreen_bg.png`, "--blur-amount", `${Config.lock.blurAmount}`]);
} }
function stopPreview(): void { function stopPreview(): void {
showPreview = false; showPreview = false;
if (Config.general.color.schemeGeneration) if (Config.general.color.schemeGeneration)
Quickshell.execDetached(["sh", "-c", `zshell-cli scheme generate --image-path ${root.actualCurrent} --scheme ${Config.colors.schemeType} --mode ${Config.general.color.mode}`]); Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${root.actualCurrent}`, "--scheme", `${Config.colors.schemeType}`, "--mode", `${Config.general.color.mode}`]);
} }
extraOpts: useFuzzy ? ({}) : ({ extraOpts: useFuzzy ? ({}) : ({
+53
View File
@@ -2,6 +2,8 @@ import typer
import json import json
import shutil import shutil
import os import os
import re
import subprocess
from jinja2 import Environment, FileSystemLoader, StrictUndefined, Undefined from jinja2 import Environment, FileSystemLoader, StrictUndefined, Undefined
from typing import Any, Optional, Tuple from typing import Any, Optional, Tuple
@@ -240,6 +242,53 @@ def generate(
return is_dark return is_dark
def apply_gtk_mode(mode: str) -> None:
mode = mode.lower()
preference = "prefer-dark" if mode == "dark" else "prefer-light"
try:
subprocess.run(
[
"gsettings",
"set",
"org.gnome.desktop.interface",
"color-scheme",
preference,
],
check=False,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
except FileNotFoundError:
pass
def apply_qt_mode(mode: str, home: str) -> None:
mode = mode.lower()
qt_conf = Path(home) / ".config/qt6ct/qt6ct.conf"
if not qt_conf.exists():
return
try:
text = qt_conf.read_text(encoding="utf-8")
except OSError:
return
target = "Dark.colors" if mode == "dark" else "Light.colors"
new_text, count = re.subn(
r"^(color_scheme_path=.*?)(?:Light|Dark)\.colors\s*$",
rf"\1{target}",
text,
flags=re.MULTILINE,
)
if count > 0 and new_text != text:
try:
qt_conf.write_text(new_text, encoding="utf-8")
except OSError:
pass
def build_template_context( def build_template_context(
*, *,
colors: dict[str, str], colors: dict[str, str],
@@ -440,6 +489,10 @@ def generate(
colors = generate_color_scheme(seed, effective_mode, scheme_class) colors = generate_color_scheme(seed, effective_mode, scheme_class)
if smart and not preset:
apply_gtk_mode(mode)
apply_qt_mode(mode, HOME)
output_dict = { output_dict = {
"name": name, "name": name,
"flavor": flavor, "flavor": flavor,