From dd49198cf73b22be987edb8f383fdcb0306ef70d Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Tue, 19 May 2026 23:53:09 +0200 Subject: [PATCH 01/12] prettier and eslint ignore valid syntax for qml specific syntax. Clippy lint resolved in .rs. unused py files commented to be ignored by ruff --- .gitea/workflows/format-js.yml | 36 ++--- .gitea/workflows/lint-js.yml | 50 +++---- .gitea/workflows/lint-python.yml | 38 +++--- .gitea/workflows/lint-rust.yml | 52 ++++---- .prettierignore | 2 + cli/src/zshell/subcommands/preset.py | 22 ++-- cli/src/zshell/subcommands/record.py | 28 ++-- eslint.config.js | 22 ++-- scripts/levendist.js | 190 +++++++++++++-------------- zshell-img-tools/src/effects.rs | 24 ++-- 10 files changed, 240 insertions(+), 224 deletions(-) create mode 100644 .prettierignore diff --git a/.gitea/workflows/format-js.yml b/.gitea/workflows/format-js.yml index d07d9ea..4e6bdc2 100644 --- a/.gitea/workflows/format-js.yml +++ b/.gitea/workflows/format-js.yml @@ -1,26 +1,26 @@ name: Format (JS/TS) on: - pull_request: + pull_request: jobs: - format: - runs-on: alpine - container: node:20-alpine + format: + runs-on: alpine + container: node:20-alpine - steps: - - name: Checkout - uses: actions/checkout@v4 + steps: + - name: Checkout + uses: actions/checkout@v4 - - name: Install tools - run: | - apk add --no-cache \ - git + - name: Install tools + run: | + apk add --no-cache \ + git - - name: Prettier - run: | - if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then - npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .gitignore - else - echo "No JS/TS files found" - fi + - name: Prettier + run: | + if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then + npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .gitignore + else + echo "No JS/TS files found" + fi diff --git a/.gitea/workflows/lint-js.yml b/.gitea/workflows/lint-js.yml index 93cce6c..0ef8f3f 100644 --- a/.gitea/workflows/lint-js.yml +++ b/.gitea/workflows/lint-js.yml @@ -1,33 +1,33 @@ name: Lint (JS/TS) on: - pull_request: + pull_request: jobs: - lint: - runs-on: alpine - container: node:20-alpine + lint: + runs-on: alpine + container: node:20-alpine - steps: - - name: Checkout - uses: actions/checkout@v4 + steps: + - name: Checkout + uses: actions/checkout@v4 - - name: Install tools - run: | - apk add --no-cache \ - git + - name: Install tools + run: | + apk add --no-cache \ + git - - name: ESLint - run: | - if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then - if [ -f package.json ]; then - npm install --no-audit --no-fund - fi - if [ -f eslint.config.js ] || [ -f eslint.config.mjs ] || [ -f eslint.config.cjs ] || [ -f .eslintrc ] || [ -f .eslintrc.js ] || [ -f .eslintrc.cjs ] || [ -f .eslintrc.json ] || [ -f .eslintrc.yaml ] || [ -f .eslintrc.yml ]; then - npx --yes eslint . - else - echo "No eslint config found" - fi - else - echo "No JS/TS files found" - fi + - name: ESLint + run: | + if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then + if [ -f package.json ]; then + npm install --no-audit --no-fund + fi + if [ -f eslint.config.js ] || [ -f eslint.config.mjs ] || [ -f eslint.config.cjs ] || [ -f .eslintrc ] || [ -f .eslintrc.js ] || [ -f .eslintrc.cjs ] || [ -f .eslintrc.json ] || [ -f .eslintrc.yaml ] || [ -f .eslintrc.yml ]; then + npx --yes eslint . + else + echo "No eslint config found" + fi + else + echo "No JS/TS files found" + fi diff --git a/.gitea/workflows/lint-python.yml b/.gitea/workflows/lint-python.yml index c029d82..e1068f4 100644 --- a/.gitea/workflows/lint-python.yml +++ b/.gitea/workflows/lint-python.yml @@ -1,27 +1,27 @@ name: Lint (Python) on: - pull_request: + pull_request: jobs: - lint: - runs-on: alpine - container: node:20-alpine + lint: + runs-on: alpine + container: node:20-alpine - steps: - - name: Checkout - uses: actions/checkout@v4 + steps: + - name: Checkout + uses: actions/checkout@v4 - - name: Install tools - run: | - apk add --no-cache \ - git \ - python3 \ - py3-pip + - name: Install tools + run: | + apk add --no-cache \ + git \ + python3 \ + py3-pip - - name: Ruff - run: | - python3 -m venv .venv - . .venv/bin/activate - pip install --no-cache-dir ruff - ruff check . + - name: Ruff + run: | + python3 -m venv .venv + . .venv/bin/activate + pip install --no-cache-dir ruff + ruff check . diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml index 54e3301..61eecc2 100644 --- a/.gitea/workflows/lint-rust.yml +++ b/.gitea/workflows/lint-rust.yml @@ -1,34 +1,34 @@ name: Lint (Rust) on: - pull_request: + pull_request: jobs: - lint: - runs-on: alpine - container: node:20-alpine + lint: + runs-on: alpine + container: node:20-alpine - steps: - - name: Checkout - uses: actions/checkout@v4 + steps: + - name: Checkout + uses: actions/checkout@v4 - - name: Install tools - run: | - apk add --no-cache \ - git \ - cargo \ - rust \ - rust-clippy + - name: Install tools + run: | + apk add --no-cache \ + git \ + cargo \ + rust \ + rust-clippy - - name: Clippy - run: | - if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then - find . -name "Cargo.toml" -print0 | while IFS= read -r -d '' manifest; do - cargo clippy --manifest-path "$manifest" -- -D warnings - done - elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then - echo "Rust files found but no Cargo.toml" - exit 1 - else - echo "No Rust project found" - fi + - name: Clippy + run: | + if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then + find . -name "Cargo.toml" -print0 | while IFS= read -r -d '' manifest; do + cargo clippy --manifest-path "$manifest" -- -D warnings + done + elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then + echo "Rust files found but no Cargo.toml" + exit 1 + else + echo "No Rust project found" + fi diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5eaa6f3 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +scripts/fzf.js +scripts/fuzzysort.js diff --git a/cli/src/zshell/subcommands/preset.py b/cli/src/zshell/subcommands/preset.py index ee685b3..c457d92 100644 --- a/cli/src/zshell/subcommands/preset.py +++ b/cli/src/zshell/subcommands/preset.py @@ -1,11 +1,13 @@ -import json -import typer -from zshell.assets.schemes.catppuccin import catppuccin +# import json +# import typer +# from zshell.assets.schemes.catppuccin import catppuccin +# +# app = typer.Typer() +# +# SCHEMES = catppuccin.variants.flavors +# +# +# @app.command() +# def set(): -app = typer.Typer() - -SCHEMES = catppuccin.variants.flavors - - -@app.command() -def set(): +# TODO: Currently unsused diff --git a/cli/src/zshell/subcommands/record.py b/cli/src/zshell/subcommands/record.py index f513869..328e2bf 100644 --- a/cli/src/zshell/subcommands/record.py +++ b/cli/src/zshell/subcommands/record.py @@ -1,14 +1,16 @@ -import typer -import subprocess +# import typer +# import subprocess +# +# from typing import Optional +# +# app = typer.Typer() +# +# RECORDER = "gpu-screen-recorder" +# HOME = str(os.getenv("HOME")) +# CONFIG = Path(HOME + "/.config/zshell/config.json") +# +# +# @app.command() +# def start(): -from typing import Optional - -app = typer.Typer() - -RECORDER = "gpu-screen-recorder" -HOME = str(os.getenv("HOME")) -CONFIG = Path(HOME + "/.config/zshell/config.json") - - -@app.command() -def start(): +# TODO: Currently unused diff --git a/eslint.config.js b/eslint.config.js index e54c60b..2a25987 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,14 +1,16 @@ export default [ - { - files: ["**/*.{js,jsx,ts,tsx,mjs,cjs}"], - languageOptions: { - ecmaVersion: 2021, - sourceType: "module" + { + ignores: ["scripts/fzf.js", "scripts/fuzzysort.js"], }, - linterOptions: { - reportUnusedDisableDirectives: true + { + files: ["**/*.{js,jsx,ts,tsx,mjs,cjs}"], + languageOptions: { + ecmaVersion: 2021, + sourceType: "module", + }, + linterOptions: { + reportUnusedDisableDirectives: true, + }, + rules: {}, }, - rules: { - } - } ]; diff --git a/scripts/levendist.js b/scripts/levendist.js index 332ed09..d4b408c 100644 --- a/scripts/levendist.js +++ b/scripts/levendist.js @@ -3,141 +3,141 @@ // Translated to Js from Cython with an LLM and reviewed function min3(a, b, c) { - return a < b && a < c ? a : b < c ? b : c; + return a < b && a < c ? a : b < c ? b : c; } function max3(a, b, c) { - return a > b && a > c ? a : b > c ? b : c; + return a > b && a > c ? a : b > c ? b : c; } function min2(a, b) { - return a < b ? a : b; + return a < b ? a : b; } function max2(a, b) { - return a > b ? a : b; + return a > b ? a : b; } function levenshteinDistance(s1, s2) { - let len1 = s1.length; - let len2 = s2.length; + let len1 = s1.length; + let len2 = s2.length; - if (len1 === 0) return len2; - if (len2 === 0) return len1; + if (len1 === 0) return len2; + if (len2 === 0) return len1; - if (len2 > len1) { - [s1, s2] = [s2, s1]; - [len1, len2] = [len2, len1]; - } - - let prev = new Array(len2 + 1); - let curr = new Array(len2 + 1); - - for (let j = 0; j <= len2; j++) { - prev[j] = j; - } - - for (let i = 1; i <= len1; i++) { - curr[0] = i; - for (let j = 1; j <= len2; j++) { - let cost = s1[i - 1] === s2[j - 1] ? 0 : 1; - curr[j] = min3(prev[j] + 1, curr[j - 1] + 1, prev[j - 1] + cost); + if (len2 > len1) { + [s1, s2] = [s2, s1]; + [len1, len2] = [len2, len1]; } - [prev, curr] = [curr, prev]; - } - return prev[len2]; + let prev = new Array(len2 + 1); + let curr = new Array(len2 + 1); + + for (let j = 0; j <= len2; j++) { + prev[j] = j; + } + + for (let i = 1; i <= len1; i++) { + curr[0] = i; + for (let j = 1; j <= len2; j++) { + let cost = s1[i - 1] === s2[j - 1] ? 0 : 1; + curr[j] = min3(prev[j] + 1, curr[j - 1] + 1, prev[j - 1] + cost); + } + [prev, curr] = [curr, prev]; + } + + return prev[len2]; } function partialRatio(shortS, longS) { - let lenS = shortS.length; - let lenL = longS.length; - let best = 0.0; + let lenS = shortS.length; + let lenL = longS.length; + let best = 0.0; - if (lenS === 0) return 1.0; + if (lenS === 0) return 1.0; - for (let i = 0; i <= lenL - lenS; i++) { - let sub = longS.slice(i, i + lenS); - let dist = levenshteinDistance(shortS, sub); - let score = 1.0 - dist / lenS; - if (score > best) best = score; - } + for (let i = 0; i <= lenL - lenS; i++) { + let sub = longS.slice(i, i + lenS); + let dist = levenshteinDistance(shortS, sub); + let score = 1.0 - dist / lenS; + if (score > best) best = score; + } - return best; + return best; } function computeScore(s1, s2) { - if (s1 === s2) return 1.0; + if (s1 === s2) return 1.0; - let dist = levenshteinDistance(s1, s2); - let maxLen = max2(s1.length, s2.length); - if (maxLen === 0) return 1.0; + let dist = levenshteinDistance(s1, s2); + let maxLen = max2(s1.length, s2.length); + if (maxLen === 0) return 1.0; - let full = 1.0 - dist / maxLen; - let part = - s1.length < s2.length ? partialRatio(s1, s2) : partialRatio(s2, s1); + let full = 1.0 - dist / maxLen; + let part = + s1.length < s2.length ? partialRatio(s1, s2) : partialRatio(s2, s1); - let score = 0.85 * full + 0.15 * part; + let score = 0.85 * full + 0.15 * part; - if (s1 && s2 && s1[0] !== s2[0]) { - score -= 0.05; - } - - let lenDiff = Math.abs(s1.length - s2.length); - if (lenDiff >= 3) { - score -= (0.05 * lenDiff) / maxLen; - } - - let commonPrefixLen = 0; - let minLen = min2(s1.length, s2.length); - for (let i = 0; i < minLen; i++) { - if (s1[i] === s2[i]) { - commonPrefixLen++; - } else { - break; + if (s1 && s2 && s1[0] !== s2[0]) { + score -= 0.05; } - } - score += 0.02 * commonPrefixLen; - if (s1.includes(s2) || s2.includes(s1)) { - score += 0.06; - } + let lenDiff = Math.abs(s1.length - s2.length); + if (lenDiff >= 3) { + score -= (0.05 * lenDiff) / maxLen; + } - return Math.max(0.0, Math.min(1.0, score)); + let commonPrefixLen = 0; + let minLen = min2(s1.length, s2.length); + for (let i = 0; i < minLen; i++) { + if (s1[i] === s2[i]) { + commonPrefixLen++; + } else { + break; + } + } + score += 0.02 * commonPrefixLen; + + if (s1.includes(s2) || s2.includes(s1)) { + score += 0.06; + } + + return Math.max(0.0, Math.min(1.0, score)); } function computeTextMatchScore(s1, s2) { - if (s1 === s2) return 1.0; + if (s1 === s2) return 1.0; - let dist = levenshteinDistance(s1, s2); - let maxLen = max2(s1.length, s2.length); - if (maxLen === 0) return 1.0; + let dist = levenshteinDistance(s1, s2); + let maxLen = max2(s1.length, s2.length); + if (maxLen === 0) return 1.0; - let full = 1.0 - dist / maxLen; - let part = - s1.length < s2.length ? partialRatio(s1, s2) : partialRatio(s2, s1); + let full = 1.0 - dist / maxLen; + let part = + s1.length < s2.length ? partialRatio(s1, s2) : partialRatio(s2, s1); - let score = 0.4 * full + 0.6 * part; + let score = 0.4 * full + 0.6 * part; - let lenDiff = Math.abs(s1.length - s2.length); - if (lenDiff >= 10) { - score -= (0.02 * lenDiff) / maxLen; - } - - let commonPrefixLen = 0; - let minLen = min2(s1.length, s2.length); - for (let i = 0; i < minLen; i++) { - if (s1[i] === s2[i]) { - commonPrefixLen++; - } else { - break; + let lenDiff = Math.abs(s1.length - s2.length); + if (lenDiff >= 10) { + score -= (0.02 * lenDiff) / maxLen; } - } - score += 0.01 * commonPrefixLen; - if (s1.includes(s2) || s2.includes(s1)) { - score += 0.2; - } + let commonPrefixLen = 0; + let minLen = min2(s1.length, s2.length); + for (let i = 0; i < minLen; i++) { + if (s1[i] === s2[i]) { + commonPrefixLen++; + } else { + break; + } + } + score += 0.01 * commonPrefixLen; - return Math.max(0.0, Math.min(1.0, score)); + if (s1.includes(s2) || s2.includes(s1)) { + score += 0.2; + } + + return Math.max(0.0, Math.min(1.0, score)); } diff --git a/zshell-img-tools/src/effects.rs b/zshell-img-tools/src/effects.rs index a7c1cdc..f79726f 100644 --- a/zshell-img-tools/src/effects.rs +++ b/zshell-img-tools/src/effects.rs @@ -39,8 +39,10 @@ pub fn apply_rounded_corners(img: RgbaImage, radius: f32) -> RgbaImage { ); let mut pixmap = rgba_image_to_pixmap(&img); - let mut dst_paint = PixmapPaint::default(); - dst_paint.blend_mode = BlendMode::DestinationIn; + let dst_paint = PixmapPaint { + blend_mode: BlendMode::DestinationIn, + ..Default::default() + }; pixmap.draw_pixmap(0, 0, mask.as_ref(), &dst_paint, Transform::identity(), None); pixmap_to_rgba_image(pixmap) } @@ -69,8 +71,10 @@ pub fn apply_drop_shadow( let shadow_x = (extra_left as f32 + offset_x) as i32; let shadow_y = (extra_top as f32 + offset_y) as i32; - let mut sp = PixmapPaint::default(); - sp.blend_mode = BlendMode::Source; + let sp = PixmapPaint { + blend_mode: BlendMode::Source, + ..Default::default() + }; shadow_pixmap.draw_pixmap( shadow_x, shadow_y, @@ -87,8 +91,10 @@ pub fn apply_drop_shadow( let blurred_pixmap = rgba_image_to_pixmap(&blurred); let mut canvas = Pixmap::new(canvas_w, canvas_h).expect("canvas pixmap"); - let mut p = PixmapPaint::default(); - p.blend_mode = BlendMode::Source; + let p = PixmapPaint { + blend_mode: BlendMode::Source, + ..Default::default() + }; canvas.draw_pixmap( 0, 0, @@ -98,8 +104,10 @@ pub fn apply_drop_shadow( None, ); - let mut p2 = PixmapPaint::default(); - p2.blend_mode = BlendMode::SourceOver; + let p2 = PixmapPaint { + blend_mode: BlendMode::SourceOver, + ..Default::default() + }; canvas.draw_pixmap( extra_left as i32, extra_top as i32, From 902863e5ba0591fd04b40f77fe5d3cf5d881ae6f Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Tue, 19 May 2026 23:57:11 +0200 Subject: [PATCH 02/12] adjusted workflows -> merge of lint/formatter per lang --- .gitea/workflows/format-js.yml | 26 -------------------------- .gitea/workflows/lint-js.yml | 12 ++++++++++-- .gitea/workflows/lint-python.yml | 16 +++++++++++----- .gitea/workflows/lint-rust.yml | 17 +++++++++++++++-- 4 files changed, 36 insertions(+), 35 deletions(-) delete mode 100644 .gitea/workflows/format-js.yml diff --git a/.gitea/workflows/format-js.yml b/.gitea/workflows/format-js.yml deleted file mode 100644 index 4e6bdc2..0000000 --- a/.gitea/workflows/format-js.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Format (JS/TS) - -on: - pull_request: - -jobs: - format: - runs-on: alpine - container: node:20-alpine - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install tools - run: | - apk add --no-cache \ - git - - - name: Prettier - run: | - if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then - npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .gitignore - else - echo "No JS/TS files found" - fi diff --git a/.gitea/workflows/lint-js.yml b/.gitea/workflows/lint-js.yml index 0ef8f3f..4f811df 100644 --- a/.gitea/workflows/lint-js.yml +++ b/.gitea/workflows/lint-js.yml @@ -1,10 +1,10 @@ -name: Lint (JS/TS) +name: Lint & Format (JS/TS) on: pull_request: jobs: - lint: + lint-format: runs-on: alpine container: node:20-alpine @@ -17,6 +17,14 @@ jobs: apk add --no-cache \ git + - name: Prettier + run: | + if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then + npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .gitignore + else + echo "No JS/TS files found" + fi + - name: ESLint run: | if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then diff --git a/.gitea/workflows/lint-python.yml b/.gitea/workflows/lint-python.yml index e1068f4..eb0220c 100644 --- a/.gitea/workflows/lint-python.yml +++ b/.gitea/workflows/lint-python.yml @@ -1,10 +1,10 @@ -name: Lint (Python) +name: Lint & Format (Python) on: pull_request: jobs: - lint: + lint-format: runs-on: alpine container: node:20-alpine @@ -18,10 +18,16 @@ jobs: git \ python3 \ py3-pip - - - name: Ruff - run: | python3 -m venv .venv . .venv/bin/activate pip install --no-cache-dir ruff + + - name: Format check + run: | + . .venv/bin/activate + ruff format --check . + + - name: Lint + run: | + . .venv/bin/activate ruff check . diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml index 61eecc2..65c9f8b 100644 --- a/.gitea/workflows/lint-rust.yml +++ b/.gitea/workflows/lint-rust.yml @@ -1,10 +1,10 @@ -name: Lint (Rust) +name: Lint & Format (Rust) on: pull_request: jobs: - lint: + lint-format: runs-on: alpine container: node:20-alpine @@ -20,6 +20,19 @@ jobs: rust \ rust-clippy + - name: Format check + run: | + if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then + find . -name "Cargo.toml" -print0 | while IFS= read -r -d '' manifest; do + cargo fmt --manifest-path "$manifest" --check + done + elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then + echo "Rust files found but no Cargo.toml" + exit 1 + else + echo "No Rust project found" + fi + - name: Clippy run: | if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then From ca3a288eabdc47501f7b6c9f182778af405aac72 Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Wed, 20 May 2026 00:02:14 +0200 Subject: [PATCH 03/12] minor changes to workflows to prevent preemptive exits/failures --- .gitea/workflows/lint-js.yml | 3 +- .gitea/workflows/lint-python.yml | 1 + .gitea/workflows/lint-rust.yml | 2 + .prettierignore | 1 + .../assets/schemes/catppuccin/catppuccin.py | 174 +++++++++--------- cli/src/zshell/subcommands/scheme.py | 60 +++--- cli/src/zshell/subcommands/screenshot.py | 6 +- cli/src/zshell/subcommands/shell.py | 3 +- cli/src/zshell/subcommands/wallpaper.py | 25 ++- 9 files changed, 133 insertions(+), 142 deletions(-) diff --git a/.gitea/workflows/lint-js.yml b/.gitea/workflows/lint-js.yml index 4f811df..b126cfa 100644 --- a/.gitea/workflows/lint-js.yml +++ b/.gitea/workflows/lint-js.yml @@ -18,9 +18,10 @@ jobs: git - name: Prettier + continue-on-error: true run: | if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then - npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .gitignore + npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .prettierignore else echo "No JS/TS files found" fi diff --git a/.gitea/workflows/lint-python.yml b/.gitea/workflows/lint-python.yml index eb0220c..1838f1f 100644 --- a/.gitea/workflows/lint-python.yml +++ b/.gitea/workflows/lint-python.yml @@ -23,6 +23,7 @@ jobs: pip install --no-cache-dir ruff - name: Format check + continue-on-error: true run: | . .venv/bin/activate ruff format --check . diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml index 65c9f8b..291f8a6 100644 --- a/.gitea/workflows/lint-rust.yml +++ b/.gitea/workflows/lint-rust.yml @@ -18,9 +18,11 @@ jobs: git \ cargo \ rust \ + rustfmt \ rust-clippy - name: Format check + continue-on-error: true run: | if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then find . -name "Cargo.toml" -print0 | while IFS= read -r -d '' manifest; do diff --git a/.prettierignore b/.prettierignore index 5eaa6f3..b1e8d68 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,3 @@ +.venv/ scripts/fzf.js scripts/fuzzysort.js diff --git a/cli/src/zshell/assets/schemes/catppuccin/catppuccin.py b/cli/src/zshell/assets/schemes/catppuccin/catppuccin.py index 78a6f8b..e9e1832 100644 --- a/cli/src/zshell/assets/schemes/catppuccin/catppuccin.py +++ b/cli/src/zshell/assets/schemes/catppuccin/catppuccin.py @@ -9,14 +9,8 @@ _data = { "variants": { "type": "multi", "defaults": { - "dark": { - "m3flavor": "mocha", - "m3accent": "mauve" - }, - "light": { - "m3flavor": "latte", - "m3accent": "mauve" - } + "dark": {"m3flavor": "mocha", "m3accent": "mauve"}, + "light": {"m3flavor": "latte", "m3accent": "mauve"}, }, "flavors": [ { @@ -35,8 +29,8 @@ _data = { "m3surfaceContainerHighest": "#dce0e8", "m3error": "#d20f39", "m3warning": "#fe640b", - "m3info": "#1e66f5" - } + "m3info": "#1e66f5", + }, }, { "id": "frappe", @@ -54,8 +48,8 @@ _data = { "m3surfaceContainerHighest": "#232634", "m3error": "#e78284", "m3warning": "#ef9f76", - "m3info": "#8caaee" - } + "m3info": "#8caaee", + }, }, { "id": "macchiato", @@ -73,8 +67,8 @@ _data = { "m3surfaceContainerHighest": "#181926", "m3error": "#ed8796", "m3warning": "#f5a97f", - "m3info": "#8aadf4" - } + "m3info": "#8aadf4", + }, }, { "id": "mocha", @@ -92,9 +86,9 @@ _data = { "m3surfaceContainerHighest": "#11111b", "m3error": "#f38ba8", "m3warning": "#fab387", - "m3info": "#89b4fa" - } - } + "m3info": "#89b4fa", + }, + }, ], "accents": [ { @@ -105,29 +99,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#e1a99d", "m3secondary": "#d8c7c4", - "m3surfaceTint": "#e1a99d" + "m3surfaceTint": "#e1a99d", }, "frappe": { "m3primary": "#f2d5cf", "m3primaryText": "#303446", "m3primaryContainer": "#b8a5a6", "m3secondary": "#a2748b", - "m3surfaceTint": "#b8a5a6" + "m3surfaceTint": "#b8a5a6", }, "macchiato": { "m3primary": "#f4dbd6", "m3primaryText": "#24273a", "m3primaryContainer": "#b6a6a7", "m3secondary": "#9f6f8d", - "m3surfaceTint": "#b6a6a7" + "m3surfaceTint": "#b6a6a7", }, "mocha": { "m3primary": "#f5e0dc", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#b5a6a8", "m3secondary": "#9d6d87", - "m3surfaceTint": "#b5a6a8" - } + "m3surfaceTint": "#b5a6a8", + }, }, { "id": "flamingo", @@ -137,29 +131,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#e29c9d", "m3secondary": "#d7c3c4", - "m3surfaceTint": "#e29c9d" + "m3surfaceTint": "#e29c9d", }, "frappe": { "m3primary": "#eebebe", "m3primaryText": "#303446", "m3primaryContainer": "#b5949a", "m3secondary": "#9d6b80", - "m3surfaceTint": "#b5949a" + "m3surfaceTint": "#b5949a", }, "macchiato": { "m3primary": "#f0c6c6", "m3primaryText": "#24273a", "m3primaryContainer": "#b3979c", "m3secondary": "#996780", - "m3surfaceTint": "#b3979c" + "m3surfaceTint": "#b3979c", }, "mocha": { "m3primary": "#f2cdcd", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#b3999e", "m3secondary": "#98667c", - "m3surfaceTint": "#b3999e" - } + "m3surfaceTint": "#b3999e", + }, }, { "id": "pink", @@ -169,29 +163,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#eb9bd7", "m3secondary": "#d9c7d5", - "m3surfaceTint": "#eb9bd7" + "m3surfaceTint": "#eb9bd7", }, "frappe": { "m3primary": "#f4b8e4", "m3primaryText": "#303446", "m3primaryContainer": "#b990b5", "m3secondary": "#996e9e", - "m3surfaceTint": "#b990b5" + "m3surfaceTint": "#b990b5", }, "macchiato": { "m3primary": "#f5bde6", "m3primaryText": "#24273a", "m3primaryContainer": "#b791b2", "m3secondary": "#95689a", - "m3surfaceTint": "#b791b2" + "m3surfaceTint": "#b791b2", }, "mocha": { "m3primary": "#f5c2e7", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#b591b0", "m3secondary": "#966597", - "m3surfaceTint": "#b591b0" - } + "m3surfaceTint": "#b591b0", + }, }, { "id": "mauve", @@ -201,29 +195,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#a670f1", "m3secondary": "#c2b8d0", - "m3surfaceTint": "#a670f1" + "m3surfaceTint": "#a670f1", }, "frappe": { "m3primary": "#ca9ee6", "m3primaryText": "#303446", "m3primaryContainer": "#9c7eb6", "m3secondary": "#7d6799", - "m3surfaceTint": "#9c7eb6" + "m3surfaceTint": "#9c7eb6", }, "macchiato": { "m3primary": "#c6a0f6", "m3primaryText": "#24273a", "m3primaryContainer": "#967cbe", "m3secondary": "#766597", - "m3surfaceTint": "#967cbe" + "m3surfaceTint": "#967cbe", }, "mocha": { "m3primary": "#cba6f7", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#977ebb", "m3secondary": "#756294", - "m3surfaceTint": "#977ebb" - } + "m3surfaceTint": "#977ebb", + }, }, { "id": "red", @@ -233,29 +227,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#da5371", "m3secondary": "#c0a0a8", - "m3surfaceTint": "#da5371" + "m3surfaceTint": "#da5371", }, "frappe": { "m3primary": "#e78284", "m3primaryText": "#303446", "m3primaryContainer": "#b06a72", "m3secondary": "#8b5d66", - "m3surfaceTint": "#b06a72" + "m3surfaceTint": "#b06a72", }, "macchiato": { "m3primary": "#ed8796", "m3primaryText": "#24273a", "m3primaryContainer": "#b16b7a", "m3secondary": "#865a69", - "m3surfaceTint": "#b16b7a" + "m3surfaceTint": "#b16b7a", }, "mocha": { "m3primary": "#f38ba8", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#b46b84", "m3secondary": "#85596b", - "m3surfaceTint": "#b46b84" - } + "m3surfaceTint": "#b46b84", + }, }, { "id": "maroon", @@ -265,29 +259,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#e87883", "m3secondary": "#cfb7ba", - "m3surfaceTint": "#e87883" + "m3surfaceTint": "#e87883", }, "frappe": { "m3primary": "#ea999c", "m3primaryText": "#303446", "m3primaryContainer": "#b27a83", "m3secondary": "#92626f", - "m3surfaceTint": "#b27a83" + "m3surfaceTint": "#b27a83", }, "macchiato": { "m3primary": "#ee99a0", "m3primaryText": "#24273a", "m3primaryContainer": "#b27781", "m3secondary": "#8c5e6c", - "m3surfaceTint": "#b27781" + "m3surfaceTint": "#b27781", }, "mocha": { "m3primary": "#eba0ac", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#ae7987", "m3secondary": "#895b6c", - "m3surfaceTint": "#ae7987" - } + "m3surfaceTint": "#ae7987", + }, }, { "id": "peach", @@ -297,29 +291,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#f98e51", "m3secondary": "#c9b7ad", - "m3surfaceTint": "#f98e51" + "m3surfaceTint": "#f98e51", }, "frappe": { "m3primary": "#ef9f76", "m3primaryText": "#303446", "m3primaryContainer": "#b67f68", "m3secondary": "#8f6a5f", - "m3surfaceTint": "#b67f68" + "m3surfaceTint": "#b67f68", }, "macchiato": { "m3primary": "#f5a97f", "m3primaryText": "#24273a", "m3primaryContainer": "#b7836a", "m3secondary": "#8c695e", - "m3surfaceTint": "#b7836a" + "m3surfaceTint": "#b7836a", }, "mocha": { "m3primary": "#fab387", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#b8876d", "m3secondary": "#8b6a5d", - "m3surfaceTint": "#b8876d" - } + "m3surfaceTint": "#b8876d", + }, }, { "id": "yellow", @@ -329,29 +323,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#e4ac5d", "m3secondary": "#c6baaa", - "m3surfaceTint": "#e4ac5d" + "m3surfaceTint": "#e4ac5d", }, "frappe": { "m3primary": "#e5c890", "m3primaryText": "#303446", "m3primaryContainer": "#af9b7a", "m3secondary": "#948062", - "m3surfaceTint": "#af9b7a" + "m3surfaceTint": "#af9b7a", }, "macchiato": { "m3primary": "#eed49f", "m3primaryText": "#24273a", "m3primaryContainer": "#b2a181", "m3secondary": "#947e62", - "m3surfaceTint": "#b2a181" + "m3surfaceTint": "#b2a181", }, "mocha": { "m3primary": "#f9e2af", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#b8a889", "m3secondary": "#978265", - "m3surfaceTint": "#b8a889" - } + "m3surfaceTint": "#b8a889", + }, }, { "id": "green", @@ -361,29 +355,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#74b867", "m3secondary": "#9fbd9b", - "m3surfaceTint": "#74b867" + "m3surfaceTint": "#74b867", }, "frappe": { "m3primary": "#a6d189", "m3primaryText": "#303446", "m3primaryContainer": "#83a275", "m3secondary": "#648e5e", - "m3surfaceTint": "#83a275" + "m3surfaceTint": "#83a275", }, "macchiato": { "m3primary": "#a6da95", "m3primaryText": "#24273a", "m3primaryContainer": "#80a57a", "m3secondary": "#5c8a61", - "m3surfaceTint": "#80a57a" + "m3surfaceTint": "#80a57a", }, "mocha": { "m3primary": "#a6e3a1", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#7ea87f", "m3secondary": "#5b8964", - "m3surfaceTint": "#7ea87f" - } + "m3surfaceTint": "#7ea87f", + }, }, { "id": "teal", @@ -393,29 +387,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#57aeb4", "m3secondary": "#93b4b7", - "m3surfaceTint": "#57aeb4" + "m3surfaceTint": "#57aeb4", }, "frappe": { "m3primary": "#81c8be", "m3primaryText": "#303446", "m3primaryContainer": "#699b9a", "m3secondary": "#588084", - "m3surfaceTint": "#699b9a" + "m3surfaceTint": "#699b9a", }, "macchiato": { "m3primary": "#8bd5ca", "m3primaryText": "#24273a", "m3primaryContainer": "#6da29f", "m3secondary": "#577e83", - "m3surfaceTint": "#6da29f" + "m3surfaceTint": "#6da29f", }, "mocha": { "m3primary": "#94e2d5", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#71a8a4", "m3secondary": "#588284", - "m3surfaceTint": "#71a8a4" - } + "m3surfaceTint": "#71a8a4", + }, }, { "id": "sky", @@ -425,29 +419,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#4abcea", "m3secondary": "#a4b9c2", - "m3surfaceTint": "#4abcea" + "m3surfaceTint": "#4abcea", }, "frappe": { "m3primary": "#99d1db", "m3primaryText": "#303446", "m3primaryContainer": "#79a2af", "m3secondary": "#628494", - "m3surfaceTint": "#79a2af" + "m3surfaceTint": "#79a2af", }, "macchiato": { "m3primary": "#91d7e3", "m3primaryText": "#24273a", "m3primaryContainer": "#71a3b0", "m3secondary": "#5e7e8c", - "m3surfaceTint": "#71a3b0" + "m3surfaceTint": "#71a3b0", }, "mocha": { "m3primary": "#89dceb", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#69a3b3", "m3secondary": "#5a7b88", - "m3surfaceTint": "#69a3b3" - } + "m3surfaceTint": "#69a3b3", + }, }, { "id": "sapphire", @@ -457,29 +451,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#5db8c8", "m3secondary": "#9eb9be", - "m3surfaceTint": "#5db8c8" + "m3surfaceTint": "#5db8c8", }, "frappe": { "m3primary": "#85c1dc", "m3primaryText": "#303446", "m3primaryContainer": "#6b96af", "m3secondary": "#5e7b8e", - "m3surfaceTint": "#6b96af" + "m3surfaceTint": "#6b96af", }, "macchiato": { "m3primary": "#7dc4e4", "m3primaryText": "#24273a", "m3primaryContainer": "#6396b1", "m3secondary": "#5a7486", - "m3surfaceTint": "#6396b1" + "m3surfaceTint": "#6396b1", }, "mocha": { "m3primary": "#74c7ec", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#5a95b4", "m3secondary": "#567080", - "m3surfaceTint": "#5a95b4" - } + "m3surfaceTint": "#5a95b4", + }, }, { "id": "blue", @@ -489,29 +483,29 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#5c90f5", "m3secondary": "#b1bacb", - "m3surfaceTint": "#5c90f5" + "m3surfaceTint": "#5c90f5", }, "frappe": { "m3primary": "#8caaee", "m3primaryText": "#303446", "m3primaryContainer": "#7086bc", "m3secondary": "#637195", - "m3surfaceTint": "#7086bc" + "m3surfaceTint": "#7086bc", }, "macchiato": { "m3primary": "#8aadf4", "m3primaryText": "#24273a", "m3primaryContainer": "#6c85bc", "m3secondary": "#5f6d8f", - "m3surfaceTint": "#6c85bc" + "m3surfaceTint": "#6c85bc", }, "mocha": { "m3primary": "#89b4fa", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#6987bd", "m3secondary": "#5d6c8b", - "m3surfaceTint": "#6987bd" - } + "m3surfaceTint": "#6987bd", + }, }, { "id": "lavender", @@ -521,30 +515,30 @@ _data = { "m3primaryText": "#eff1f5", "m3primaryContainer": "#97a7fb", "m3secondary": "#cdcfdd", - "m3surfaceTint": "#97a7fb" + "m3surfaceTint": "#97a7fb", }, "frappe": { "m3primary": "#babbf1", "m3primaryText": "#303446", "m3primaryContainer": "#9192be", "m3secondary": "#7175a1", - "m3surfaceTint": "#9192be" + "m3surfaceTint": "#9192be", }, "macchiato": { "m3primary": "#b7bdf8", "m3primaryText": "#24273a", "m3primaryContainer": "#8b91bf", "m3secondary": "#6b709d", - "m3surfaceTint": "#8b91bf" + "m3surfaceTint": "#8b91bf", }, "mocha": { "m3primary": "#b4befe", "m3primaryText": "#1e1e2e", "m3primaryContainer": "#878ec0", "m3secondary": "#676d99", - "m3surfaceTint": "#878ec0" - } - } - ] - } + "m3surfaceTint": "#878ec0", + }, + }, + ], + }, } diff --git a/cli/src/zshell/subcommands/scheme.py b/cli/src/zshell/subcommands/scheme.py index 32520f3..7f22479 100644 --- a/cli/src/zshell/subcommands/scheme.py +++ b/cli/src/zshell/subcommands/scheme.py @@ -23,64 +23,71 @@ app = typer.Typer() @app.command() def generate( # image inputs (optional - used for image mode) - image_path: Optional[Path] = typer.Option( - None, help="Path to source image. Required for image mode."), + image_path: Optional[Path] = typer.Option(None, help="Path to source image. Required for image mode."), scheme: Optional[str] = typer.Option( - None, help="Color scheme algorithm to use for image mode. Ignored in preset mode."), + None, help="Color scheme algorithm to use for image mode. Ignored in preset mode." + ), # preset inputs (optional - used for preset mode) preset: Optional[str] = typer.Option( - None, help="Name of a premade scheme in this format: :"), - mode: Optional[str] = typer.Option( - None, help="Mode of the preset scheme (dark or light)."), + None, help="Name of a premade scheme in this format: :" + ), + mode: Optional[str] = typer.Option(None, help="Mode of the preset scheme (dark or light)."), ): HOME = str(os.getenv("HOME")) OUTPUT = Path(HOME + "/.local/state/zshell/scheme.json") SEQ_STATE = Path(HOME + "/.local/state/zshell/sequences.txt") - THUMB_PATH = Path(HOME + - "/.cache/zshell/imagecache/thumbnail.jpg") - WALL_DIR_PATH = Path(HOME + - "/.local/state/zshell/wallpaper_path.json") + THUMB_PATH = Path(HOME + "/.cache/zshell/imagecache/thumbnail.jpg") + WALL_DIR_PATH = Path(HOME + "/.local/state/zshell/wallpaper_path.json") TEMPLATE_DIR = Path(HOME + "/.config/zshell/templates") WALL_PATH = Path() CONFIG = Path(HOME + "/.config/zshell/config.json") if preset is not None and image_path is not None: - raise typer.BadParameter( - "Use either --image-path or --preset, not both.") + raise typer.BadParameter("Use either --image-path or --preset, not both.") def get_scheme_class(scheme_name: str): match scheme_name: case "fruit-salad": from materialyoucolor.scheme.scheme_fruit_salad import SchemeFruitSalad + return SchemeFruitSalad case "expressive": from materialyoucolor.scheme.scheme_expressive import SchemeExpressive + return SchemeExpressive case "monochrome": from materialyoucolor.scheme.scheme_monochrome import SchemeMonochrome + return SchemeMonochrome case "rainbow": from materialyoucolor.scheme.scheme_rainbow import SchemeRainbow + return SchemeRainbow case "tonal-spot": from materialyoucolor.scheme.scheme_tonal_spot import SchemeTonalSpot + return SchemeTonalSpot case "neutral": from materialyoucolor.scheme.scheme_neutral import SchemeNeutral + return SchemeNeutral case "fidelity": from materialyoucolor.scheme.scheme_fidelity import SchemeFidelity + return SchemeFidelity case "content": from materialyoucolor.scheme.scheme_content import SchemeContent + return SchemeContent case "vibrant": from materialyoucolor.scheme.scheme_vibrant import SchemeVibrant + return SchemeVibrant case _: from materialyoucolor.scheme.scheme_fruit_salad import SchemeFruitSalad + return SchemeFruitSalad def hex_to_hct(hex_color: str) -> Hct: @@ -163,16 +170,11 @@ def generate( def harmonize(from_hct: Hct, to_hct: Hct, tone_boost: float) -> Hct: diff = difference_degrees(from_hct.hue, to_hct.hue) rotation = min(diff * 0.8, 100) - output_hue = sanitize_degrees_double( - from_hct.hue - + rotation * rotation_direction(from_hct.hue, to_hct.hue) - ) + output_hue = sanitize_degrees_double(from_hct.hue + rotation * rotation_direction(from_hct.hue, to_hct.hue)) tone = max(0.0, min(100.0, from_hct.tone * (1 + tone_boost))) return Hct.from_hct(output_hue, from_hct.chroma, tone) - def terminal_palette( - colors: dict[str, str], mode: str, variant: str - ) -> dict[str, str]: + def terminal_palette(colors: dict[str, str], mode: str, variant: str) -> dict[str, str]: light = mode.lower() == "light" key_hex = ( @@ -307,7 +309,7 @@ def generate( "seed": seed.to_int(), "flavor": flavor, "variant": variant, - "colors": colors + "colors": colors, } for k, v in colors.items(): @@ -349,7 +351,7 @@ def generate( def tmux_wrap_sequences(seq: str) -> str: ESC = "\x1b" - return f"{ESC}Ptmux;{seq.replace(ESC, ESC+ESC)}{ESC}\\" + return f"{ESC}Ptmux;{seq.replace(ESC, ESC + ESC)}{ESC}\\" def parse_output_directive(first_line: str) -> Optional[Path]: s = first_line.strip() @@ -406,8 +408,7 @@ def generate( template = env.from_string(body) text = template.render(**context) except Exception as e: - raise RuntimeError( - f"Template render failed for '{rel}': {e}") from e + raise RuntimeError(f"Template render failed for '{rel}': {e}") from e out_path.write_text(text, encoding="utf-8") @@ -435,18 +436,13 @@ def generate( try: return PRESETS[name].primary except KeyError: - raise typer.BadParameter( - f"Preset '{name}' not found. Available presets: {', '.join(PRESETS.keys())}") + raise typer.BadParameter(f"Preset '{name}' not found. Available presets: {', '.join(PRESETS.keys())}") def generate_color_scheme(seed: Hct, mode: str, scheme_class) -> dict[str, str]: is_dark = mode.lower() == "dark" - scheme = scheme_class( - seed, - is_dark, - 0.0 - ) + scheme = scheme_class(seed, is_dark, 0.0) color_dict = {} for color in vars(MaterialDynamicColors).keys(): @@ -499,7 +495,7 @@ def generate( "mode": effective_mode, "variant": scheme, "colors": colors, - "seed": seed.to_int() + "seed": seed.to_int(), } if TEMPLATE_DIR is not None: @@ -511,7 +507,7 @@ def generate( wallpaper_path=wp, name=name, flavor=flavor, - variant=scheme + variant=scheme, ) rendered = render_all_templates( diff --git a/cli/src/zshell/subcommands/screenshot.py b/cli/src/zshell/subcommands/screenshot.py index 8edcb7f..12acccf 100644 --- a/cli/src/zshell/subcommands/screenshot.py +++ b/cli/src/zshell/subcommands/screenshot.py @@ -8,11 +8,9 @@ app = typer.Typer() @app.command() def start(): - subprocess.run(args + ["ipc"] + ["call"] + - ["picker"] + ["open"], check=True) + subprocess.run(args + ["ipc"] + ["call"] + ["picker"] + ["open"], check=True) @app.command() def start_freeze(): - subprocess.run(args + ["ipc"] + ["call"] + - ["picker"] + ["openFreeze"], check=True) + subprocess.run(args + ["ipc"] + ["call"] + ["picker"] + ["openFreeze"], check=True) diff --git a/cli/src/zshell/subcommands/shell.py b/cli/src/zshell/subcommands/shell.py index 156e8d2..03514e9 100644 --- a/cli/src/zshell/subcommands/shell.py +++ b/cli/src/zshell/subcommands/shell.py @@ -33,5 +33,4 @@ def lock(): @app.command() def call(target: str, method: str, method_args: list[str] = typer.Argument(None)): - subprocess.run(args + ["ipc"] + ["call"] + [target] + - [method] + method_args, check=True) + subprocess.run(args + ["ipc"] + ["call"] + [target] + [method] + method_args, check=True) diff --git a/cli/src/zshell/subcommands/wallpaper.py b/cli/src/zshell/subcommands/wallpaper.py index 558fe69..b803b54 100644 --- a/cli/src/zshell/subcommands/wallpaper.py +++ b/cli/src/zshell/subcommands/wallpaper.py @@ -12,29 +12,28 @@ app = typer.Typer() @app.command() def set(wallpaper: Path): - subprocess.run(args + ["ipc"] + ["call"] + - ["wallpaper"] + ["set"] + [wallpaper], check=True) + subprocess.run(args + ["ipc"] + ["call"] + ["wallpaper"] + ["set"] + [wallpaper], check=True) @app.command() def lockscreen( - input_image: Annotated[ - Path, - typer.Option(), - ], - output_path: Annotated[ - Path, - typer.Option(), - ], - blur_amount: int = 20 + input_image: Annotated[ + Path, + typer.Option(), + ], + output_path: Annotated[ + Path, + typer.Option(), + ], + blur_amount: int = 20, ): img = Image.open(input_image) size = img.size - if (blur_amount == 0): + if blur_amount == 0: img.save(output_path, "PNG") return - if (size[0] < 3840 or size[1] < 2160): + if size[0] < 3840 or size[1] < 2160: img = img.resize((size[0] // 2, size[1] // 2), Image.NEAREST) else: img = img.resize((size[0] // 4, size[1] // 4), Image.NEAREST) From 794a26a3fe43f4b812d396db0d80faed11b2043b Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Wed, 20 May 2026 00:05:25 +0200 Subject: [PATCH 04/12] eslint workflow now prints a succes or fail message eslint is run succesfully or if it ran but failed --- .gitea/workflows/lint-js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/lint-js.yml b/.gitea/workflows/lint-js.yml index b126cfa..cadf581 100644 --- a/.gitea/workflows/lint-js.yml +++ b/.gitea/workflows/lint-js.yml @@ -33,7 +33,7 @@ jobs: npm install --no-audit --no-fund fi if [ -f eslint.config.js ] || [ -f eslint.config.mjs ] || [ -f eslint.config.cjs ] || [ -f .eslintrc ] || [ -f .eslintrc.js ] || [ -f .eslintrc.cjs ] || [ -f .eslintrc.json ] || [ -f .eslintrc.yaml ] || [ -f .eslintrc.yml ]; then - npx --yes eslint . + npx --yes eslint . && echo "ESLint passed" || echo "ESLint failed" else echo "No eslint config found" fi From c9d6b95ca51dae0996813c4266ca08d29295e01a Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Wed, 20 May 2026 00:06:30 +0200 Subject: [PATCH 05/12] main.rs formatted --- zshell-img-tools/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zshell-img-tools/src/main.rs b/zshell-img-tools/src/main.rs index b142628..73c8d30 100644 --- a/zshell-img-tools/src/main.rs +++ b/zshell-img-tools/src/main.rs @@ -1,7 +1,7 @@ mod config; mod effects; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use std::io::Write as _; use std::process::{Command, Stdio}; From a3d0ee18cb61cc36f8171e1267ce4ce9acb4a1c5 Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Wed, 20 May 2026 00:11:20 +0200 Subject: [PATCH 06/12] added cargo to be cached to avoid recompiling every time. Also added echo messages for more info --- .gitea/workflows/lint-rust.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml index 291f8a6..130b921 100644 --- a/.gitea/workflows/lint-rust.yml +++ b/.gitea/workflows/lint-rust.yml @@ -12,6 +12,17 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Cache cargo + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + - name: Install tools run: | apk add --no-cache \ @@ -25,8 +36,10 @@ jobs: continue-on-error: true run: | if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then - find . -name "Cargo.toml" -print0 | while IFS= read -r -d '' manifest; do - cargo fmt --manifest-path "$manifest" --check + for manifest in $(find . -name "Cargo.toml"); do + cargo fmt --manifest-path "$manifest" --check && \ + echo "$manifest: formatting OK" || \ + echo "$manifest: needs formatting" done elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then echo "Rust files found but no Cargo.toml" @@ -38,9 +51,13 @@ jobs: - name: Clippy run: | if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then - find . -name "Cargo.toml" -print0 | while IFS= read -r -d '' manifest; do - cargo clippy --manifest-path "$manifest" -- -D warnings + status=0 + for manifest in $(find . -name "Cargo.toml"); do + cargo clippy --manifest-path "$manifest" -- -D warnings && \ + echo "$manifest: Clippy passed" || \ + { echo "$manifest: Clippy failed"; status=1; } done + exit $status elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then echo "Rust files found but no Cargo.toml" exit 1 From d3f67658195ae28e50110d687c4a42326660f4dd Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Wed, 20 May 2026 00:19:46 +0200 Subject: [PATCH 07/12] changed github specific caching to forgejo's solution --- .gitea/workflows/lint-rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml index 130b921..ef2df47 100644 --- a/.gitea/workflows/lint-rust.yml +++ b/.gitea/workflows/lint-rust.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v4 - name: Cache cargo - uses: actions/cache@v4 + uses: https://data.forgejo.org/actions/cache@v4 with: path: | ~/.cargo/registry From a14ebe201650a4467a38b4bdae5a9ba6d91dffa7 Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Wed, 20 May 2026 00:26:50 +0200 Subject: [PATCH 08/12] wrong cache url --- .gitea/workflows/lint-rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml index ef2df47..aca982b 100644 --- a/.gitea/workflows/lint-rust.yml +++ b/.gitea/workflows/lint-rust.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v4 - name: Cache cargo - uses: https://data.forgejo.org/actions/cache@v4 + uses: https://code.forgejo.org/actions/cache@v4 with: path: | ~/.cargo/registry From 7276ee28dc942481c0fb8de7ef3ab53406250ce3 Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Wed, 20 May 2026 00:46:59 +0200 Subject: [PATCH 09/12] minor updates to rust workflow --- .gitea/workflows/lint-rust.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml index aca982b..5c5087f 100644 --- a/.gitea/workflows/lint-rust.yml +++ b/.gitea/workflows/lint-rust.yml @@ -8,6 +8,9 @@ jobs: runs-on: alpine container: node:20-alpine + env: + CARGO_INCREMENTAL: 0 + steps: - name: Checkout uses: actions/checkout@v4 @@ -53,7 +56,7 @@ jobs: if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then status=0 for manifest in $(find . -name "Cargo.toml"); do - cargo clippy --manifest-path "$manifest" -- -D warnings && \ + cargo clippy --manifest-path "$manifest" --all-targets --all-features -- -D warnings && \ echo "$manifest: Clippy passed" || \ { echo "$manifest: Clippy failed"; status=1; } done From 01b54ec5e1a85481ab268e2d243d54cb90216a4f Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Wed, 20 May 2026 00:59:41 +0200 Subject: [PATCH 10/12] use of newest node version available + attempt cache v3 vs v4 --- .gitea/workflows/lint-js.yml | 2 +- .gitea/workflows/lint-python.yml | 2 +- .gitea/workflows/lint-rust.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/lint-js.yml b/.gitea/workflows/lint-js.yml index cadf581..f7c9829 100644 --- a/.gitea/workflows/lint-js.yml +++ b/.gitea/workflows/lint-js.yml @@ -6,7 +6,7 @@ on: jobs: lint-format: runs-on: alpine - container: node:20-alpine + container: node:26-alpine steps: - name: Checkout diff --git a/.gitea/workflows/lint-python.yml b/.gitea/workflows/lint-python.yml index 1838f1f..1db6bd1 100644 --- a/.gitea/workflows/lint-python.yml +++ b/.gitea/workflows/lint-python.yml @@ -6,7 +6,7 @@ on: jobs: lint-format: runs-on: alpine - container: node:20-alpine + container: node:26-alpine steps: - name: Checkout diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml index 5c5087f..81b2aba 100644 --- a/.gitea/workflows/lint-rust.yml +++ b/.gitea/workflows/lint-rust.yml @@ -6,7 +6,7 @@ on: jobs: lint-format: runs-on: alpine - container: node:20-alpine + container: node:26-alpine env: CARGO_INCREMENTAL: 0 @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@v4 - name: Cache cargo - uses: https://code.forgejo.org/actions/cache@v4 + uses: https://code.forgejo.org/actions/cache@v3 with: path: | ~/.cargo/registry From c88aef216432a8849f9933841c70619b73ce8b49 Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Wed, 20 May 2026 01:03:51 +0200 Subject: [PATCH 11/12] removal of cache (for now) --- .gitea/workflows/lint-rust.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml index 81b2aba..44a4fcb 100644 --- a/.gitea/workflows/lint-rust.yml +++ b/.gitea/workflows/lint-rust.yml @@ -8,24 +8,10 @@ jobs: runs-on: alpine container: node:26-alpine - env: - CARGO_INCREMENTAL: 0 - steps: - name: Checkout uses: actions/checkout@v4 - - name: Cache cargo - uses: https://code.forgejo.org/actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - name: Install tools run: | apk add --no-cache \ From 053efb4aaf54e732239932b13cc99ae9e005c875 Mon Sep 17 00:00:00 2001 From: zach Date: Wed, 20 May 2026 05:23:56 +0200 Subject: [PATCH 12/12] reintroduce cargo caching --- .gitea/workflows/lint-rust.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml index 44a4fcb..dc01c1d 100644 --- a/.gitea/workflows/lint-rust.yml +++ b/.gitea/workflows/lint-rust.yml @@ -7,11 +7,28 @@ jobs: lint-format: runs-on: alpine container: node:26-alpine + env: + CARGO_HOME: ${{ github.workspace }}/.cargo steps: - name: Checkout uses: actions/checkout@v4 + - name: Cache cargo packages + uses: actions/cache@v4 + env: + cache-name: cache-cargo-packages + with: + path: | + .cargo/registry + .cargo/git + target + key: rust-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + rust-${{ runner.os }}-build-${{ env.cache-name }}- + rust-${{ runner.os }}-build- + rust- + - name: Install tools run: | apk add --no-cache \