proper color scheme preview to avoid watcher creation spam
C++ / fmt (pull_request) Successful in 6s
JS/TS / fmt (pull_request) Successful in 19s
JS/TS / lint (pull_request) Successful in 21s
Python / static (pull_request) Successful in 53s
Rust / fmt (pull_request) Successful in 47s
C++ / build (pull_request) Successful in 1m54s
Rust / build (pull_request) Successful in 2m7s
Rust / clippy (pull_request) Successful in 1m31s
Python / verify (pull_request) Successful in 2m57s
C++ / clang-tidy (pull_request) Successful in 3m49s
C++ / fmt (pull_request) Successful in 6s
JS/TS / fmt (pull_request) Successful in 19s
JS/TS / lint (pull_request) Successful in 21s
Python / static (pull_request) Successful in 53s
Rust / fmt (pull_request) Successful in 47s
C++ / build (pull_request) Successful in 1m54s
Rust / build (pull_request) Successful in 2m7s
Rust / clippy (pull_request) Successful in 1m31s
Python / verify (pull_request) Successful in 2m57s
C++ / clang-tidy (pull_request) Successful in 3m49s
This commit is contained in:
@@ -17,7 +17,10 @@ Singleton {
|
|||||||
watchChanges: true
|
watchChanges: true
|
||||||
|
|
||||||
onAdapterUpdated: writeAdapter()
|
onAdapterUpdated: writeAdapter()
|
||||||
onFileChanged: reload()
|
onFileChanged: {
|
||||||
|
reload();
|
||||||
|
Wallpapers.previewColorLock = false;
|
||||||
|
}
|
||||||
|
|
||||||
JsonAdapter {
|
JsonAdapter {
|
||||||
id: adapter
|
id: adapter
|
||||||
|
|||||||
+28
-6
@@ -6,7 +6,7 @@ import Quickshell.Io
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import ZShell.Models
|
import ZShell.Models
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Modules
|
import qs.Services
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
import qs.Paths
|
import qs.Paths
|
||||||
|
|
||||||
@@ -17,6 +17,8 @@ Searcher {
|
|||||||
property alias crops: adapter.monitorCrops
|
property alias crops: adapter.monitorCrops
|
||||||
readonly property string current: showPreview ? previewPath : actualCurrent
|
readonly property string current: showPreview ? previewPath : actualCurrent
|
||||||
property alias monitorCrops: monitorCrops
|
property alias monitorCrops: monitorCrops
|
||||||
|
property bool pendingPreviewClear
|
||||||
|
property bool previewColorLock
|
||||||
property string previewPath
|
property string previewPath
|
||||||
property bool recentlyChanged
|
property bool recentlyChanged
|
||||||
property bool showPreview: false
|
property bool showPreview: false
|
||||||
@@ -34,9 +36,10 @@ Searcher {
|
|||||||
|
|
||||||
function preview(path: string): void {
|
function preview(path: string): void {
|
||||||
previewPath = path;
|
previewPath = path;
|
||||||
if (Config.general.color.schemeGeneration)
|
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${previewPath}`, "--scheme", `${Config.colors.schemeType}`, "--mode", `${Config.general.color.mode}`]);
|
|
||||||
showPreview = true;
|
showPreview = true;
|
||||||
|
|
||||||
|
if (Config.general.color.schemeGeneration)
|
||||||
|
previewColorsProc.running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCrop(screen: string, rect: rect, zoom: real): void {
|
function setCrop(screen: string, rect: rect, zoom: real): void {
|
||||||
@@ -52,7 +55,6 @@ Searcher {
|
|||||||
height: rect.height,
|
height: rect.height,
|
||||||
zoom: zoom
|
zoom: zoom
|
||||||
};
|
};
|
||||||
// root.crops = updated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWallpaper(path: string): void {
|
function setWallpaper(path: string): void {
|
||||||
@@ -66,8 +68,10 @@ Searcher {
|
|||||||
|
|
||||||
function stopPreview(): void {
|
function stopPreview(): void {
|
||||||
showPreview = false;
|
showPreview = false;
|
||||||
if (Config.general.color.schemeGeneration)
|
if (previewColorLock)
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${root.actualCurrent}`, "--scheme", `${Config.colors.schemeType}`, "--mode", `${Config.general.color.mode}`]);
|
pendingPreviewClear = true;
|
||||||
|
else
|
||||||
|
Colors.showPreview = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
extraOpts: useFuzzy ? ({}) : ({
|
extraOpts: useFuzzy ? ({}) : ({
|
||||||
@@ -77,6 +81,11 @@ Searcher {
|
|||||||
list: wallpapers.entries
|
list: wallpapers.entries
|
||||||
useFuzzy: true
|
useFuzzy: true
|
||||||
|
|
||||||
|
onPreviewColorLockChanged: {
|
||||||
|
if (!previewColorLock && pendingPreviewClear)
|
||||||
|
Colors.showPreview = false;
|
||||||
|
}
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
function set(path: string): void {
|
function set(path: string): void {
|
||||||
root.setWallpaper(path);
|
root.setWallpaper(path);
|
||||||
@@ -118,4 +127,17 @@ Searcher {
|
|||||||
path: Config.general.wallpaperPath
|
path: Config.general.wallpaperPath
|
||||||
recursive: true
|
recursive: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: previewColorsProc
|
||||||
|
|
||||||
|
command: ["zshell-cli", "scheme", "generate", "-p", "-i", root.previewPath]
|
||||||
|
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
Colors.load(text, true);
|
||||||
|
Colors.showPreview = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ Item {
|
|||||||
if (currentItem) {
|
if (currentItem) {
|
||||||
if (list.showWallpapers) {
|
if (list.showWallpapers) {
|
||||||
if (Colors.scheme === "dynamic" && currentItem.modelData.path !== Wallpapers.actualCurrent)
|
if (Colors.scheme === "dynamic" && currentItem.modelData.path !== Wallpapers.actualCurrent)
|
||||||
Wallpapers.previewColourLock = true;
|
Wallpapers.previewColorLock = true;
|
||||||
Wallpapers.setWallpaper(currentItem.modelData.path);
|
Wallpapers.setWallpaper(currentItem.modelData.path);
|
||||||
root.visibilities.launcher = false;
|
root.visibilities.launcher = false;
|
||||||
} else if (text.startsWith(Config.launcher.actionPrefix)) {
|
} else if (text.startsWith(Config.launcher.actionPrefix)) {
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const [name, color] of Object.entries(scheme.colors)) {
|
for (const [name, color] of Object.entries(scheme.colors)) {
|
||||||
const propName = name.startsWith("term") ? name : `m3${name}`;
|
const propName = `m3${name}`;
|
||||||
if (colors.hasOwnProperty(propName))
|
if (colors.hasOwnProperty(propName))
|
||||||
colors[propName] = `${color}`;
|
colors[propName] = `${color}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,10 +116,15 @@ def list_presets(
|
|||||||
@app.command()
|
@app.command()
|
||||||
def generate(
|
def generate(
|
||||||
image_path: Path | None = typer.Option(
|
image_path: Path | None = typer.Option(
|
||||||
None, help="Path to source image. Required for image mode."
|
None,
|
||||||
|
"--image-path",
|
||||||
|
"-i",
|
||||||
|
help="Path to source image. Required for image mode.",
|
||||||
),
|
),
|
||||||
scheme: str | None = typer.Option(
|
scheme: str | None = typer.Option(
|
||||||
None,
|
None,
|
||||||
|
"--scheme",
|
||||||
|
"-s",
|
||||||
help="Color scheme algorithm to use for image mode. Ignored in preset mode.",
|
help="Color scheme algorithm to use for image mode. Ignored in preset mode.",
|
||||||
autocompletion=_complete_scheme_name,
|
autocompletion=_complete_scheme_name,
|
||||||
),
|
),
|
||||||
@@ -130,16 +135,26 @@ def generate(
|
|||||||
),
|
),
|
||||||
mode: str | None = typer.Option(
|
mode: str | None = typer.Option(
|
||||||
None,
|
None,
|
||||||
|
"--mode",
|
||||||
|
"-m",
|
||||||
help="Mode of the preset scheme (dark or light).",
|
help="Mode of the preset scheme (dark or light).",
|
||||||
autocompletion=_complete_mode,
|
autocompletion=_complete_mode,
|
||||||
),
|
),
|
||||||
accent: str | None = typer.Option(
|
accent: str | None = typer.Option(
|
||||||
None,
|
None,
|
||||||
|
"--accent",
|
||||||
|
"-a",
|
||||||
help="Accent for schemes that support it (e.g. mauve).",
|
help="Accent for schemes that support it (e.g. mauve).",
|
||||||
autocompletion=_complete_accent,
|
autocompletion=_complete_accent,
|
||||||
),
|
),
|
||||||
|
preview: bool = typer.Option(
|
||||||
|
False,
|
||||||
|
"--preview",
|
||||||
|
"-p",
|
||||||
|
help="Preview scheme - internal use",
|
||||||
|
),
|
||||||
):
|
):
|
||||||
if not any([image_path, scheme, preset, mode, accent]):
|
if not any([image_path, scheme, preset, mode, accent, preview]):
|
||||||
print(
|
print(
|
||||||
"Hint: use --preset <scheme>:<variant> or --image-path <path>",
|
"Hint: use --preset <scheme>:<variant> or --image-path <path>",
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
@@ -685,10 +700,6 @@ def generate(
|
|||||||
|
|
||||||
variant_val = scheme if not preset else p_variant
|
variant_val = scheme if not preset else p_variant
|
||||||
|
|
||||||
if smart and not preset:
|
|
||||||
apply_gtk_mode(effective_mode)
|
|
||||||
apply_qt_mode(effective_mode, HOME)
|
|
||||||
|
|
||||||
output_dict = {
|
output_dict = {
|
||||||
"name": name,
|
"name": name,
|
||||||
"flavor": flavor,
|
"flavor": flavor,
|
||||||
@@ -698,6 +709,14 @@ def generate(
|
|||||||
"seed": seed.to_int(),
|
"seed": seed.to_int(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if preview:
|
||||||
|
print(json.dumps(output_dict))
|
||||||
|
return
|
||||||
|
|
||||||
|
if smart and not preset:
|
||||||
|
apply_gtk_mode(effective_mode)
|
||||||
|
apply_qt_mode(effective_mode, HOME)
|
||||||
|
|
||||||
if TEMPLATE_DIR is not None:
|
if TEMPLATE_DIR is not None:
|
||||||
wp = str(WALL_PATH)
|
wp = str(WALL_PATH)
|
||||||
ctx = build_template_context(
|
ctx = build_template_context(
|
||||||
|
|||||||
Reference in New Issue
Block a user