diff options
| author | user <user@clank> | 2026-08-12 20:41:52 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-12 20:41:52 +0200 |
| commit | dd1c0b2abb3734177fde75e88607dbe16f6357e9 (patch) | |
| tree | 889d74783e877d18d563c0851fba41c217362293 | |
| parent | build: follow the rename through config, packaging and docs (diff) | |
| download | sl0ppi-dd1c0b2abb3734177fde75e88607dbe16f6357e9.tar.gz sl0ppi-dd1c0b2abb3734177fde75e88607dbe16f6357e9.tar.xz sl0ppi-dd1c0b2abb3734177fde75e88607dbe16f6357e9.zip | |
vendor(sl0pstatus): import zjstatus v0.24.0 tree
Squashed import of dj95/zjstatus at 74f36b4 ("chore: bump version to v0.24.0"),
the merge-base our fork was developed against.
Found by the phase-3 smoke test: installing the tarball into a throwaway HOME
and actually starting a session logged
failed to load plugin from disk:
'~/.config/zellij/plugins/zjstatus.wasm' (No such file or directory)
config/layouts/default.kdl replaces zellij's stock tab-bar + status-bar with a
zjstatus bar, so the status bar is load-bearing for the default layout -- and
the .wasm in the live config dir turned out to be a *custom build*, not the
upstream release. Dropping it as "a third-party blob no longer referenced" (see
the config snapshot commit) was wrong: it was referenced from the layouts, which
that commit did not check.
61 files changed, 9935 insertions, 0 deletions
diff --git a/sl0pstatus/.cargo/config.toml b/sl0pstatus/.cargo/config.toml new file mode 100644 index 0000000..c176991 --- /dev/null +++ b/sl0pstatus/.cargo/config.toml @@ -0,0 +1,5 @@ +[build] +target = "wasm32-wasip1" + +[target.wasm32-wasip1] +runner = ["wasmtime", "--dir", "./target::target", "--dir", "/tmp"] diff --git a/sl0pstatus/.envrc b/sl0pstatus/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/sl0pstatus/.envrc @@ -0,0 +1 @@ +use flake diff --git a/sl0pstatus/.github/ISSUE_TEMPLATE/bug_report.md b/sl0pstatus/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..f41a14a --- /dev/null +++ b/sl0pstatus/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,40 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Zellij version [e.g. v0.39.0] + - Version [e.g. v0.9.0] + +**Layout** + +How does the layout look like? Please copy it into a code block. + +```kdl +// layout goes here <-- +``` + +**Additional context** +Add any other context about the problem here. diff --git a/sl0pstatus/.github/ISSUE_TEMPLATE/feature_request.md b/sl0pstatus/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..59094e2 --- /dev/null +++ b/sl0pstatus/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/sl0pstatus/.github/ISSUE_TEMPLATE/other-issues.md b/sl0pstatus/.github/ISSUE_TEMPLATE/other-issues.md new file mode 100644 index 0000000..c7ff078 --- /dev/null +++ b/sl0pstatus/.github/ISSUE_TEMPLATE/other-issues.md @@ -0,0 +1,12 @@ +--- +name: Other issues +about: Describe this issue template's purpose here. +title: '' +labels: '' +assignees: '' + +--- + +**Description** + +Please describe as clear as possible how your issue looks like. Give examples and try to give as many valuable information as possible, such that another person without context is able to understand it. diff --git a/sl0pstatus/.github/dependabot.yml b/sl0pstatus/.github/dependabot.yml new file mode 100644 index 0000000..2b6eb76 --- /dev/null +++ b/sl0pstatus/.github/dependabot.yml @@ -0,0 +1,15 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "cargo" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/sl0pstatus/.github/workflows/lint.yml b/sl0pstatus/.github/workflows/lint.yml new file mode 100644 index 0000000..4c33e17 --- /dev/null +++ b/sl0pstatus/.github/workflows/lint.yml @@ -0,0 +1,56 @@ +--- +on: push +name: Test & Lint +permissions: + contents: read + +# Make sure CI fails on all warnings, including Clippy lints +env: + RUSTFLAGS: "-Dwarnings" + +jobs: + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4 + + - name: Install WASI SDK + run: | + wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz + tar -xzf wasi-sdk-20.0-linux.tar.gz + mv wasi-sdk-20.0 /opt/wasi-sdk + env: + WASI_SDK_PATH: /opt/wasi-sdk + + - name: Install Rust + uses: dtolnay/rust-toolchain@4f647fc679bcd3b11499ccb42104547c83dabe96 # stable + with: + toolchain: "1.95.0" + target: wasm32-wasip1 + components: clippy + + - name: Run Clippy + uses: clechasseur/rs-clippy-check@62ad100473a5e6513e86407b859091115ec89ae3 # v3 + with: + args: --all-features --lib + toolchain: "1.95.0" + + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4 + - uses: jcbhmr/setup-wasmtime@960c367a99921eb0b02f5778fce9ae8f110bf0f0 # v2 + + - name: Install Rust + uses: dtolnay/rust-toolchain@4f647fc679bcd3b11499ccb42104547c83dabe96 # stable + with: + toolchain: "1.95.0" + target: wasm32-wasip1 + env: + WASI_SDK_PATH: /opt/wasi-sdk + + - name: Install cargo wasi + run: cargo install --locked cargo-nextest + + - name: Run tests + run: cargo nextest run --lib diff --git a/sl0pstatus/.github/workflows/release.yml b/sl0pstatus/.github/workflows/release.yml new file mode 100644 index 0000000..48b17cc --- /dev/null +++ b/sl0pstatus/.github/workflows/release.yml @@ -0,0 +1,66 @@ +--- +name: Release +on: + push: + tags: + - "v*.*.*" + workflow_dispatch: +permissions: + contents: write + +jobs: + build-release: + name: build-release + runs-on: ubuntu-latest + env: + RUST_BACKTRACE: 1 + steps: + - name: Checkout repository + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4 + with: + fetch-tags: false # https://github.com/actions/checkout/issues/1467 + + - name: Install WASI SDK + run: | + wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz + tar -xzf wasi-sdk-20.0-linux.tar.gz + mv wasi-sdk-20.0 /opt/wasi-sdk + env: + WASI_SDK_PATH: /opt/wasi-sdk + + - run: git fetch --tags --all --force && git pull origin ${{ github.ref }} --unshallow --force + name: Fetch tags manually as a workaround. See https://github.com/actions/checkout/issues/1467 + + - name: Install Rust + uses: dtolnay/rust-toolchain@4f647fc679bcd3b11499ccb42104547c83dabe96 # stable + with: + profile: minimal + override: true + toolchain: "1.95.0" + target: wasm32-wasip1 + env: + WASI_SDK_PATH: /opt/wasi-sdk + + - name: Build release binary + run: cargo build --release + + - name: Generate a changelog + uses: orhun/git-cliff-action@f50e11560dce63f7c33227798f90b924471a88b5 # v3 + id: git-cliff + with: + config: cliff.toml + args: -vv --latest --strip header + env: + OUTPUT: CHANGES.md + + - name: Create release + uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + draft: true + body: ${{ steps.git-cliff.outputs.content }} + prerelease: false + files: | + ./target/wasm32-wasip1/release/zjstatus.wasm + ./target/wasm32-wasip1/release/zjframes.wasm diff --git a/sl0pstatus/.gitignore b/sl0pstatus/.gitignore new file mode 100644 index 0000000..2ec47ef --- /dev/null +++ b/sl0pstatus/.gitignore @@ -0,0 +1,4 @@ +/target +.direnv/ +.zjstatus.log +.zjframes.log diff --git a/sl0pstatus/.zellij.kdl b/sl0pstatus/.zellij.kdl new file mode 100644 index 0000000..ef622e4 --- /dev/null +++ b/sl0pstatus/.zellij.kdl @@ -0,0 +1,24 @@ +layout { + default_tab_template { + children + pane size=1 borderless=true { + plugin location="zjstatus" + } + } + + tab name="edit" focus=true { + pane { + command "direnv" + args "exec" "." "nvim" + } + } + + tab name="run" { + pane split_direction="horizontal" { + pane + pane { + cwd "/var/folders/tt/kygkt3t13gqd68q5rz6ly7pw0000gn/T/zellij-501" + } + } + } +} diff --git a/sl0pstatus/CODE_OF_CONDUCT.md b/sl0pstatus/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..4977eca --- /dev/null +++ b/sl0pstatus/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +daniel.jankowski (at) rub (dot) de. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/sl0pstatus/Cargo.lock b/sl0pstatus/Cargo.lock new file mode 100644 index 0000000..b673d47 --- /dev/null +++ b/sl0pstatus/Cargo.lock @@ -0,0 +1,3297 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloca" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4" +dependencies = [ + "cc", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anyhow" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3" + +[[package]] +name = "arc-swap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c049c0be4daef0b145cb3555416b3b8ef5b7888a38aea1a3a155801fe7b0810b" +dependencies = [ + "rustversion", +] + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cached" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0df7748fe2f601e376916ab19e7bfc2c74461b8abe3bce2ce20036ad8de38f" +dependencies = [ + "ahash", + "cached_proc_macro", + "cached_proc_macro_types", + "hashbrown 0.16.1", + "parking_lot", + "thiserror 2.0.18", + "web-time", +] + +[[package]] +name = "cached_proc_macro" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66e734c52502e6cf54dce2ba07108906b04b8fe57f4f5e3ef7d58267b4abf060" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "cached_proc_macro_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26cf465651fa6ad902a2d327ba60c3a6bc61c6a2f4ad70d091cf20dfda0074ef" + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + +[[package]] +name = "cc" +version = "1.2.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17dd265a7d0f31ef544e1b20e03add05d3b45b491b633b10d67145d2acc1a38" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "windows-link", +] + +[[package]] +name = "chrono-tz" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6139a8597ed92cf816dfb33f5dd6cf0bb93a6adc938f11039f371bc5bcd26c3" +dependencies = [ + "chrono", + "phf", +] + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "clap" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +dependencies = [ + "atty", + "bitflags 1.3.2", + "clap_derive", + "clap_lex 0.2.4", + "indexmap 1.9.3", + "once_cell", + "strsim 0.10.0", + "termcolor", + "textwrap 0.16.2", +] + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstyle", + "clap_lex 1.1.0", +] + +[[package]] +name = "clap_complete" +version = "3.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f7a2e0a962c45ce25afce14220bc24f9dade0a1787f185cecf96bfba7847cd8" +dependencies = [ + "clap 3.2.25", +] + +[[package]] +name = "clap_derive" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" +dependencies = [ + "heck 0.4.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "colored" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" +dependencies = [ + "lazy_static", + "windows-sys 0.59.0", +] + +[[package]] +name = "colorsys" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54261aba646433cb567ec89844be4c4825ca92a4f8afba52fc4dd88436e31bbd" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "console" +version = "0.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fe5f465a4f6fee88fad41b85d990f84c835335e85b5d9e6e63e0d06d28cba7c" +dependencies = [ + "encode_unicode", + "libc", + "unicode-width 0.2.2", + "windows-sys 0.61.2", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "criterion" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3" +dependencies = [ + "alloca", + "anes", + "cast", + "ciborium", + "clap 4.6.1", + "criterion-plot", + "itertools 0.13.0", + "num-traits", + "oorandom", + "page_size", + "regex", + "serde", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea" +dependencies = [ + "cast", + "itertools 0.13.0", +] + +[[package]] +name = "crossbeam" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d85363c37faeca707aef026efa9f3b34d077bce547e48f770770625c6013679e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "803d13fb3b09d88be9f4dbc29062c66b19bf7170867ceb746d2a8689bf6c7a26" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" + +[[package]] +name = "crossterm" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" +dependencies = [ + "bitflags 2.13.0", + "crossterm_winapi", + "mio 1.2.2", + "parking_lot", + "rustix 0.38.44", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curl" +version = "0.4.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a45ee8994e5307cb4c60cfc1c20bf7263ffb771ddc135c9f768a14bcbc15b09" +dependencies = [ + "curl-sys", + "libc", + "openssl-probe", + "openssl-sys", + "schannel", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "curl-sys" +version = "0.4.90+curl-8.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97799a0d220bfb3361e0fe4936966ff8c4b24d65c3f06dfc70d7b680b44e7897" +dependencies = [ + "cc", + "libc", + "libnghttp2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", + "windows-sys 0.61.2", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", + "unicode-xid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "directories" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" +dependencies = [ + "dirs-sys 0.4.1", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys 0.5.0", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users 0.4.6", + "windows-sys 0.48.0", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users 0.5.2", + "windows-sys 0.61.2", +] + +[[package]] +name = "displaydoc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "doctest-file" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2db04e74f0a9a93103b50e90b96024c9b2bdca8bce6a632ec71b88736d3d359" + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "either" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" + +[[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "filetime" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" +dependencies = [ + "cfg-if", + "libc", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-timer" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af43fadb8a98512d547e37b4e92e0ced13e205c061b87b4623eff01d918d6968" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "humantime" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15cdd26707701c53297e2fa6afb323d55fbc1d0810c3aec078ae3ef0424c3c15" + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "include_dir" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd" +dependencies = [ + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "inotify" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" +dependencies = [ + "bitflags 1.3.2", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c033f80b2c113cdf91ab7a33faa9cbc014726dcad99880c8609af2a370edf37d" +dependencies = [ + "libc", +] + +[[package]] +name = "interprocess" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069323743400cb7ab06a8fe5c1ed911d36b6919ec531661d034c89083629595b" +dependencies = [ + "doctest-file", + "futures-core", + "libc", + "recvmsg", + "tokio", + "widestring", + "windows-sys 0.61.2", +] + +[[package]] +name = "is-terminal" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" +dependencies = [ + "hermit-abi 0.5.2", + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "isahc" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbce0b6b4f5c50b8e014e227d51ddf721558308566b4f6ba608abcea4d272cce" +dependencies = [ + "async-channel", + "castaway", + "crossbeam-utils", + "curl", + "curl-sys", + "encoding_rs", + "event-listener", + "futures-lite", + "http", + "log", + "mime", + "polling", + "slab", + "sluice", + "tracing", + "tracing-futures", + "url", + "waker-fn", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "kdl" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e03e2e96c5926fe761088d66c8c2aee3a4352a2573f4eaca50043ad130af9117" +dependencies = [ + "miette 5.10.0", + "nom", + "thiserror 1.0.69", +] + +[[package]] +name = "kdl" +version = "6.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "082ddf81b2acd76fe04412655d17befedfff1837db772f8e74c38050d25ed670" +dependencies = [ + "kdl 4.7.1", + "miette 7.6.0", + "num-traits", + "serde", + "winnow 0.7.15", +] + +[[package]] +name = "kqueue" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "273c0752728918e0ac4976f2b275b6fefb9ecd400585dec929419f3844cd87b5" +dependencies = [ + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087" +dependencies = [ + "bitflags 2.13.0", + "libc", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "lev_distance" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d9d1bd215936bc8647ad92986bb56f3f216550b53c44ab785e3217ae33625e" + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "libnghttp2-sys" +version = "0.1.13+1.68.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "492e00167f1418c15648144f42bbfc63099806ecee9bf8d09a6353d6b4856b3c" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "libredox" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c943259e342f1e06ff2da7a83eabdfe7f92ce10262688dbf1895ff0b3e6e4652" +dependencies = [ + "libc", +] + +[[package]] +name = "libz-sys" +version = "1.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bc9657773828b90eeb625adff10eeac83cc21bbfd8e23a03eaa8a33c9e28d9" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" + +[[package]] +name = "log-mdc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" + +[[package]] +name = "log4rs" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e947bb896e702c711fccc2bf02ab2abb6072910693818d1d6b07ee2b9dfd86c" +dependencies = [ + "anyhow", + "arc-swap", + "chrono", + "derive_more", + "fnv", + "log", + "log-mdc", + "mock_instant", + "parking_lot", + "thiserror 2.0.18", + "thread-id", + "unicode-segmentation", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "miette" +version = "5.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" +dependencies = [ + "backtrace", + "backtrace-ext", + "is-terminal", + "miette-derive", + "once_cell", + "owo-colors", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "terminal_size", + "textwrap 0.15.2", + "thiserror 1.0.69", + "unicode-width 0.1.14", +] + +[[package]] +name = "miette" +version = "7.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f98efec8807c63c752b5bd61f862c165c115b0a35685bdcfd9238c7aeb592b7" +dependencies = [ + "cfg-if", + "unicode-width 0.1.14", +] + +[[package]] +name = "miette-derive" +version = "5.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "mio" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "mock_instant" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb517913cfcfb9eeda59f36020269075a152701a01606c612f547e4890be399" + +[[package]] +name = "names" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bddcd3bf5144b6392de80e04c347cd7fab2508f6df16a85fc496ecd5cec39bc" +dependencies = [ + "rand", +] + +[[package]] +name = "nix" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" +dependencies = [ + "bitflags 1.3.2", + "cc", + "cfg-if", + "libc", + "memoffset", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "notify" +version = "6.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" +dependencies = [ + "bitflags 2.13.0", + "filetime", + "inotify", + "kqueue", + "libc", + "log", + "mio 0.8.11", + "walkdir", + "windows-sys 0.48.0", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "oorandom" +version = "11.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "os_str_bytes" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" + +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" + +[[package]] +name = "page_size" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_shared" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi 0.5.2", + "pin-project-lite", + "rustix 1.1.4", + "windows-sys 0.61.2", +] + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "quote" +version = "1.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "recvmsg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.0", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 1.0.69", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 2.0.18", +] + +[[package]] +name = "regex" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f388202e4b80542a0921078cc23b6333bcf1409c1e3f86404cae4766a6131db" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "relative-path" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" + +[[package]] +name = "rstest" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5a3193c063baaa2a95a33f03035c8a72b83d97a54916055ba22d35ed3839d49" +dependencies = [ + "futures-timer", + "futures-util", + "rstest_macros", +] + +[[package]] +name = "rstest_macros" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c845311f0ff7951c5506121a9ad75aec44d083c31583b2ea5a30bcb0b0abba0" +dependencies = [ + "cfg-if", + "glob", + "proc-macro-crate", + "proc-macro2", + "quote", + "regex", + "relative-path", + "rustc_version", + "syn 2.0.119", + "unicode-ident", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.0", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags 2.13.0", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "serde_json" +version = "1.0.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shellexpand" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32824fab5e16e6c4d86dc1ba84489390419a39f97699852b66480bb87d297ed8" +dependencies = [ + "dirs", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" +dependencies = [ + "libc", + "mio 1.2.2", + "signal-hook", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "siphasher" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "sluice" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "160b744a45e8261307bcfe03c98e2f8274502207d534c9a64b675c4db1b6bd58" +dependencies = [ + "async-channel", + "futures-core", + "futures-io", +] + +[[package]] +name = "smallvec" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" + +[[package]] +name = "smawk" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e2fb0f499abb4d162f2bedad68f5ef91a1682b5a03596ddb67efd37768d100" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strip-ansi-escapes" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "011cbb39cf7c1f62871aea3cc46e5817b0937b49e9447370c93cacbe93a766d8" +dependencies = [ + "vte", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "suggest" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2558d0d6327d908558f161bc862d365c0d33aa796bdc81c13c0f954868576659" +dependencies = [ + "clap 3.2.25", + "lev_distance", +] + +[[package]] +name = "supports-color" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6398cde53adc3c4557306a96ce67b302968513830a77a95b2b17305d9719a89" +dependencies = [ + "is-terminal", + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84231692eb0d4d41e4cdd0cabfdd2e6cd9e255e65f80c9aa7c98dd502b4233d" +dependencies = [ + "is-terminal", +] + +[[package]] +name = "supports-unicode" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f850c19edd184a205e883199a261ed44471c81e39bd95b1357f5febbef00e77a" +dependencies = [ + "is-terminal", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "once_cell", + "rustix 1.1.4", + "windows-sys 0.61.2", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "terminal_size" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "textwrap" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width 0.1.14", +] + +[[package]] +name = "textwrap" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thread-id" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2010d27add3f3240c1fef7959f46c814487b216baee662af53be645ba7831c07" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "tokio" +version = "1.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +dependencies = [ + "bytes", + "libc", + "mio 1.2.2", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tokio-stream" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.13+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6975367e4d2ef766d86af01ffad14b622fecc8d4357a998fbc4deb6e9bacaf9b" +dependencies = [ + "indexmap 2.14.0", + "toml_datetime", + "toml_parser", + "winnow 1.0.4", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow 1.0.4", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.23.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5fab0d6c3c01ae70085a09cb03d4c7a1d6314e2b3e075392783396d724ca0a" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vte" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cbce692ab4ca2f1f3047fcf732430249c0e971bfdd2b234cf2c47ad93af5983" +dependencies = [ + "arrayvec", + "utf8parse", + "vte_generate_state_changes", +] + +[[package]] +name = "vte_generate_state_changes" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e369bee1b05d510a7b4ed645f5faa90619e05437111783ea5848f28d97d3c2e" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "waker-fn" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.119", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "zellij-tile" +version = "0.44.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117cdb1e488beee0a34aa11e108142b082b0c13a7fca165dc624a9ffb808db42" +dependencies = [ + "clap 3.2.25", + "prost", + "serde", + "serde_json", + "strum", + "strum_macros", + "zellij-utils", +] + +[[package]] +name = "zellij-utils" +version = "0.44.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b823df41cf824f6b9db45f50c3b2bc02cc66d9dd4db223392f19b02cff4a876" +dependencies = [ + "anyhow", + "backtrace", + "bitflags 2.13.0", + "clap 3.2.25", + "clap_complete", + "colored", + "colorsys", + "crossbeam", + "crossterm", + "directories", + "dunce", + "humantime", + "include_dir", + "interprocess", + "isahc", + "kdl 4.7.1", + "lazy_static", + "libc", + "log", + "log4rs", + "miette 5.10.0", + "names", + "nix", + "notify", + "percent-encoding", + "prost", + "serde", + "serde_json", + "sha2", + "shellexpand", + "strip-ansi-escapes", + "strum", + "strum_macros", + "suggest", + "tempfile", + "thiserror 1.0.69", + "tokio", + "tokio-stream", + "tokio-util", + "unicode-width 0.1.14", + "url", + "uuid", + "winapi", + "windows-sys 0.59.0", +] + +[[package]] +name = "zerocopy" +version = "0.8.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7cbbc0a705a0fd05cc3676525980d2bf5a9bc4adac6d6475209a7887cf59d19" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e817b7b52d0c7358d3246da9d69935ebb18116b2b102b4230dac079b4862f5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zjstatus" +version = "0.24.0" +dependencies = [ + "anstyle", + "anyhow", + "cached", + "chrono", + "chrono-tz", + "console", + "criterion", + "itertools 0.15.0", + "kdl 6.7.1", + "lazy_static", + "regex", + "rstest", + "tracing", + "tracing-subscriber", + "uuid", + "zellij-tile", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/sl0pstatus/Cargo.toml b/sl0pstatus/Cargo.toml new file mode 100644 index 0000000..3853338 --- /dev/null +++ b/sl0pstatus/Cargo.toml @@ -0,0 +1,55 @@ +[package] +name = "zjstatus" +version = "0.24.0" +authors = ["Daniel Jankowski"] +edition = "2024" + +[profile.release] +lto = "fat" +codegen-units = 1 +panic = "abort" + +[[bin]] +name = "zjstatus" +bench = false + +[[bin]] +name = "zjframes" +bench = false + +[lib] +bench = false + +[features] +bench = [] +tracing = [] + +[dependencies] +zellij-tile = "0.44.3" +chrono = { version = "0.4.43", default-features = false, features = ["clock"] } +regex = "1.12.2" +chrono-tz = "0.10.4" +anyhow = "1.0.101" +anstyle = "1.0.13" +uuid = { version = "1.23.2", features = ["v4"] } +lazy_static = "1.5.0" +cached = { version = "2.0.2", features = ["wasm"] } +console = "0.16.1" +tracing-subscriber = "0.3.22" +tracing = "0.1.44" +kdl = { version = "6.7.1", features = ["v1", "v1-fallback"] } +rstest = "0.26.1" +itertools = "0.15.0" + +[dev-dependencies] +criterion = { version = "0.8.0", default-features = false, features = [ + "html_reports", +] } + +[[bench]] +name = "benches" +harness = false + +[[bench]] +name = "widgets" +harness = false diff --git a/sl0pstatus/LICENSE b/sl0pstatus/LICENSE new file mode 100644 index 0000000..c777ff2 --- /dev/null +++ b/sl0pstatus/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Daniel Jankowski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sl0pstatus/README.md b/sl0pstatus/README.md new file mode 100644 index 0000000..dc0768f --- /dev/null +++ b/sl0pstatus/README.md @@ -0,0 +1,230 @@ +<h1 align="center">zjstatus & zjframes</h1> + +<p align="center"> + A configurable and themable statusbar for zellij. + <br><br> + <a href="https://github.com/dj95/zjstatus/actions/workflows/lint.yml"> + <img alt="clippy check" src="https://github.com/dj95/zjstatus/actions/workflows/lint.yml/badge.svg" /> + </a> + <a href="https://github.com/dj95/zjstatus/releases"> + <img alt="latest version" src="https://img.shields.io/github/v/tag/dj95/zjstatus.svg?sort=semver" /> + </a> + <a href="https://github.com/dj95/zjstatus/wiki"> + <img alt="GitHub Wiki" src="https://img.shields.io/badge/documentation-wiki-wiki?logo=github"> + </a> + + <br><br> + The goal of this statusbar is to provide a highly customizable and extensible statusbar for zellij. Single + modules can be formatted separately. Due to the widget structure new modules can be created with ease. + + As an addition, this repository contains *zjframes* which can be used to toggle pane frames based on different + conditions even without loading *zjstatus*, e.g. when using the default status bars. +</p> + + + +### [👉 Check out and share your awesome configs in the community showcase!](https://github.com/dj95/zjstatus/discussions/44) + +<details> +<summary><h3>Examples</h3></summary> +<b><a href="./examples/tmux.kdl">tmux style</a></b> +<img src="./examples/tmux.png" alt="tmux style bar" /> +<br> +<b><a href="./examples/simple.kdl">simple style</a></b> +<img src="./examples/simple.png" alt="simple style bar" /> +<br> +<b><a href="./examples/slanted.kdl">slanted style</a></b> +<img src="./examples/slanted.png" alt="slanted style bar" /> +<br> +<b><a href="./examples/swap-layouts.kdl">example for swapping layouts with zjstatus</a></b> +<img src="./examples/swap-layouts.png" alt="example for swapping layouts with zjstatus" /> +<br> +<b><a href="./examples/compact.kdl">compact style (thanks to @segaja)</a></b> +<img src="./examples/compact.png" alt="compact style bar" /> +<br> +<b><a href="./examples/conky.kdl">conky status (thanks to @benzwt)</a></b> +<a href="./examples/conky.conf">conky.conf</a> +<img src="./examples/conky.png" alt="conky status" /> +<br> +<b>Demo GIF</b> +<img src="./assets/demo.gif" alt="Demo GIF of zellij with zjstatus" /> +</details> + +## 🚀 Installation + +> [!TIP] +> For more detailed instructions, check out the [wiki](https://github.com/dj95/zjstatus/wiki/1-%E2%80%90-Installation)! + +Download the latest binary in the github releases. Place it somewhere, zellij is able to access it. Then the +plugin can be included by referencing it in a layout file, e.g. the default layout one, or the config file. + +In contrast to *zjstatus*, *zjframes* should only be used in the `load_plugins` option of the *config.kdl* +from zellij, as it should only be loaded in the background. For more details, please follow the [documentation](https://github.com/dj95/zjstatus/wiki/6---zjframes) + +You could also refer to the plugin guide from zellij, after downloading the binary: [https://zellij.dev/documentation/plugin-loading](https://zellij.dev/documentation/plugin-loading) + +Please ensure, that the configuration is correct. + +> [!IMPORTANT] +> In case you experience any crashes or issues, please in the first step try to clear the cache! (`$HOME/.cache/zellij/` for Linux, `$HOME/Library/Caches/org.Zellij-Contributors.Zellij/` on macOS) + +Sometimes, especially when updating plugins, it might come to caching issues, which can be resolved by clearing it. Please keep in +mind, that it will also clear the cache for running sessions and revokes granted permissions for plugins. + +## ❄️ Installation with nix flake + +Add this repository to your inputs and then with the following overlay to your packages. +Then you are able to install and refer to it with `pkgs.zjstatus`. When templating the +config file, you can use `${pkgs.zjstatus}/bin/zjstatus.wasm` as the path. `${pkgs.zjstatus}/bin/zjframes.wasm` +is also available in case you only want to use *zjframes*. + +```nix + inputs = { + # ... + + zjstatus = { + url = "github:dj95/zjstatus"; + }; + }; + + + # define the outputs of this flake - especially the home configurations + outputs = { self, nixpkgs, zjstatus, ... }@inputs: + let + inherit (inputs.nixpkgs.lib) attrValues; + + overlays = with inputs; [ + # ... + (final: prev: { + zjstatus = zjstatus.packages.${prev.system}.default; + }) + ]; +``` + +## ⚙️ Configuration + +For configuring, please follow the [documentation](https://github.com/dj95/zjstatus/wiki/3-%E2%80%90-Configuration). + +## 🏎️ Quick Start for zjstatus + +Place the following configuration in your default layout file, e.g. `~/.config/zellij/layouts/default.kdl`. Right after starting zellij, it will prompt for permissions, which need to be granted in order for zjstatus to work. Simply navigate to the pane or click on it and press `y`. This must be repeated on updates. For more details on permissions, please visit the [wiki](https://github.com/dj95/zjstatus/wiki/2-%E2%80%90-Permissions). + +> [!IMPORTANT] +> Downloading zjstatus as file and using `file:~/path/to/zjstatus.wasm` is recommended, even if the quickstart includes the https location. + +> [!IMPORTANT] +> Using zjstatus involves creating new layouts and overriding the default one. This will lead to swap layouts not working, when they are not configured correctly. Please follow [this documentation](https://github.com/dj95/zjstatus/wiki/3-%E2%80%90-Configuration#swap-layouts) for getting swap layouts back to work, if you need them. + +> [!IMPORTANT] +> If you want to hide borders, please remove the `hide_frame_for_single_pane` option or set it to `false`. Otherwise zjstatus will toggle frame borders even if they are hidden in zellij's config! + +```javascript +layout { + default_tab_template { + children + pane size=1 borderless=true { + plugin location="https://github.com/dj95/zjstatus/releases/latest/download/zjstatus.wasm" { + format_left "{mode} #[fg=#89B4FA,bold]{session}" + format_center "{tabs}" + format_right "{command_git_branch} {datetime}" + format_space "" + + border_enabled "false" + border_char "─" + border_format "#[fg=#6C7086]{char}" + border_position "top" + + hide_frame_for_single_pane "true" + + mode_normal "#[bg=blue] " + mode_tmux "#[bg=#ffc387] " + + tab_normal "#[fg=#6C7086] {name} " + tab_active "#[fg=#9399B2,bold,italic] {name} " + + command_git_branch_command "git rev-parse --abbrev-ref HEAD" + command_git_branch_format "#[fg=blue] {stdout} " + command_git_branch_interval "10" + command_git_branch_rendermode "static" + command_git_branch_cwd "{focused_pane_cwd}" + + datetime "#[fg=#6C7086,bold] {format} " + datetime_format "%A, %d %b %Y %H:%M" + datetime_timezone "Europe/Berlin" + } + } + } +} +``` + +## 🏎️ Quickstart for zjframes + +Add the following to the *config.kdl* or add the plugin to `load_plugins`, if you already load other plugins in the background. +Double check if the configuration matches your expectations. Then restart zellij. + +> [!IMPORTANT] +> Downloading zjframes as file and using `file:~/path/to/zjframes.wasm` is recommended, even if the quickstart includes the https location. + +```javascript +// Plugins to load in the background when a new session starts +load_plugins { + "https://github.com/dj95/zjstatus/releases/latest/download/zjframes.wasm" { + hide_frame_for_single_pane "true" + hide_frame_except_for_search "true" + hide_frame_except_for_scroll "true" + hide_frame_except_for_fullscreen "true" + } +} +``` + +## 🧱 Widgets + +The documentation for the widgets can be found in the [wiki](https://github.com/dj95/zjstatus/wiki/4-%E2%80%90-Widgets). + +The following widgets are available: + +- [command](https://github.com/dj95/zjstatus/wiki/4-%E2%80%90-Widgets#command) +- [datetime](https://github.com/dj95/zjstatus/wiki/4-%E2%80%90-Widgets#datetime) +- [mode](https://github.com/dj95/zjstatus/wiki/4-%E2%80%90-Widgets#mode) +- [notifications](https://github.com/dj95/zjstatus/wiki/4-%E2%80%90-Widgets#notifications) +- [pipe](https://github.com/dj95/zjstatus/wiki/4-%E2%80%90-Widgets#pipe) +- [session](https://github.com/dj95/zjstatus/wiki/4-%E2%80%90-Widgets#session) +- [swap layout](https://github.com/dj95/zjstatus/wiki/4-%E2%80%90-Widgets#swap-layout) +- [tabs](https://github.com/dj95/zjstatus/wiki/4-%E2%80%90-Widgets#tabs) + +## 🚧 Development + +Make sure you have rust and the `wasm32-wasi` target installed. If using nix, you could utilize the nix-shell +in this repo for obtaining `cargo` and `rustup`. Then you'll only need to add the target with +`rustup target add wasm32-wasi`. + +With the toolchain, simply build `zjstatus` with `cargo build`. Then you are able to run the example configuration +with `zellij -l plugin-dev-workspace.kdl` from the root of the repository. + +## 🤝 Contributing + +If you are missing features or find some annoying bugs please feel free to submit an issue or a bugfix within a pull request :) + +## 📝 License + +© 2024 Daniel Jankowski + +This project is licensed under the MIT license. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sl0pstatus/assets/demo.gif b/sl0pstatus/assets/demo.gif Binary files differnew file mode 100644 index 0000000..16a0ad3 --- /dev/null +++ b/sl0pstatus/assets/demo.gif diff --git a/sl0pstatus/assets/demo.png b/sl0pstatus/assets/demo.png Binary files differnew file mode 100644 index 0000000..4ac0b4a --- /dev/null +++ b/sl0pstatus/assets/demo.png diff --git a/sl0pstatus/assets/socialcard.png b/sl0pstatus/assets/socialcard.png Binary files differnew file mode 100644 index 0000000..8463258 --- /dev/null +++ b/sl0pstatus/assets/socialcard.png diff --git a/sl0pstatus/benches/benches.rs b/sl0pstatus/benches/benches.rs new file mode 100644 index 0000000..2eabb75 --- /dev/null +++ b/sl0pstatus/benches/benches.rs @@ -0,0 +1,172 @@ +use criterion::{criterion_group, criterion_main, Criterion}; +use std::{collections::BTreeMap, sync::Arc}; +use zellij_tile::prelude::{ModeInfo, TabInfo}; + +use zjstatus::{ + config::{ModuleConfig, ZellijState}, + render::{ + formatted_part_from_string_cached, formatted_parts_from_string_cached, FormattedPart, + }, + widgets::{datetime::DateTimeWidget, mode::ModeWidget, session::SessionWidget, widget::Widget}, +}; + +fn bench_moduleconfig_render_bar(c: &mut Criterion) { + let config = BTreeMap::from([ + ("format_left".to_owned(), "{mode} #[fg=#89B4FA,bg=#181825,bold]{session} {tabs} {command_1} {command_git_branch} {command_3}".to_owned()), + ("format_right".to_owned(), "{datetime}".to_owned()), + ("format_space".to_owned(), "#[bg=#181825]".to_owned()), + ]); + + let mut module_config = ModuleConfig::new(&config).unwrap(); + + let mut widgets: BTreeMap<String, Arc<dyn Widget>> = BTreeMap::new(); + + widgets.insert( + "mode".to_owned(), + Arc::new(ModeWidget::new(&BTreeMap::from([( + "mode_normal".to_owned(), + "#[bg=blue] #[bg=yellow] ".to_owned(), + )]))), + ); + + widgets.insert( + "datetime".to_owned(), + Arc::new(DateTimeWidget::new(&BTreeMap::from([( + "datetime".to_owned(), + "#[fg=#6C7086,bg=#181825] {index} {name} ".to_owned(), + )]))), + ); + + widgets.insert( + "session".to_owned(), + Arc::new(SessionWidget::new(&BTreeMap::from([]))), + ); + + let state = ZellijState { + mode: ModeInfo::default(), + tabs: vec![TabInfo { + name: "test".to_owned(), + active: true, + ..Default::default() + }], + ..Default::default() + }; + + c.bench_function("ModuleConfig::render_bar", |b| { + b.iter(|| module_config.render_bar(state.clone(), widgets.clone())) + }); +} + +fn bench_formattedpart_format_string_with_widgets(c: &mut Criterion) { + let mut format = FormattedPart::from_format_string( + "#[fg=#9399B2,bg=#181825,bold,italic] {mode} {datetime} {session} [] ", + &BTreeMap::new(), + ); + + let mut widgets: BTreeMap<String, Arc<dyn Widget>> = BTreeMap::new(); + + widgets.insert( + "mode".to_owned(), + Arc::new(ModeWidget::new(&BTreeMap::from([( + "mode_normal".to_owned(), + "#[bg=blue] #[bg=yellow] ".to_owned(), + )]))), + ); + + widgets.insert( + "datetime".to_owned(), + Arc::new(DateTimeWidget::new(&BTreeMap::from([( + "datetime".to_owned(), + "#[fg=#6C7086,bg=#181825] {index} {name} ".to_owned(), + )]))), + ); + + widgets.insert( + "session".to_owned(), + Arc::new(SessionWidget::new(&BTreeMap::from([]))), + ); + + let state = ZellijState { + mode: ModeInfo::default(), + tabs: vec![TabInfo { + name: "test".to_owned(), + active: true, + ..Default::default() + }], + cache_mask: 0b00000011, + ..Default::default() + }; + + c.bench_function("FormattedPart::format_string_with_widgets", |b| { + b.iter(|| format.format_string_with_widgets(&widgets, &state)) + }); +} + +fn bench_formattedpart_from_format_string(c: &mut Criterion) { + c.bench_function("FormattedPart::from_format_string", |b| { + b.iter(|| { + FormattedPart::from_format_string( + "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} [] ", + &BTreeMap::new(), + ) + }) + }); +} + +fn bench_formattedpart_from_format_string_cached(c: &mut Criterion) { + c.bench_function("formatted_part_from_string_cached", |b| { + b.iter(|| { + formatted_part_from_string_cached( + "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} [] ", + &BTreeMap::new(), + ) + }) + }); +} + +fn bench_formattedpart_multiple_from_format_string(c: &mut Criterion) { + c.bench_function("FormattedPart::multiple_from_format_string", |b| { + b.iter(|| { + FormattedPart::multiple_from_format_string( + "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} [] #[fg=#9399B2,bg=#181825,bold,italic] {index} {name} [] ", + &BTreeMap::new(), + ) + }) + }); +} + +fn bench_formattedparts_from_format_string_cached(c: &mut Criterion) { + c.bench_function("formatted_parts_from_string_cached", |b| { + b.iter(|| { + formatted_parts_from_string_cached( + "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} [] #[fg=#9399B2,bg=#181825,bold,italic] {index} {name} [] ", + &BTreeMap::new(), + ) + }) + }); +} + +fn bench_moduleconfig_new(c: &mut Criterion) { + let mut config = BTreeMap::new(); + + config.insert("format_left".to_owned(), "{mode} #[fg=#89B4FA,bg=#181825,bold]{session} {tabs} {command_1} {command_git_branch} {command_3}".to_owned()); + config.insert("format_right".to_owned(), "{datetime}".to_owned()); + config.insert("format_space".to_owned(), "#[bg=#181825]".to_owned()); + + c.bench_function("ModuleConfig::new", |b| { + b.iter(|| ModuleConfig::new(&config)) + }); +} + +fn criterion_benchmark(c: &mut Criterion) { + bench_formattedpart_from_format_string(c); + bench_formattedpart_from_format_string_cached(c); + bench_formattedpart_multiple_from_format_string(c); + bench_formattedparts_from_format_string_cached(c); + bench_formattedpart_format_string_with_widgets(c); + bench_moduleconfig_new(c); + bench_moduleconfig_render_bar(c); +} + +criterion_group!(benches, criterion_benchmark); +criterion_main!(benches); diff --git a/sl0pstatus/benches/widgets.rs b/sl0pstatus/benches/widgets.rs new file mode 100644 index 0000000..d14a44d --- /dev/null +++ b/sl0pstatus/benches/widgets.rs @@ -0,0 +1,161 @@ +use chrono::{Duration, Local}; +use criterion::{criterion_group, criterion_main, Criterion}; +use std::{collections::BTreeMap, ops::Sub}; +use zellij_tile::prelude::*; + +use zjstatus::{ + config::ZellijState, + widgets::{self, widget::Widget}, +}; + +fn bench_widget_command(c: &mut Criterion) { + let config = BTreeMap::from([ + ( + "command_test_format".to_owned(), + "#[fg=#9399B2,bg=#181825,bold,italic] {exit_code} {stdout} ".to_owned(), + ), + ("command_test_interval".to_owned(), "100".to_owned()), + ]); + + let wid = widgets::command::CommandWidget::new(&config); + + let ts = Local::now().sub(Duration::try_seconds(1).unwrap()); + + let state = ZellijState { + command_results: BTreeMap::from([( + "command_test".to_owned(), + widgets::command::CommandResult { + exit_code: Some(0), + stdout: "test".to_owned(), + stderr: "".to_owned(), + context: BTreeMap::from([( + "timestamp".to_owned(), + ts.format(widgets::command::TIMESTAMP_FORMAT).to_string(), + )]), + }, + )]), + ..Default::default() + }; + + c.bench_function("widgets::CommandWidget (static)", |b| { + b.iter(|| { + wid.process("command_test", &state); + }) + }); +} + +fn bench_widget_command_dynamic(c: &mut Criterion) { + let config = BTreeMap::from([ + ( + "command_test_format".to_owned(), + "#[fg=#9399B2,bg=#181825,bold,italic] {exit_code} {stdout} ".to_owned(), + ), + ("command_test_interval".to_owned(), "100".to_owned()), + ("command_test_rendermode".to_owned(), "dynamic".to_owned()), + ]); + + let wid = widgets::command::CommandWidget::new(&config); + + let ts = Local::now().sub(Duration::try_seconds(1).unwrap()); + + let state = ZellijState { + command_results: BTreeMap::from([( + "command_test".to_owned(), + widgets::command::CommandResult { + exit_code: Some(0), + stdout: "#[fg=#9399B2,bg=#181825,bold,italic] test #[fg=#9399B2,bg=#181825,bold,italic] test".to_owned(), + stderr: "".to_owned(), + context: BTreeMap::from([( + "timestamp".to_owned(), + ts.format(widgets::command::TIMESTAMP_FORMAT).to_string(), + )]), + }, + )]), + ..Default::default() + }; + + c.bench_function("widgets::CommandWidget (dynamic)", |b| { + b.iter(|| { + wid.process("command_test", &state); + }) + }); +} + +fn bench_widget_tabs(c: &mut Criterion) { + let config = BTreeMap::from([ + ( + "tab_normal".to_owned(), + "#[fg=#6C7086,bg=#181825] {index} {name} ".to_owned(), + ), + ( + "tab_normal_fullscreen".to_owned(), + "#[fg=#6C7086,bg=#181825] {index} {name} ".to_owned(), + ), + ( + "tab_active".to_owned(), + "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} ".to_owned(), + ), + ]); + + let wid = widgets::tabs::TabsWidget::new(&config); + + let state = ZellijState { + tabs: vec![TabInfo { + name: "test".to_owned(), + active: true, + ..Default::default() + }], + ..Default::default() + }; + + c.bench_function("widgets::TabsWidget", |b| { + b.iter(|| { + wid.process("tabs", &state); + }) + }); +} + +fn bench_widget_mod(c: &mut Criterion) { + let config = BTreeMap::from([( + "mode_normal".to_owned(), + "#[bg=blue] #[bg=yellow] ".to_owned(), + )]); + + let wid = widgets::mode::ModeWidget::new(&config); + + let state = ZellijState { + mode: ModeInfo::default(), + ..Default::default() + }; + + c.bench_function("widgets::ModeWidget", |b| { + b.iter(|| { + wid.process("mode", &state); + }) + }); +} + +fn bench_widget_datetime(c: &mut Criterion) { + let config = BTreeMap::new(); + + let wid = widgets::datetime::DateTimeWidget::new(&config); + + let state = ZellijState::default(); + + c.bench_function("widgets::DateTimeWidget", |b| { + b.iter(|| { + wid.process("datetime", &state); + }) + }); +} + +fn criterion_benchmark(c: &mut Criterion) { + bench_widget_datetime(c); + bench_widget_mod(c); + bench_widget_tabs(c); + bench_widget_command(c); + bench_widget_command_dynamic(c); +} + +criterion_group!(benches, criterion_benchmark); +criterion_main!(benches); diff --git a/sl0pstatus/cliff.toml b/sl0pstatus/cliff.toml new file mode 100644 index 0000000..d6425f9 --- /dev/null +++ b/sl0pstatus/cliff.toml @@ -0,0 +1,89 @@ +# git-cliff ~ default configuration file +# https://git-cliff.org/docs/configuration +# +# Lines starting with "#" are comments. +# Configuration options are organized into tables and keys. +# See documentation for more information on available options. + +[changelog] +# changelog header +header = """ +# Changelog\n +All notable changes to this project will be documented in this file.\n +""" +# template for the changelog body +# https://keats.github.io/tera/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | striptags | trim | upper_first }} + {% for commit in commits %} + - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ + {% if commit.breaking %}[**breaking**] {% endif %}\ + {{ commit.message | upper_first }}\ + {% endfor %} +{% endfor %}\n +""" +# template for the changelog footer +footer = """ +<!-- generated by git-cliff --> +""" +# remove the leading and trailing s +trim = true +# postprocessors +postprocessors = [ + # { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL +] + +[git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = true +# process each line of a commit as an individual commit +split_commits = false +# regex for preprocessing the commit messages +commit_preprocessors = [ + # Replace issue numbers + #{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"}, + # Check spelling of the commit with https://github.com/crate-ci/typos + # If the spelling is incorrect, it will be automatically fixed. + #{ pattern = '.*', replace_command = 'typos --write-changes -' }, +] +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^feat", group = "<!-- 0 -->🚀 Features" }, + { message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" }, + { message = "^doc", group = "<!-- 3 -->📚 Documentation" }, + { message = "^perf", group = "<!-- 4 -->⚡ Performance" }, + { message = "^refactor", group = "<!-- 2 -->🚜 Refactor" }, + { message = "^style", group = "<!-- 5 -->🎨 Styling" }, + { message = "^test", group = "<!-- 6 -->🧪 Testing" }, + { message = "^chore\\(release\\): prepare for", skip = true }, + { message = "^chore\\(deps.*\\)", skip = true }, + { message = "^chore\\(pr\\)", skip = true }, + { message = "^chore\\(pull\\)", skip = true }, + { message = "^chore|ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" }, + { body = ".*security", group = "<!-- 8 -->🛡️ Security" }, + { message = "^revert", group = "<!-- 9 -->◀️ Revert" }, +] +# protect breaking changes from being skipped due to matching a skipping commit_parser +protect_breaking_commits = false +# filter out the commits that are not matched by commit parsers +filter_commits = false +# regex for matching git tags +# tag_pattern = "v[0-9].*" +# regex for skipping tags +# skip_tags = "" +# regex for ignoring tags +# ignore_tags = "" +# sort the tags topologically +topo_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest" +# limit the number of commits included in the changelog. +# limit_commits = 42 diff --git a/sl0pstatus/examples/compact.kdl b/sl0pstatus/examples/compact.kdl new file mode 100644 index 0000000..2c6fd9a --- /dev/null +++ b/sl0pstatus/examples/compact.kdl @@ -0,0 +1,24 @@ +layout { + pane split_direction="vertical" { + pane + } + + pane size=1 borderless=true { + plugin location="file:target/wasm32-wasi/debug/zjstatus.wasm" { + format_left "#[fg=#FFFFFF,bold] {session} {mode} {tabs}" + format_right "#[bg=#8A8A8A,fg=#000000] #[bg=#8A8A8A,fg=#000000,bold]{swap_layout} #[bg=#000000,fg=#8A8A8A]" + + mode_locked "#[fg=#FF00D9,bold] {name} " + mode_normal "#[fg=#AFFF00,bold] {name} " + mode_resize "#[fg=#D75F00,bold] {name} " + mode_default_to_mode "resize" + + tab_normal "#[bg=#8A8A8A,fg=#000000] #[bg=#8A8A8A,fg=#000000,bold]{name} {sync_indicator}{fullscreen_indicator}{floating_indicator} #[bg=#000000,fg=#8A8A8A]" + tab_active "#[bg=#AFFF00,fg=#000000] #[bg=#AFFF00,fg=#000000,bold]{name} {sync_indicator}{fullscreen_indicator}{floating_indicator} #[bg=#000000,fg=#AFFF00]" + + tab_sync_indicator " " + tab_fullscreen_indicator "□ " + tab_floating_indicator " " + } + } +} diff --git a/sl0pstatus/examples/compact.png b/sl0pstatus/examples/compact.png Binary files differnew file mode 100644 index 0000000..2fc3362 --- /dev/null +++ b/sl0pstatus/examples/compact.png diff --git a/sl0pstatus/examples/conky.conf b/sl0pstatus/examples/conky.conf new file mode 100644 index 0000000..09eea35 --- /dev/null +++ b/sl0pstatus/examples/conky.conf @@ -0,0 +1,7 @@ +conky.config = { + units_spacer = '', + short_units = true, + out_to_console = true, + total_run_times = 1, +}; +conky.text = [[[0m[38;2;24;24;37m[48;2;122;168;159m${uptime_short}[38;2;122;168;159m[48;2;152;187;108m[38;2;0;0;0m[48;2;152;187;108m${fs_used_perc}% ${fs_free}[38;2;152;187;108m[48;2;126;156;216m[38;2;0;0;0m[48;2;126;156;216m${loadavg 1}[38;2;126;156;216m[48;2;156;134;191m[38;2;0;0;0m[48;2;156;134;191m${memperc}% ${memmax} ${battery_percent}%]] diff --git a/sl0pstatus/examples/conky.kdl b/sl0pstatus/examples/conky.kdl new file mode 100644 index 0000000..25f0f8d --- /dev/null +++ b/sl0pstatus/examples/conky.kdl @@ -0,0 +1,35 @@ +layout { + pane split_direction="vertical" { + pane + } + + pane size=1 borderless=true { + plugin location="file:target/wasm32-wasi/debug/zjstatus.wasm" { + format_left "{mode}#[fg=black,bg=blue,bold]{session} #[fg=blue,bg=#181825]{tabs}" + format_right "{command_conky}#[fg=#9c86bf,bg=#DCD7BA]{datetime}" + format_space "#[bg=#181825]" + + hide_frame_for_single_pane "true" + + mode_normal "#[bg=blue]" + mode_locked "#[bg=red]" + + tab_normal "#[fg=#181825,bg=#4C4C59] #[fg=#000000,bg=#4C4C59]{index} {name} #[fg=#4C4C59,bg=#181825]" + tab_normal_fullscreen "#[fg=#6C7086,bg=#181825] {index} {name} [] " + tab_normal_sync "#[fg=#6C7086,bg=#181825] {index} {name} <> " + tab_active "#[fg=#181825,bg=#ffffff,bold,italic]{index} {name} #[fg=#ffffff,bg=#181825]" + tab_active_fullscreen "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} [] " + tab_active_sync "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} <> " + + + // TODO: set this path correctly to the absolute path to the conky.conf + command_conky_command "conky -i1 -c path/to/conky.conf" + command_conky_format "{stdout}" + command_conky_interval "1" + + datetime "#[fg=#000000,bg=#DCD7BA,nobold]{format}" + datetime_format "%d/%m %H:%M" + datetime_timezone "Asia/Taipei" + } + } +} diff --git a/sl0pstatus/examples/conky.png b/sl0pstatus/examples/conky.png Binary files differnew file mode 100644 index 0000000..ca6093e --- /dev/null +++ b/sl0pstatus/examples/conky.png diff --git a/sl0pstatus/examples/simple.kdl b/sl0pstatus/examples/simple.kdl new file mode 100644 index 0000000..e61c96a --- /dev/null +++ b/sl0pstatus/examples/simple.kdl @@ -0,0 +1,37 @@ +layout { + pane split_direction="vertical" { + pane + } + + pane size=1 borderless=true { + plugin location="file:target/wasm32-wasi/debug/zjstatus.wasm" { + hide_frame_for_single_pane "true" + + format_left "{mode}#[fg=#89B4FA,bg=#181825,bold] {session}#[bg=#181825] {tabs}" + format_right "{command_kubectx}#[fg=#424554,bg=#181825]::{command_kubens}{datetime}" + format_space "#[bg=#181825]" + + mode_normal "#[bg=#89B4FA] " + mode_tmux "#[bg=#ffc387] " + mode_default_to_mode "tmux" + + tab_normal "#[fg=#6C7086,bg=#181825] {index} {name} {fullscreen_indicator}{sync_indicator}{floating_indicator}" + tab_active "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} {fullscreen_indicator}{sync_indicator}{floating_indicator}" + tab_fullscreen_indicator "□ " + tab_sync_indicator " " + tab_floating_indicator " " + + command_kubectx_command "kubectx -c" + command_kubectx_format "#[fg=#6C7086,bg=#181825,italic] {stdout}" + command_kubectx_interval "2" + + command_kubens_command "kubens -c" + command_kubens_format "#[fg=#6C7086,bg=#181825]{stdout} " + command_kubens_interval "2" + + datetime "#[fg=#9399B2,bg=#181825] {format} " + datetime_format "%A, %d %b %Y %H:%M" + datetime_timezone "Europe/Berlin" + } + } +} diff --git a/sl0pstatus/examples/simple.png b/sl0pstatus/examples/simple.png Binary files differnew file mode 100644 index 0000000..8632bc1 --- /dev/null +++ b/sl0pstatus/examples/simple.png diff --git a/sl0pstatus/examples/slanted.kdl b/sl0pstatus/examples/slanted.kdl new file mode 100644 index 0000000..1e2ca52 --- /dev/null +++ b/sl0pstatus/examples/slanted.kdl @@ -0,0 +1,29 @@ +layout { + pane split_direction="vertical" { + pane + } + + pane size=1 borderless=true { + plugin location="file:target/wasm32-wasi/debug/zjstatus.wasm" { + format_left "{mode}#[fg=black,bg=blue,bold]{session} #[fg=blue,bg=#181825]{tabs}" + format_right "#[fg=#181825,bg=#b1bbfa]{datetime}" + format_space "#[bg=#181825]" + + hide_frame_for_single_pane "true" + + mode_normal "#[bg=blue] " + + tab_normal "#[fg=#181825,bg=#4C4C59] #[fg=#000000,bg=#4C4C59]{index} {name} #[fg=#4C4C59,bg=#181825]" + tab_normal_fullscreen "#[fg=#6C7086,bg=#181825] {index} {name} [] " + tab_normal_sync "#[fg=#6C7086,bg=#181825] {index} {name} <> " + tab_active "#[fg=#181825,bg=#ffffff,bold,italic] {index} {name} #[fg=#ffffff,bg=#181825]" + tab_active_fullscreen "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} [] " + tab_active_sync "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} <> " + + + datetime "#[fg=#6C7086,bg=#b1bbfa,bold] {format} " + datetime_format "%A, %d %b %Y %H:%M" + datetime_timezone "Europe/Berlin" + } + } +} diff --git a/sl0pstatus/examples/slanted.png b/sl0pstatus/examples/slanted.png Binary files differnew file mode 100644 index 0000000..eb95b4a --- /dev/null +++ b/sl0pstatus/examples/slanted.png diff --git a/sl0pstatus/examples/swap-layouts.kdl b/sl0pstatus/examples/swap-layouts.kdl new file mode 100644 index 0000000..e4c3945 --- /dev/null +++ b/sl0pstatus/examples/swap-layouts.kdl @@ -0,0 +1,69 @@ +layout { + tab { + pane + } + + swap_tiled_layout name="vertical" { + tab max_panes=5 { + pane split_direction="vertical" { + pane + pane { children; } + } + } + tab max_panes=8 { + pane split_direction="vertical" { + pane { children; } + pane { pane; pane; pane; pane; } + } + } + tab max_panes=12 { + pane split_direction="vertical" { + pane { children; } + pane { pane; pane; pane; pane; } + pane { pane; pane; pane; pane; } + } + } + } + + swap_tiled_layout name="horizontal" { + tab max_panes=5 { + pane + pane + } + tab max_panes=8 { + pane { + pane split_direction="vertical" { children; } + pane split_direction="vertical" { pane; pane; pane; pane; } + } + } + tab max_panes=12 { + pane { + pane split_direction="vertical" { children; } + pane split_direction="vertical" { pane; pane; pane; pane; } + pane split_direction="vertical" { pane; pane; pane; pane; } + } + } + } + + default_tab_template { + children + pane size=1 borderless=true { + plugin location="file:../target/wasm32-wasi/debug/zjstatus.wasm" { + format_left "{mode}{tabs}" + format_right "#[fg=#83a598,bold]{session} #[fg=#b8bb26,bold]{swap_layout}" + + mode_normal "#[fg=#b8bb26,bold]{name}" + mode_locked "#[fg=#fb4934,bold]{name}" + mode_resize "#[fg=#fabd2f,bold]{name}" + mode_pane "#[fg=#d3869b,bold]{name}" + mode_tab "#[fg=#83a598,bold]{name}" + mode_scroll "#[fg=#8ec07c,bold]{name}" + mode_session "#[fg=#fe8019,bold]{name}" + mode_move "#[fg=#a89984,bold]{name}" + + tab_normal "#[fg=#a89984,bold] {name}" + tab_active "#[fg=#83a598,bold] {name}" + } + } + } +} diff --git a/sl0pstatus/examples/swap-layouts.png b/sl0pstatus/examples/swap-layouts.png Binary files differnew file mode 100644 index 0000000..9d4ea26 --- /dev/null +++ b/sl0pstatus/examples/swap-layouts.png diff --git a/sl0pstatus/examples/tmux.kdl b/sl0pstatus/examples/tmux.kdl new file mode 100644 index 0000000..ca153b5 --- /dev/null +++ b/sl0pstatus/examples/tmux.kdl @@ -0,0 +1,22 @@ +layout { + pane split_direction="vertical" { + pane + } + + pane size=1 borderless=true { + plugin location="file:target/wasm32-wasi/debug/zjstatus.wasm" { + format_left "#[fg=0,bg=10][{session}] {tabs}" + format_right "#[fg=0,bg=10]{datetime}" + format_space "#[bg=10]" + + hide_frame_for_single_pane "true" + + tab_normal "{index}:{name} " + tab_active "{index}:{name}* " + + datetime " {format} " + datetime_format "%H:%M %d-%b-%y" + datetime_timezone "Europe/Berlin" + } + } +} diff --git a/sl0pstatus/examples/tmux.png b/sl0pstatus/examples/tmux.png Binary files differnew file mode 100644 index 0000000..a1c91eb --- /dev/null +++ b/sl0pstatus/examples/tmux.png diff --git a/sl0pstatus/flake.lock b/sl0pstatus/flake.lock new file mode 100644 index 0000000..6d87d0a --- /dev/null +++ b/sl0pstatus/flake.lock @@ -0,0 +1,98 @@ +{ + "nodes": { + "crane": { + "locked": { + "lastModified": 1781825982, + "narHash": "sha256-SlXKwIRIhrOSAcTjCB3ftPLzJWZStQIPS7J1FlZPnKk=", + "owner": "ipetkov", + "repo": "crane", + "rev": "469fd08d0bcf6926321fa973c6777fbc87785dd7", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1781607440, + "narHash": "sha256-rxO+uc/KFbSJp+pgyXRuAX6QlG9hJdnt0BXpEQRXY+U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e41b24abd260e8f71dbe2f5737d24122f972158", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "crane": "crane", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1782184651, + "narHash": "sha256-4XHdXp3MRa++XiGkltJChCtdbCmSlNTwQRfWQOhqbRw=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "f59bc28dd0b89e9c0240d1b80195559fc79c2471", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/sl0pstatus/flake.nix b/sl0pstatus/flake.nix new file mode 100644 index 0000000..e1f861e --- /dev/null +++ b/sl0pstatus/flake.nix @@ -0,0 +1,84 @@ +{ + description = "A configurable and themable statusbar for zellij."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + crane = { + url = "github:ipetkov/crane"; + }; + + flake-utils.url = "github:numtide/flake-utils"; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, crane, flake-utils, rust-overlay, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ (import rust-overlay) ]; + }; + + rustWithWasiTarget = pkgs.rust-bin.stable.latest.default.override { + extensions = [ "rust-src" "rust-std" "rust-analyzer" ]; + targets = [ "wasm32-wasip1" ]; + }; + + # NB: we don't need to overlay our custom toolchain for the *entire* + # pkgs (which would require rebuidling anything else which uses rust). + # Instead, we just want to update the scope that crane will use by appending + # our specific toolchain there. + craneLib = (crane.mkLib pkgs).overrideToolchain rustWithWasiTarget; + + zjstatus = craneLib.buildPackage { + src = craneLib.cleanCargoSource (craneLib.path ./.); + + cargoExtraArgs = "--target wasm32-wasip1"; + + # Tests currently need to be run via `cargo wasi` which + # isn't packaged in nixpkgs yet... + doCheck = false; + doNotSign = true; + + buildInputs = [ + # Add additional build inputs here + pkgs.libiconv + ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ + # Additional darwin specific inputs can be set here + ]; + }; + in + { + checks = { + inherit zjstatus; + }; + + packages.default = zjstatus; + + devShells.default = craneLib.devShell { + # Inherit inputs from checks. + checks = self.checks.${system}; + + # Extra inputs can be added here; cargo and rustc are provided by default + # from the toolchain that was specified earlier. + packages = with pkgs; [ + just + rustWithWasiTarget + cargo-audit + cargo-component + cargo-edit + cargo-nextest + cargo-watch + clippy + libiconv + wasmtime + ]; + }; + } + ); +} diff --git a/sl0pstatus/justfile b/sl0pstatus/justfile new file mode 100644 index 0000000..e7a5fd1 --- /dev/null +++ b/sl0pstatus/justfile @@ -0,0 +1,47 @@ +# Default recipe, when nothing's selected +[private] +default: + just --choose + +# Run benchmarks and compare to previous runs. +bench: + cargo bench --features=bench + +# Build zjstatus with the tracing feature enabled. +build: + cargo build --features tracing + +# Build zjstatus with tracing and start a zellij session with the dev layout. +run target="zjstatus": build + #!/usr/bin/env bash + case "{{target}}" in + "zjframes") + zellij -s zjframes-dev --config ./tests/zjframes/config.kdl -n ./tests/zjframes/layout.kdl + ;; + *) + zellij \ + -s zjstatus-dev \ + --config ./tests/zjstatus/config.kdl \ + -n ./tests/zjstatus/layout.kdl + ;; + esac + +# Watch and run tests with nextest. +test: + cargo watch -x "nextest run --lib" + +# Lint with clippy and cargo audit. +lint: + cargo clippy --all-features --lib + cargo audit + +# Create and push a new release version. +release: + #!/usr/bin/env bash + export VERSION="$( git cliff --bumped-version )" + cargo set-version "${VERSION:1}" + direnv exec . cargo build --release + git commit -am "chore: bump version to $VERSION" + git tag -m "$VERSION" "$VERSION" + git push origin main + git push origin "$VERSION" diff --git a/sl0pstatus/rust-toolchain.toml b/sl0pstatus/rust-toolchain.toml new file mode 100644 index 0000000..a3e1282 --- /dev/null +++ b/sl0pstatus/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.95.0" +components = ["clippy", "rust-src", "rust-std", "rust-analyzer"] +targets = ["wasm32-wasip1"] diff --git a/sl0pstatus/shell.nix b/sl0pstatus/shell.nix new file mode 100644 index 0000000..4fd0820 --- /dev/null +++ b/sl0pstatus/shell.nix @@ -0,0 +1,49 @@ +{ pkgs ? import <nixpkgs> {} }: +with pkgs; +let + pinnedPkgs = fetchFromGitHub { + owner = "NixOS"; + repo = "nixpkgs"; + rev = "a63a64b593dcf2fe05f7c5d666eb395950f36bc9"; + sha256 = "sha256-+ZoAny3ZxLcfMaUoLVgL9Ywb/57wP+EtsdNGuXUJrwg="; + }; + + pkgs = import pinnedPkgs {}; + + inherit (lib) optional optionals; + inherit (darwin.apple_sdk.frameworks) Cocoa CoreGraphics Foundation IOKit Kernel OpenGL Security; +in + pkgs.mkShell rec { + buildInputs = with pkgs; [ + clang + # Replace llvmPackages with llvmPackages_X, where X is the latest LLVM version (at the time of writing, 16) + llvmPackages.bintools + rustup + libiconv + watchexec + ]; + RUSTC_VERSION = pkgs.lib.readFile ./rust-toolchain; + # https://github.com/rust-lang/rust-bindgen#environment-variables + LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ]; + shellHook = '' + export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin + export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/ + ''; + # Add precompiled library to rustc search path + RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [ + # add libraries here (e.g. pkgs.libvmi) + ]); + # Add glibc, clang, glib and other headers to bindgen search path + BINDGEN_EXTRA_CLANG_ARGS = + # Includes with normal include path + (builtins.map (a: ''-I"${a}/include"'') [ + # add dev libraries here (e.g. pkgs.libvmi.dev) + pkgs.libiconv + ]) + # Includes with special directory paths + ++ [ + ''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"'' + ''-I"${pkgs.libiconv.out}/lib/"'' + ]; + + } diff --git a/sl0pstatus/src/bin/zjframes.rs b/sl0pstatus/src/bin/zjframes.rs new file mode 100644 index 0000000..7b32d01 --- /dev/null +++ b/sl0pstatus/src/bin/zjframes.rs @@ -0,0 +1,215 @@ +use zellij_tile::prelude::*; + +use std::collections::BTreeMap; + +use zjstatus::frames; + +#[derive(Default, Debug, Clone)] +pub struct ZellijState { + pub mode: ModeInfo, + pub panes: PaneManifest, + pub tabs: Vec<TabInfo>, +} + +#[derive(Default)] +struct State { + pending_events: Vec<Event>, + got_permissions: bool, + state: ZellijState, + + hide_frame_for_single_pane: bool, + hide_frame_except_for_search: bool, + hide_frame_except_for_fullscreen: bool, + hide_frame_except_for_scroll: bool, + + err: Option<anyhow::Error>, +} + +#[cfg(not(test))] +register_plugin!(State); + +#[cfg(feature = "tracing")] +fn init_tracing() { + use std::{fs::File, sync::Arc}; + use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; + + let file = File::create("/host/.zjframes.log"); + let file = match file { + Ok(file) => file, + Err(error) => panic!("Error: {:?}", error), + }; + let debug_log = tracing_subscriber::fmt::layer().with_writer(Arc::new(file)); + + tracing_subscriber::registry().with(debug_log).init(); + + tracing::info!("tracing initialized"); +} + +impl ZellijPlugin for State { + fn load(&mut self, configuration: BTreeMap<String, String>) { + #[cfg(feature = "tracing")] + init_tracing(); + + // we need the ReadApplicationState permission to receive the ModeUpdate and TabUpdate + // events + // we need the RunCommands permission to run "cargo test" in a floating window + request_permission(&[ + PermissionType::ReadApplicationState, + PermissionType::ChangeApplicationState, + ]); + + subscribe(&[ + EventType::ModeUpdate, + EventType::PaneUpdate, + EventType::PermissionRequestResult, + EventType::TabUpdate, + EventType::SessionUpdate, + ]); + + self.hide_frame_for_single_pane = match configuration.get("hide_frame_for_single_pane") { + Some(toggle) => toggle == "true", + None => false, + }; + self.hide_frame_except_for_search = match configuration.get("hide_frame_except_for_search") + { + Some(toggle) => toggle == "true", + None => false, + }; + self.hide_frame_except_for_fullscreen = + match configuration.get("hide_frame_except_for_fullscreen") { + Some(toggle) => toggle == "true", + None => false, + }; + self.hide_frame_except_for_scroll= + match configuration.get("hide_frame_except_for_scroll") { + Some(toggle) => toggle == "true", + None => false, + }; + + self.pending_events = Vec::new(); + self.got_permissions = false; + self.state = ZellijState::default(); + } + + #[tracing::instrument(skip_all, fields(event_type))] + fn update(&mut self, event: Event) -> bool { + if let Event::PermissionRequestResult(PermissionStatus::Granted) = event { + self.got_permissions = true; + + while !self.pending_events.is_empty() { + tracing::debug!("processing cached event"); + let ev = self.pending_events.pop(); + + self.handle_event(ev.unwrap()); + } + } + + if !self.got_permissions { + tracing::debug!("caching event"); + self.pending_events.push(event); + + return false; + } + + self.handle_event(event) + } + + #[tracing::instrument(skip_all)] + fn render(&mut self, _rows: usize, _cols: usize) { + if !self.got_permissions { + return; + } + + if let Some(err) = &self.err { + println!("Error: {:?}", err); + + return; + } + + print!("Please load this plugin in the background"); + } +} + +impl State { + fn handle_event(&mut self, event: Event) -> bool { + let mut should_render = false; + match event { + Event::ModeUpdate(mode_info) => { + tracing::Span::current().record("event_type", "Event::ModeUpdate"); + tracing::debug!(mode = ?mode_info.mode); + tracing::debug!(mode = ?mode_info.session_name); + + self.state.mode = mode_info; + + frames::hide_frames_conditionally( + &frames::FrameConfig::new( + self.hide_frame_for_single_pane, + self.hide_frame_except_for_search, + self.hide_frame_except_for_fullscreen, + self.hide_frame_except_for_scroll, + ), + &self.state.tabs, + &self.state.panes, + &self.state.mode, + get_plugin_ids(), + true, + ); + } + Event::PaneUpdate(pane_info) => { + tracing::Span::current().record("event_type", "Event::PaneUpdate"); + tracing::debug!(pane_count = ?pane_info.panes.len()); + + self.state.panes = pane_info; + + frames::hide_frames_conditionally( + &frames::FrameConfig::new( + self.hide_frame_for_single_pane, + self.hide_frame_except_for_search, + self.hide_frame_except_for_fullscreen, + self.hide_frame_except_for_scroll, + ), + &self.state.tabs, + &self.state.panes, + &self.state.mode, + get_plugin_ids(), + true, + ); + } + Event::PermissionRequestResult(result) => { + tracing::Span::current().record("event_type", "Event::PermissionRequestResult"); + tracing::debug!(result = ?result); + set_selectable(false); + should_render = true; + } + Event::SessionUpdate(session_info, _) => { + tracing::Span::current().record("event_type", "Event::SessionUpdate"); + + let current_session = session_info.iter().find(|s| s.is_current_session); + + if let Some(current_session) = current_session { + frames::hide_frames_conditionally( + &frames::FrameConfig::new( + self.hide_frame_for_single_pane, + self.hide_frame_except_for_search, + self.hide_frame_except_for_fullscreen, + self.hide_frame_except_for_scroll, + ), + ¤t_session.tabs, + ¤t_session.panes, + &self.state.mode, + get_plugin_ids(), + true, + ); + } + } + Event::TabUpdate(tab_info) => { + tracing::Span::current().record("event_type", "Event::TabUpdate"); + tracing::debug!(tab_count = ?tab_info.len()); + + self.state.tabs = tab_info; + } + _ => (), + }; + should_render + } +} diff --git a/sl0pstatus/src/bin/zjstatus.rs b/sl0pstatus/src/bin/zjstatus.rs new file mode 100644 index 0000000..f9d95c7 --- /dev/null +++ b/sl0pstatus/src/bin/zjstatus.rs @@ -0,0 +1,463 @@ +use zellij_tile::prelude::*; + +use chrono::Local; +use std::{collections::BTreeMap, path::PathBuf, sync::Arc}; +use uuid::Uuid; + +use zjstatus::{ + config::{self, ModuleConfig, UpdateEventMask, ZellijState}, + frames, pipe, + widgets::{ + command::{CommandResult, CommandWidget}, + datetime::DateTimeWidget, + mode::ModeWidget, + notification::NotificationWidget, + pipe::PipeWidget, + session::SessionWidget, + swap_layout::SwapLayoutWidget, + tabs::TabsWidget, + widget::Widget, + }, +}; + +// Matches the old incidental Zellij session scan cadence. +const REFRESH_INTERVAL_SECONDS: f64 = 1.0; + +#[derive(Default)] +struct State { + pending_events: Vec<Event>, + got_permissions: bool, + state: ZellijState, + userspace_configuration: BTreeMap<String, String>, + module_config: config::ModuleConfig, + widget_map: BTreeMap<String, Arc<dyn Widget>>, + focus_cwd_commands: Vec<String>, + err: Option<anyhow::Error>, +} + +#[cfg(not(test))] +register_plugin!(State); + +#[cfg(feature = "tracing")] +fn init_tracing() { + use std::fs::File; + use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; + + let file = File::create("/host/.zjstatus.log"); + let file = match file { + Ok(file) => file, + Err(error) => panic!("Error: {:?}", error), + }; + let debug_log = tracing_subscriber::fmt::layer().with_writer(Arc::new(file)); + + tracing_subscriber::registry().with(debug_log).init(); + + tracing::info!("tracing initialized"); +} + +impl ZellijPlugin for State { + fn load(&mut self, configuration: BTreeMap<String, String>) { + #[cfg(feature = "tracing")] + init_tracing(); + + // we need the ReadApplicationState permission to receive the ModeUpdate and TabUpdate + // events + // we need the RunCommands permission to run "cargo test" in a floating window + request_permission(&[ + PermissionType::ReadApplicationState, + PermissionType::ChangeApplicationState, + PermissionType::RunCommands, + ]); + + subscribe(&[ + EventType::Mouse, + EventType::ModeUpdate, + EventType::PaneUpdate, + EventType::PermissionRequestResult, + EventType::Timer, + EventType::TabUpdate, + EventType::SessionUpdate, + EventType::RunCommandResult, + EventType::CwdChanged, + ]); + set_timeout(REFRESH_INTERVAL_SECONDS); + + self.module_config = match ModuleConfig::new(&configuration) { + Ok(mc) => mc, + Err(e) => { + self.err = Some(e); + return; + } + }; + self.widget_map = register_widgets(&configuration); + self.focus_cwd_commands = + zjstatus::widgets::command::focus_cwd_command_names(&configuration); + self.userspace_configuration = configuration; + self.pending_events = Vec::new(); + self.got_permissions = false; + let uid = Uuid::new_v4(); + + self.state = ZellijState { + cols: 0, + command_results: BTreeMap::new(), + pipe_results: BTreeMap::new(), + mode: ModeInfo::default(), + panes: PaneManifest::default(), + plugin_uuid: uid.to_string(), + tabs: Vec::new(), + sessions: Vec::new(), + start_time: Local::now(), + cache_mask: 0, + incoming_notification: None, + focused_pane_id: None, + focused_pane_cwd: None, + }; + } + + fn pipe(&mut self, pipe_message: PipeMessage) -> bool { + let mut should_render = false; + + match pipe_message.source { + PipeSource::Cli(_) => { + if let Some(input) = pipe_message.payload { + should_render = pipe::parse_protocol(&mut self.state, &input); + } + } + PipeSource::Plugin(_) => { + if let Some(input) = pipe_message.payload { + should_render = pipe::parse_protocol(&mut self.state, &input); + } + } + PipeSource::Keybind => { + if let Some(input) = pipe_message.payload { + should_render = pipe::parse_protocol(&mut self.state, &input); + } + } + } + + should_render + } + + #[tracing::instrument(skip_all, fields(event_type))] + fn update(&mut self, event: Event) -> bool { + if let Event::PermissionRequestResult(PermissionStatus::Granted) = event { + self.got_permissions = true; + + while !self.pending_events.is_empty() { + tracing::debug!("processing cached event"); + let ev = self.pending_events.pop(); + + self.handle_event(ev.unwrap()); + } + } + + if !self.got_permissions { + tracing::debug!("caching event"); + self.pending_events.push(event); + + return false; + } + + self.handle_event(event) + } + + #[tracing::instrument(skip_all)] + fn render(&mut self, _rows: usize, cols: usize) { + if !self.got_permissions { + return; + } + + if let Some(err) = &self.err { + println!("Error: {:?}", err); + + return; + } + + self.state.cols = cols; + + tracing::debug!("{:?}", self.state.mode.session_name); + + let output = self + .module_config + .render_bar(self.state.clone(), self.widget_map.clone()); + + print!("{}", output); + } +} + +impl State { + fn update_focused_pane(&mut self) { + let active_tab = self.state.tabs.iter().find(|t| t.active); + + let new_id = active_tab + .and_then(|tab| self.state.panes.panes.get(&tab.position)) + .and_then(|panes| panes.iter().find(|p| p.is_focused && !p.is_plugin)) + .map(|p| PaneId::Terminal(p.id)); + + if new_id == self.state.focused_pane_id { + return; + } + + self.state.focused_pane_id = new_id; + + let new_cwd = match new_id { + Some(pane_id) => match get_pane_cwd(pane_id) { + Ok(cwd) => Some(cwd), + Err(e) => { + tracing::debug!("could not get pane cwd: {e}"); + None + } + }, + None => None, + }; + + self.set_focused_pane_cwd(new_cwd); + } + + fn set_focused_pane_cwd(&mut self, new_cwd: Option<PathBuf>) -> bool { + if new_cwd == self.state.focused_pane_cwd { + return false; + } + + self.state.focused_pane_cwd = new_cwd; + + if self.focus_cwd_commands.is_empty() { + return false; + } + + self.invalidate_focus_cwd_commands(); + true + } + + fn invalidate_focus_cwd_commands(&mut self) { + for name in &self.focus_cwd_commands { + pipe::invalidate_command_result(&mut self.state, name); + zjstatus::widgets::command::release_command_lock(&self.state, name); + } + } + + fn handle_event(&mut self, event: Event) -> bool { + let mut should_render = false; + match event { + Event::Mouse(mouse_info) => { + tracing::Span::current().record("event_type", "Event::Mouse"); + tracing::debug!(mouse = ?mouse_info); + + self.module_config.handle_mouse_action( + self.state.clone(), + mouse_info, + self.widget_map.clone(), + ); + } + Event::ModeUpdate(mode_info) => { + tracing::Span::current().record("event_type", "Event::ModeUpdate"); + tracing::debug!(mode = ?mode_info.mode); + tracing::debug!(mode = ?mode_info.session_name); + + self.state.mode = mode_info; + self.state.cache_mask = UpdateEventMask::Mode as u8; + + should_render = true; + } + Event::PaneUpdate(pane_info) => { + tracing::Span::current().record("event_type", "Event::PaneUpdate"); + tracing::debug!(pane_count = ?pane_info.panes.len()); + + frames::hide_frames_conditionally( + &frames::FrameConfig::new( + self.module_config.hide_frame_for_single_pane, + self.module_config.hide_frame_except_for_search, + self.module_config.hide_frame_except_for_fullscreen, + self.module_config.hide_frame_except_for_scroll, + ), + &self.state.tabs, + &pane_info, + &self.state.mode, + get_plugin_ids(), + false, + ); + + self.state.panes = pane_info; + self.state.cache_mask = UpdateEventMask::Tab as u8; + + self.update_focused_pane(); + + should_render = true; + } + Event::CwdChanged(pane_id, cwd, _clients) => { + tracing::Span::current().record("event_type", "Event::CwdChanged"); + tracing::debug!(pane_id = ?pane_id, cwd = ?cwd); + + if Some(pane_id) == self.state.focused_pane_id + && self.set_focused_pane_cwd(Some(cwd)) + { + self.state.cache_mask = UpdateEventMask::Command as u8; + should_render = true; + } + } + Event::PermissionRequestResult(result) => { + tracing::Span::current().record("event_type", "Event::PermissionRequestResult"); + tracing::debug!(result = ?result); + set_selectable(false); + } + Event::RunCommandResult(exit_code, stdout, stderr, context) => { + tracing::Span::current().record("event_type", "Event::RunCommandResult"); + tracing::debug!( + exit_code = ?exit_code, + stdout = ?String::from_utf8(stdout.clone()), + stderr = ?String::from_utf8(stderr.clone()), + context = ?context + ); + + self.state.cache_mask = UpdateEventMask::Command as u8; + + if let Some(name) = context.get("name") { + if self.focus_cwd_commands.iter().any(|n| n == name) + && context.get("cwd").map(PathBuf::from) != self.state.focused_pane_cwd + { + tracing::debug!("discarding stale command result for {name}"); + return false; + } + + let stdout = match String::from_utf8(stdout) { + Ok(s) => s, + Err(_) => "".to_owned(), + }; + + let stderr = match String::from_utf8(stderr) { + Ok(s) => s, + Err(_) => "".to_owned(), + }; + + self.state.command_results.insert( + name.to_owned(), + CommandResult { + exit_code, + stdout, + stderr, + context, + }, + ); + } + } + Event::SessionUpdate(session_info, _) => { + tracing::Span::current().record("event_type", "Event::SessionUpdate"); + + let current_session = session_info.iter().find(|s| s.is_current_session); + + if let Some(current_session) = current_session { + frames::hide_frames_conditionally( + &frames::FrameConfig::new( + self.module_config.hide_frame_for_single_pane, + self.module_config.hide_frame_except_for_search, + self.module_config.hide_frame_except_for_fullscreen, + self.module_config.hide_frame_except_for_scroll, + ), + ¤t_session.tabs, + ¤t_session.panes, + &self.state.mode, + get_plugin_ids(), + false, + ); + } + + self.state.sessions = session_info; + self.state.cache_mask = UpdateEventMask::Session as u8; + + should_render = true; + } + Event::TabUpdate(tab_info) => { + tracing::Span::current().record("event_type", "Event::TabUpdate"); + tracing::debug!(tab_count = ?tab_info.len()); + + self.state.cache_mask = UpdateEventMask::Tab as u8; + self.state.tabs = tab_info; + + should_render = true; + } + Event::Timer(_) => { + tracing::Span::current().record("event_type", "Event::Timer"); + set_timeout(REFRESH_INTERVAL_SECONDS); + self.state.cache_mask = 0; + + should_render = true; + } + _ => (), + }; + should_render + } +} + +fn register_widgets(configuration: &BTreeMap<String, String>) -> BTreeMap<String, Arc<dyn Widget>> { + let mut widget_map = BTreeMap::<String, Arc<dyn Widget>>::new(); + + widget_map.insert( + "command".to_owned(), + Arc::new(CommandWidget::new(configuration)), + ); + widget_map.insert( + "datetime".to_owned(), + Arc::new(DateTimeWidget::new(configuration)), + ); + widget_map.insert("pipe".to_owned(), Arc::new(PipeWidget::new(configuration))); + widget_map.insert( + "swap_layout".to_owned(), + Arc::new(SwapLayoutWidget::new(configuration)), + ); + widget_map.insert("mode".to_owned(), Arc::new(ModeWidget::new(configuration))); + widget_map.insert( + "session".to_owned(), + Arc::new(SessionWidget::new(configuration)), + ); + widget_map.insert("tabs".to_owned(), Arc::new(TabsWidget::new(configuration))); + widget_map.insert( + "notifications".to_owned(), + Arc::new(NotificationWidget::new(configuration)), + ); + + tracing::debug!("registered widgets: {:?}", widget_map.keys()); + + widget_map +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn set_focused_pane_cwd_only_invalidates_on_change() { + let mut state = State { + focus_cwd_commands: vec!["command_branch".to_owned()], + ..State::default() + }; + state.state.focused_pane_cwd = Some(PathBuf::from("/tmp")); + state.state.command_results.insert( + "command_branch".to_owned(), + CommandResult { + context: BTreeMap::from([( + "timestamp".to_owned(), + Local::now() + .format(zjstatus::widgets::command::TIMESTAMP_FORMAT) + .to_string(), + )]), + ..CommandResult::default() + }, + ); + + let original_timestamp = + state.state.command_results["command_branch"].context["timestamp"].clone(); + + assert!(!state.set_focused_pane_cwd(Some(PathBuf::from("/tmp")))); + assert_eq!( + state.state.command_results["command_branch"].context["timestamp"], + original_timestamp + ); + + assert!(state.set_focused_pane_cwd(Some(PathBuf::from("/var")))); + assert_eq!(state.state.focused_pane_cwd, Some(PathBuf::from("/var"))); + assert_ne!( + state.state.command_results["command_branch"].context["timestamp"], + original_timestamp + ); + } +} diff --git a/sl0pstatus/src/border.rs b/sl0pstatus/src/border.rs new file mode 100644 index 0000000..c0c06d5 --- /dev/null +++ b/sl0pstatus/src/border.rs @@ -0,0 +1,71 @@ +use std::collections::BTreeMap; + +use crate::render::FormattedPart; + +const DEFAULT_CHAR: &str = "─"; + +#[derive(Default, PartialEq, Debug)] +pub enum BorderPosition { + #[default] + Top, + Bottom, +} + +#[derive(Debug)] +pub struct BorderConfig { + pub enabled: bool, + pub char: String, + pub format: FormattedPart, + pub position: BorderPosition, +} + +impl Default for BorderConfig { + fn default() -> Self { + Self { + enabled: false, + char: DEFAULT_CHAR.to_owned(), + format: FormattedPart::default(), + position: BorderPosition::default(), + } + } +} + +impl BorderConfig { + pub fn draw(&self, cols: usize) -> String { + self.format.format_string(&self.char.repeat(cols)) + } +} + +pub fn parse_border_config(config: &BTreeMap<String, String>) -> Option<BorderConfig> { + let enabled = match config.get("border_enabled") { + Some(e) => matches!(e.as_str(), "true"), + None => { + return None; + } + }; + + let char = match config.get("border_char") { + Some(bc) => bc, + None => DEFAULT_CHAR, + }; + + let format = match config.get("border_format") { + Some(bfs) => bfs, + None => "", + }; + + let position = match config.get("border_position") { + Some(pos) => match pos.to_owned().as_str() { + "bottom" => BorderPosition::Bottom, + _ => BorderPosition::Top, + }, + None => BorderPosition::Top, + }; + + Some(BorderConfig { + enabled, + char: char.to_owned(), + format: FormattedPart::from_format_string(format, config), + position, + }) +} diff --git a/sl0pstatus/src/config.rs b/sl0pstatus/src/config.rs new file mode 100644 index 0000000..093d15e --- /dev/null +++ b/sl0pstatus/src/config.rs @@ -0,0 +1,552 @@ +use std::{collections::BTreeMap, str::FromStr, sync::Arc}; + +use itertools::Itertools; +use regex::Regex; +use zellij_tile::prelude::*; + +use crate::{ + border::{parse_border_config, BorderConfig, BorderPosition}, + render::FormattedPart, + widgets::{command::CommandResult, notification, widget::Widget}, +}; +use chrono::{DateTime, Local}; + +#[derive(Default, Debug, Clone)] +pub struct ZellijState { + pub cols: usize, + pub command_results: BTreeMap<String, CommandResult>, + pub pipe_results: BTreeMap<String, String>, + pub mode: ModeInfo, + pub panes: PaneManifest, + pub plugin_uuid: String, + pub tabs: Vec<TabInfo>, + pub sessions: Vec<SessionInfo>, + pub start_time: DateTime<Local>, + pub incoming_notification: Option<notification::Message>, + pub cache_mask: u8, + pub focused_pane_id: Option<PaneId>, + pub focused_pane_cwd: Option<std::path::PathBuf>, +} + +#[derive(Clone, Debug, Ord, Eq, PartialEq, PartialOrd, Copy)] +pub enum Part { + Left, + Center, + Right, +} + +impl FromStr for Part { + fn from_str(part: &str) -> Result<Self> { + match part { + "l" => Ok(Part::Left), + "c" => Ok(Part::Center), + "r" => Ok(Part::Right), + _ => anyhow::bail!("Invalid part: {}", part), + } + } + + type Err = anyhow::Error; +} + +pub enum UpdateEventMask { + Always = 0b10000000, + Mode = 0b00000001, + Tab = 0b00000011, + Command = 0b00000100, + Session = 0b00001000, + None = 0b00000000, +} + +pub fn event_mask_from_widget_name(name: &str) -> u8 { + match name { + "command" => UpdateEventMask::Always as u8, + "datetime" => UpdateEventMask::Always as u8, + "mode" => UpdateEventMask::Mode as u8, + "notifications" => UpdateEventMask::Always as u8, + "session" => UpdateEventMask::Mode as u8, + "swap_layout" => UpdateEventMask::Tab as u8, + "tabs" => UpdateEventMask::Tab as u8, + "pipe" => UpdateEventMask::Always as u8, + _ => UpdateEventMask::None as u8, + } +} + +#[derive(Default, Debug)] +pub struct ModuleConfig { + pub left_parts_config: String, + pub left_parts: Vec<FormattedPart>, + pub center_parts_config: String, + pub center_parts: Vec<FormattedPart>, + pub right_parts_config: String, + pub right_parts: Vec<FormattedPart>, + pub format_space: FormattedPart, + pub hide_frame_for_single_pane: bool, + pub hide_frame_except_for_search: bool, + pub hide_frame_except_for_fullscreen: bool, + pub hide_frame_except_for_scroll: bool, + pub border: BorderConfig, + pub format_precedence: Vec<Part>, + pub hide_on_overlength: bool, +} + +impl ModuleConfig { + pub fn new(config: &BTreeMap<String, String>) -> anyhow::Result<Self> { + let format_space_config = match config.get("format_space") { + Some(space_config) => space_config, + None => "", + }; + + let hide_frame_for_single_pane = match config.get("hide_frame_for_single_pane") { + Some(toggle) => toggle == "true", + None => false, + }; + let hide_frame_except_for_search = match config.get("hide_frame_except_for_search") { + Some(toggle) => toggle == "true", + None => false, + }; + let hide_frame_except_for_fullscreen = match config.get("hide_frame_except_for_fullscreen") + { + Some(toggle) => toggle == "true", + None => false, + }; + let hide_frame_except_for_scroll = match config.get("hide_frame_except_for_scroll") { + Some(toggle) => toggle == "true", + None => false, + }; + + let left_parts_config = match config.get("format_left") { + Some(conf) => conf, + None => "", + }; + + let right_parts_config = match config.get("format_right") { + Some(conf) => conf, + None => "", + }; + + let center_parts_config = match config.get("format_center") { + Some(conf) => conf, + None => "", + }; + + let format_precedence = match config.get("format_precedence") { + Some(conf) => { + let prec = conf + .chars() + .map(|c| Part::from_str(&c.to_string())) + .collect(); + + match prec { + Ok(prec) => prec, + Err(e) => { + anyhow::bail!("Invalid format_precedence: {}", e); + } + } + } + None => vec![Part::Left, Part::Center, Part::Right], + }; + + let hide_on_overlength = match config.get("format_hide_on_overlength") { + Some(opt) => opt == "true", + None => false, + }; + + let border_config = parse_border_config(config).unwrap_or_default(); + + Ok(Self { + left_parts_config: left_parts_config.to_owned(), + left_parts: parts_from_config(Some(&left_parts_config.to_owned()), config), + center_parts_config: center_parts_config.to_owned(), + center_parts: parts_from_config(Some(¢er_parts_config.to_owned()), config), + right_parts_config: right_parts_config.to_owned(), + right_parts: parts_from_config(Some(&right_parts_config.to_owned()), config), + format_space: FormattedPart::from_format_string(format_space_config, config), + hide_frame_for_single_pane, + hide_frame_except_for_search, + hide_frame_except_for_fullscreen, + hide_frame_except_for_scroll, + border: border_config, + format_precedence, + hide_on_overlength, + }) + } + + pub fn handle_mouse_action( + &mut self, + state: ZellijState, + mouse: Mouse, + widget_map: BTreeMap<String, Arc<dyn Widget>>, + ) { + let click_pos = match mouse { + Mouse::ScrollUp(_) => return, + Mouse::ScrollDown(_) => return, + Mouse::LeftClick(_, y) => y, + Mouse::RightClick(_, y) => y, + Mouse::Hold(_, y) => y, + Mouse::Release(_, y) => y, + Mouse::Hover(_, _) => return, + }; + + let output_left = self.left_parts.iter_mut().fold("".to_owned(), |acc, part| { + format!( + "{}{}", + acc, + part.format_string_with_widgets(&widget_map, &state) + ) + }); + + let output_center = self + .center_parts + .iter_mut() + .fold("".to_owned(), |acc, part| { + format!( + "{}{}", + acc, + part.format_string_with_widgets(&widget_map, &state) + ) + }); + + let output_right = self + .right_parts + .iter_mut() + .fold("".to_owned(), |acc, part| { + format!( + "{}{}", + acc, + part.format_string_with_widgets(&widget_map, &state) + ) + }); + + let (output_left, output_center, output_right) = match self.hide_on_overlength { + true => self.trim_output(&output_left, &output_center, &output_right, state.cols), + false => (output_left, output_center, output_right), + }; + + let mut offset = console::measure_text_width(&output_left); + + self.process_widget_click(click_pos, &self.left_parts, &widget_map, &state, 0); + + if click_pos <= offset { + return; + } + + if !output_center.is_empty() { + tracing::debug!("widgetclick center"); + offset += console::measure_text_width(&self.get_spacer_left( + &output_left, + &output_center, + state.cols, + )); + + offset += self.process_widget_click( + click_pos, + &self.center_parts, + &widget_map, + &state, + offset, + ); + + if click_pos <= offset { + return; + } + + offset += console::measure_text_width(&self.get_spacer_right( + &output_right, + &output_center, + state.cols, + )); + } else { + offset += console::measure_text_width(&self.get_spacer( + &output_left, + &output_right, + state.cols, + )); + } + + self.process_widget_click(click_pos, &self.right_parts, &widget_map, &state, offset); + } + + fn process_widget_click( + &self, + click_pos: usize, + widgets: &[FormattedPart], + widget_map: &BTreeMap<String, Arc<dyn Widget>>, + state: &ZellijState, + offset: usize, + ) -> usize { + let widget_string = widgets.iter().fold(String::new(), |a, b| a + &b.content); + + let mut rendered_output = widget_string.clone(); + + let tokens: Vec<String> = widget_map.keys().map(|k| k.to_owned()).collect(); + + let widgets_regex = Regex::new("(\\{[a-z_0-9]+\\})").unwrap(); + for widget in widgets_regex.captures_iter(widget_string.as_str()) { + let match_name = widget.get(0).unwrap().as_str(); + let widget_key = match_name.trim_matches(|c| c == '{' || c == '}'); + let mut widget_key_name = widget_key; + + if widget_key.starts_with("command_") { + widget_key_name = "command"; + } + + if widget_key.starts_with("pipe_") { + widget_key_name = "pipe"; + } + + if !tokens.contains(&widget_key_name.to_owned()) { + continue; + } + + let wid = match widget_map.get(widget_key_name) { + Some(wid) => wid, + None => continue, + }; + + let pos = match rendered_output.find(match_name) { + Some(_pos) => { + let pref = rendered_output.split(match_name).collect::<Vec<&str>>()[0]; + console::measure_text_width(pref) + } + None => continue, + }; + + let wid_res = wid.process(widget_key, state); + rendered_output = rendered_output.replace(match_name, &wid_res); + + if click_pos < pos + offset + || click_pos > pos + offset + console::measure_text_width(&wid_res) + { + continue; + } + + wid.process_click(widget_key, state, click_pos - (pos + offset)); + } + + console::measure_text_width(&rendered_output) + } + + pub fn render_bar( + &mut self, + state: ZellijState, + widget_map: BTreeMap<String, Arc<dyn Widget>>, + ) -> String { + if self.left_parts.is_empty() && self.center_parts.is_empty() && self.right_parts.is_empty() + { + return "No configuration found. See https://github.com/dj95/zjstatus/wiki/3-%E2%80%90-Configuration for more info".to_string(); + } + + let output_left = self.left_parts.iter_mut().fold("".to_owned(), |acc, part| { + format!( + "{acc}{}", + part.format_string_with_widgets(&widget_map, &state) + ) + }); + + let output_center = self + .center_parts + .iter_mut() + .fold("".to_owned(), |acc, part| { + format!( + "{acc}{}", + part.format_string_with_widgets(&widget_map, &state) + ) + }); + + let output_right = self + .right_parts + .iter_mut() + .fold("".to_owned(), |acc, part| { + format!( + "{acc}{}", + part.format_string_with_widgets(&widget_map, &state) + ) + }); + + let (output_left, output_center, output_right) = match self.hide_on_overlength { + true => self.trim_output(&output_left, &output_center, &output_right, state.cols), + false => (output_left, output_center, output_right), + }; + + if self.border.enabled { + let mut border_top = "".to_owned(); + if self.border.enabled && self.border.position == BorderPosition::Top { + border_top = format!("{}\n", self.border.draw(state.cols)); + } + + let mut border_bottom = "".to_owned(); + if self.border.enabled && self.border.position == BorderPosition::Bottom { + border_bottom = format!("\n{}", self.border.draw(state.cols)); + } + + if !output_center.is_empty() { + return format!( + "{}{}{}{}{}{}{}", + border_top, + output_left, + self.get_spacer_left(&output_left, &output_center, state.cols), + output_center, + self.get_spacer_right(&output_right, &output_center, state.cols), + output_right, + border_bottom, + ); + } + + return format!( + "{}{}{}{}{}", + border_top, + output_left, + self.get_spacer(&output_left, &output_right, state.cols), + output_right, + border_bottom, + ); + } + + if !output_center.is_empty() { + return format!( + "{}{}{}{}{}", + output_left, + self.get_spacer_left(&output_left, &output_center, state.cols), + output_center, + self.get_spacer_right(&output_right, &output_center, state.cols), + output_right, + ); + } + + format!( + "{}{}{}", + output_left, + self.get_spacer(&output_left, &output_right, state.cols), + output_right, + ) + } + + fn trim_output( + &self, + output_left: &str, + output_center: &str, + output_right: &str, + cols: usize, + ) -> (String, String, String) { + let center_pos = (cols as f32 / 2.0).floor() as usize; + + let mut output = BTreeMap::from([ + (Part::Left, output_left.to_owned()), + (Part::Center, output_center.to_owned()), + (Part::Right, output_right.to_owned()), + ]); + + let combinations = [ + (self.format_precedence[2], self.format_precedence[1]), + (self.format_precedence[1], self.format_precedence[0]), + (self.format_precedence[2], self.format_precedence[0]), + ]; + + for win in combinations.iter() { + let (a, b) = win; + + let part_a = output.get(a).unwrap(); + let part_b = output.get(b).unwrap(); + + let a_count = console::measure_text_width(part_a); + let b_count = console::measure_text_width(part_b); + + let overlap = match (a, b) { + (Part::Left, Part::Right) => a_count + b_count > cols, + (Part::Right, Part::Left) => a_count + b_count > cols, + (Part::Left, Part::Center) => a_count > center_pos - (b_count / 2), + (Part::Center, Part::Left) => b_count > center_pos - (a_count / 2), + (Part::Right, Part::Center) => a_count > center_pos - (b_count / 2), + (Part::Center, Part::Right) => b_count > center_pos - (a_count / 2), + _ => false, + }; + + if overlap { + output.insert(*a, "".to_owned()); + } + } + + output.values().cloned().collect_tuple().unwrap() + } + + #[tracing::instrument(skip_all)] + fn get_spacer_left(&self, output_left: &str, output_center: &str, cols: usize) -> String { + let text_count = console::measure_text_width(output_left) + + (console::measure_text_width(output_center) as f32 / 2.0).floor() as usize; + + let center_pos = (cols as f32 / 2.0).floor() as usize; + + // verify we are able to count the difference, since zellij sometimes drops a col + // count of 0 on tab creation + let space_count = center_pos.saturating_sub(text_count); + + tracing::debug!("space_count: {:?}", space_count); + self.format_space.format_string(&" ".repeat(space_count)) + } + + #[tracing::instrument(skip_all)] + fn get_spacer_right(&self, output_right: &str, output_center: &str, cols: usize) -> String { + let text_count = console::measure_text_width(output_right) + + (console::measure_text_width(output_center) as f32 / 2.0).ceil() as usize; + + let center_pos = (cols as f32 / 2.0).ceil() as usize; + + // verify we are able to count the difference, since zellij sometimes drops a col + // count of 0 on tab creation + let space_count = center_pos.saturating_sub(text_count); + + tracing::debug!("space_count: {:?}", space_count); + self.format_space.format_string(&" ".repeat(space_count)) + } + + fn get_spacer(&self, output_left: &str, output_right: &str, cols: usize) -> String { + let text_count = + console::measure_text_width(output_left) + console::measure_text_width(output_right); + + // verify we are able to count the difference, since zellij sometimes drops a col + // count of 0 on tab creation + let space_count = cols.saturating_sub(text_count); + + self.format_space.format_string(&" ".repeat(space_count)) + } +} + +fn parts_from_config( + format: Option<&String>, + config: &BTreeMap<String, String>, +) -> Vec<FormattedPart> { + match format { + Some(format) => match format.is_empty() { + true => vec![], + false => format + .split("#[") + .map(|s| FormattedPart::from_format_string(s, config)) + .collect(), + }, + None => vec![], + } +} + +#[cfg(test)] +mod test { + use super::*; + use anstyle::{Effects, RgbColor}; + + #[test] + fn test_formatted_part_from_string() { + let input = "#[fg=#ff0000,bg=#00ff00,bold,italic]foo"; + + let part = FormattedPart::from_format_string(input, &BTreeMap::new()); + + assert_eq!( + part, + FormattedPart { + fg: Some(RgbColor(255, 0, 0).into()), + bg: Some(RgbColor(0, 255, 0).into()), + effects: Effects::BOLD | Effects::ITALIC, + content: "foo".to_owned(), + ..Default::default() + }, + ) + } +} diff --git a/sl0pstatus/src/frames.rs b/sl0pstatus/src/frames.rs new file mode 100644 index 0000000..c7d1332 --- /dev/null +++ b/sl0pstatus/src/frames.rs @@ -0,0 +1,149 @@ +use zellij_tile::prelude::*; + +pub struct FrameConfig { + pub hide_frames_for_single_pane: bool, + pub hide_frames_except_for_search: bool, + pub hide_frames_except_for_fullscreen: bool, + pub hide_frames_except_for_scroll: bool, +} + +impl FrameConfig { + pub fn new( + hide_frames_for_single_pane: bool, + hide_frames_except_for_search: bool, + hide_frames_except_for_fullscreen: bool, + hide_frames_except_for_scroll: bool, + ) -> Self { + Self { + hide_frames_for_single_pane, + hide_frames_except_for_search, + hide_frames_except_for_fullscreen, + hide_frames_except_for_scroll, + } + } + + pub fn is_disabled(&self) -> bool { + !self.hide_frames_for_single_pane + && !self.hide_frames_except_for_search + && !self.hide_frames_except_for_fullscreen + && !self.hide_frames_except_for_scroll + } +} + +#[tracing::instrument(skip_all)] +pub fn hide_frames_conditionally( + config: &FrameConfig, + tabs: &[TabInfo], + pane_info: &PaneManifest, + mode_info: &ModeInfo, + plugin_pane_id: PluginIds, + is_zjframes: bool, +) { + if config.is_disabled() { + return; + } + + let panes = match get_current_panes(tabs, pane_info) { + Some(panes) => panes, + None => return, + }; + + // check if we are running for the current tab since one plugin will run for + // each tab. If we do not prevent execution, the screen will start to flicker + // 'cause every plugin will try to toggle the frames. + // + // This is only relevant for zjstatus, not zjframes; as zjframes only + // runs once per session. + if !is_plugin_for_current_tab(&panes, plugin_pane_id) && !is_zjframes { + return; + } + + let panes: Vec<&PaneInfo> = panes + .iter() + .filter(|p| !p.is_plugin && !p.is_floating) + .collect(); + + tracing::debug!("panes: {:?}", panes); + let frame_enabled = panes + .iter() + .filter(|&&p| !p.is_suppressed) + .any(|p| p.pane_content_x - p.pane_x > 0); + + let frames_for_search = + config.hide_frames_except_for_search && should_show_frames_for_search(mode_info); + let frames_for_fullscreen = + config.hide_frames_except_for_fullscreen && should_show_frames_for_fullscreen(&panes); + let frames_for_single_pane = config.hide_frames_for_single_pane + && should_show_frames_for_multiple_panes(mode_info, &panes); + let frames_for_scroll = + config.hide_frames_except_for_scroll && should_show_frames_for_scroll(mode_info); + + tracing::debug!( + "search {:?} fullscreen {:?} single {:?} scroll {:?} actual {:?}", + frames_for_search, + frames_for_fullscreen, + frames_for_single_pane, + frames_for_scroll, + frame_enabled, + ); + + if (frames_for_search || frames_for_fullscreen || frames_for_single_pane || frames_for_scroll) + && !frame_enabled + { + tracing::debug!("activate"); + toggle_pane_frames(); + } + + if (!frames_for_search + && !frames_for_fullscreen + && !frames_for_single_pane + && !frames_for_scroll) + && frame_enabled + { + tracing::debug!("deactivate"); + toggle_pane_frames(); + } +} + +pub fn should_show_frames_for_scroll(mode_info: &ModeInfo) -> bool { + mode_info.mode == InputMode::Scroll +} + +pub fn should_show_frames_for_search(mode_info: &ModeInfo) -> bool { + mode_info.mode == InputMode::EnterSearch || mode_info.mode == InputMode::Search +} + +pub fn should_show_frames_for_fullscreen(panes: &[&PaneInfo]) -> bool { + let active_pane = match panes.iter().find(|p| p.is_focused) { + Some(p) => p, + None => return false, + }; + + active_pane.is_fullscreen +} + +#[tracing::instrument(skip_all)] +pub fn should_show_frames_for_multiple_panes(mode_info: &ModeInfo, panes: &[&PaneInfo]) -> bool { + tracing::debug!("mode: {:?}", mode_info.mode); + if mode_info.mode == InputMode::RenamePane + || mode_info.mode == InputMode::Search + || mode_info.mode == InputMode::EnterSearch + { + return true; + } + + panes.len() > 1 +} + +fn is_plugin_for_current_tab(panes: &[PaneInfo], plugin_pane_id: PluginIds) -> bool { + panes + .iter() + .any(|p| p.is_plugin && p.id == plugin_pane_id.plugin_id) +} + +fn get_current_panes(tabs: &[TabInfo], pane_info: &PaneManifest) -> Option<Vec<PaneInfo>> { + let active_tab = tabs.iter().find(|t| t.active); + let active_tab = active_tab.as_ref()?; + + pane_info.panes.get(&active_tab.position).cloned() +} diff --git a/sl0pstatus/src/lib.rs b/sl0pstatus/src/lib.rs new file mode 100644 index 0000000..345d4af --- /dev/null +++ b/sl0pstatus/src/lib.rs @@ -0,0 +1,6 @@ +pub mod border; +pub mod config; +pub mod frames; +pub mod pipe; +pub mod render; +pub mod widgets; diff --git a/sl0pstatus/src/pipe.rs b/sl0pstatus/src/pipe.rs new file mode 100644 index 0000000..87fe48e --- /dev/null +++ b/sl0pstatus/src/pipe.rs @@ -0,0 +1,125 @@ +use std::ops::Sub; + +use chrono::{Duration, Local}; + +use crate::{ + config::ZellijState, + widgets::{command::TIMESTAMP_FORMAT, notification}, +}; + +/// Parses the line protocol and updates the state accordingly +/// +/// The protocol is as follows: +/// +/// zjstatus::command_name::args +/// +/// It first starts with `zjstatus` as a prefix to indicate that the line is +/// used for the line protocol and zjstatus should parse it. It is followed +/// by the command name and then the arguments. The following commands are +/// available: +/// +/// - `rerun` - Reruns the command with the given name (like in the config) as +/// argument. E.g. `zjstatus::rerun::command_1` +/// +/// The function returns a boolean indicating whether the state has been +/// changed and the UI should be re-rendered. +#[tracing::instrument(skip(state))] +pub fn parse_protocol(state: &mut ZellijState, input: &str) -> bool { + tracing::debug!("parsing protocol"); + let lines = input.split('\n').collect::<Vec<&str>>(); + + let mut should_render = false; + for line in lines { + let line_renders = process_line(state, line); + + if line_renders { + should_render = true; + } + } + + should_render +} + +#[tracing::instrument(skip_all)] +fn process_line(state: &mut ZellijState, line: &str) -> bool { + let parts = line.split("::").collect::<Vec<&str>>(); + + if parts.len() < 3 { + return false; + } + + if parts[0] != "zjstatus" { + return false; + } + + tracing::debug!("command: {}", parts[1]); + + let mut should_render = false; + #[allow(clippy::single_match)] + match parts[1] { + "rerun" => { + rerun_command(state, parts[2]); + + should_render = true; + } + "notify" => { + notify(state, parts[2]); + + should_render = true; + } + "pipe" => { + if parts.len() < 4 { + return false; + } + + pipe(state, parts[2], parts[3]); + + should_render = true; + } + _ => {} + } + + should_render +} + +fn pipe(state: &mut ZellijState, name: &str, content: &str) { + tracing::debug!("saving pipe result {name} {content}"); + state + .pipe_results + .insert(name.to_owned(), content.to_owned()); +} + +fn notify(state: &mut ZellijState, message: &str) { + state.incoming_notification = Some(notification::Message { + body: message.to_string(), + received_at: Local::now(), + }); +} + +fn rerun_command(state: &mut ZellijState, command_name: &str) { + invalidate_command_result(state, command_name); +} + +/// Backdates the stored timestamp of a command result so the next render +/// re-runs the command. +pub fn invalidate_command_result(state: &mut ZellijState, command_name: &str) { + let command_result = state.command_results.get(command_name); + + if command_result.is_none() { + return; + } + + let mut command_result = command_result.unwrap().clone(); + + let ts = Sub::<Duration>::sub(Local::now(), Duration::try_days(1).unwrap()); + + command_result.context.insert( + "timestamp".to_string(), + ts.format(TIMESTAMP_FORMAT).to_string(), + ); + + state.command_results.remove(command_name); + state + .command_results + .insert(command_name.to_string(), command_result.clone()); +} diff --git a/sl0pstatus/src/render.rs b/sl0pstatus/src/render.rs new file mode 100644 index 0000000..f8d68fa --- /dev/null +++ b/sl0pstatus/src/render.rs @@ -0,0 +1,427 @@ +use cached::{LruCache, macros::cached}; +use lazy_static::lazy_static; +use std::{collections::BTreeMap, sync::Arc}; + +use anstyle::{Ansi256Color, AnsiColor, Color, RgbColor, Style}; +use regex::Regex; +use zellij_tile::prelude::bail; + +use crate::{ + config::{UpdateEventMask, ZellijState, event_mask_from_widget_name}, + widgets::widget::Widget, +}; + +lazy_static! { + static ref WIDGET_REGEX: Regex = Regex::new("(\\{[a-z_0-9]+\\})").unwrap(); +} + +#[derive(Clone, Debug, PartialEq)] +pub struct FormattedPart { + pub fg: Option<Color>, + pub bg: Option<Color>, + pub us: Option<Color>, + pub effects: anstyle::Effects, + pub bold: bool, + pub italic: bool, + pub underscore: bool, + pub reverse: bool, + pub blink: bool, + pub hidden: bool, + pub dimmed: bool, + pub strikethrough: bool, + pub double_underscore: bool, + pub curly_underscore: bool, + pub dotted_underscore: bool, + pub dashed_underscore: bool, + pub content: String, + pub cache_mask: u8, + pub cached_content: String, + pub cache: BTreeMap<String, String>, +} + +#[cached( + ty = "LruCache<String, FormattedPart>", + create = "{ LruCache::builder().max_size(100).build().unwrap() }", + convert = r#"{ (format.to_owned()) }"# +)] +pub fn formatted_part_from_string_cached( + format: &str, + config: &BTreeMap<String, String>, +) -> FormattedPart { + FormattedPart::from_format_string(format, config) +} + +#[cached( + ty = "LruCache<String, Vec<FormattedPart>>", + create = "{ LruCache::builder().max_size(100).build().unwrap() }", + convert = r#"{ (config_string.to_owned()) }"# +)] +pub fn formatted_parts_from_string_cached( + config_string: &str, + config: &BTreeMap<String, String>, +) -> Vec<FormattedPart> { + FormattedPart::multiple_from_format_string(config_string, config) +} + +impl FormattedPart { + pub fn multiple_from_format_string( + config_string: &str, + config: &BTreeMap<String, String>, + ) -> Vec<Self> { + config_string + .split("#[") + .map(|s| FormattedPart::from_format_string(s, config)) + .collect() + } + + pub fn from_format_string(format: &str, config: &BTreeMap<String, String>) -> Self { + let format = match format.starts_with("#[") { + true => format.strip_prefix("#[").unwrap(), + false => format, + }; + + let mut result = FormattedPart { + cache_mask: cache_mask_from_content(format), + ..Default::default() + }; + + let mut format_content_split = format.split(']').collect::<Vec<&str>>(); + + if format_content_split.len() == 1 { + format.clone_into(&mut result.content); + + return result; + } + + let parts = format_content_split[0].split(','); + + format_content_split.remove(0); + result.content = format_content_split.join("]"); + + for part in parts { + if part.starts_with("fg=") { + result.fg = parse_color(part.strip_prefix("fg=").unwrap(), config); + } + + if part.starts_with("bg=") { + result.bg = parse_color(part.strip_prefix("bg=").unwrap(), config); + } + + if part.starts_with("us=") { + result.us = parse_color(part.strip_prefix("us=").unwrap(), config); + } + + if part.eq("reverse") { + result.reverse = true; + } + + result.parse_and_set_effect(part); + } + + result + } + + fn parse_and_set_effect(&mut self, part: &str) { + match part { + "bold" => { + self.effects |= anstyle::Effects::BOLD; + } + "italic" | "italics" => { + self.effects |= anstyle::Effects::ITALIC; + } + "underscore" => { + self.effects |= anstyle::Effects::UNDERLINE; + } + "blink" => { + self.effects |= anstyle::Effects::BLINK; + } + "hidden" => { + self.effects |= anstyle::Effects::HIDDEN; + } + "dim" => { + self.effects |= anstyle::Effects::DIMMED; + } + "strikethrough" => { + self.effects |= anstyle::Effects::STRIKETHROUGH; + } + "double-underscore" => { + self.effects |= anstyle::Effects::DOUBLE_UNDERLINE; + } + "curly-underscore" => { + self.effects |= anstyle::Effects::CURLY_UNDERLINE; + } + "dotted-underscore" => { + self.effects |= anstyle::Effects::DOTTED_UNDERLINE; + } + "dashed-underscore" => { + self.effects |= anstyle::Effects::DASHED_UNDERLINE; + } + "reverse" => { + self.effects |= anstyle::Effects::INVERT; + } + _ => {} + } + } + + pub fn format_string(&self, text: &str) -> String { + let mut style = Style::new(); + + style = style.fg_color(self.fg); + style = style.bg_color(self.bg); + style = style.underline_color(self.us); + style = style.effects(self.effects); + + format!( + "{}{}{}{}", + style.render_reset(), + style.render(), + text, + style.render_reset() + ) + } + + #[tracing::instrument(skip_all)] + pub fn format_string_with_widgets( + &mut self, + widgets: &BTreeMap<String, Arc<dyn Widget>>, + state: &ZellijState, + ) -> String { + let skip_cache = self.cache_mask & UpdateEventMask::Always as u8 != 0; + + if !skip_cache && self.cache_mask & state.cache_mask == 0 && !self.cache.is_empty() { + tracing::debug!(msg = "hit", typ = "format_string", format = self.content); + return self.cached_content.to_owned(); + } + tracing::debug!(msg = "miss", typ = "format_string", format = self.content); + + let mut output = self.content.clone(); + + for widget in WIDGET_REGEX.captures_iter(&self.content) { + let match_name = widget.get(0).unwrap().as_str(); + let widget_key = match_name.trim_matches(|c| c == '{' || c == '}'); + let mut widget_key_name = widget_key; + + if widget_key.starts_with("command_") { + widget_key_name = "command"; + } + + if widget_key.starts_with("pipe_") { + widget_key_name = "pipe"; + } + + let widget_mask = event_mask_from_widget_name(widget_key_name); + let skip_widget_cache = widget_mask & UpdateEventMask::Always as u8 != 0; + if !skip_widget_cache + && widget_mask & state.cache_mask == 0 + && let Some(res) = self.cache.get(widget_key) + { + tracing::debug!(msg = "hit", typ = "widget", widget = widget_key); + output = output.replace(match_name, res); + continue; + } + + tracing::debug!( + msg = "miss", + typ = "widget", + widget = widget_key, + mask = widget_mask & state.cache_mask, + skip_cache = skip_cache, + ); + + let result = match widgets.get(widget_key_name) { + Some(widget) => widget.process(widget_key, state), + None => "Use of uninitialized widget".to_owned(), + }; + + self.cache.insert(widget_key.to_owned(), result.to_owned()); + + output = output.replace(match_name, &result); + } + + let res = self.format_string(&output); + self.cached_content.clone_from(&res); + + res + } +} + +impl Default for FormattedPart { + fn default() -> Self { + Self { + fg: None, + bg: None, + us: None, + effects: anstyle::Effects::new(), + bold: false, + italic: false, + underscore: false, + reverse: false, + blink: false, + hidden: false, + dimmed: false, + strikethrough: false, + double_underscore: false, + curly_underscore: false, + dotted_underscore: false, + dashed_underscore: false, + content: "".to_owned(), + cache_mask: 0, + cached_content: "".to_owned(), + cache: BTreeMap::new(), + } + } +} + +fn cache_mask_from_content(content: &str) -> u8 { + let mut output = 0; + for widget in WIDGET_REGEX.captures_iter(content) { + let match_name = widget.get(0).unwrap().as_str(); + let widget_key = match_name.trim_matches(|c| c == '{' || c == '}'); + let mut widget_key_name = widget_key; + + if widget_key.starts_with("command_") { + widget_key_name = "command"; + } + + if widget_key.starts_with("pipe_") { + widget_key_name = "pipe"; + } + + output |= event_mask_from_widget_name(widget_key_name); + } + output +} + +fn hex_to_rgb(s: &str) -> anyhow::Result<Vec<u8>> { + if s.len() != 6 { + bail!("wrong hex color length"); + } + + (0..s.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&s[i..i + 2], 16).map_err(anyhow::Error::from)) + .collect() +} + +#[cached( + ty = "LruCache<String, Color>", + create = "{ LruCache::builder().max_size(100).build().unwrap() }", + convert = r#"{ (color.to_owned()) }"# +)] +fn parse_color(color: &str, config: &BTreeMap<String, String>) -> Option<Color> { + let mut color = color; + if color.starts_with('$') { + let alias_name = color.strip_prefix('$').unwrap(); + + color = config.get(&format!("color_{alias_name}"))?; + } + + if color.starts_with('#') { + let rgb = match hex_to_rgb(color.strip_prefix('#').unwrap()) { + Ok(rgb) => rgb, + Err(_) => return None, + }; + + if rgb.len() != 3 { + return None; + } + + return Some( + RgbColor( + *rgb.first().unwrap(), + *rgb.get(1).unwrap(), + *rgb.get(2).unwrap(), + ) + .into(), + ); + } + + if let Some(color) = color_by_name(color) { + return Some(color.into()); + } + + if color.starts_with("colour") { + color = color.strip_prefix("colour").unwrap(); + } + + if let Ok(result) = color.parse::<u8>() { + return Some(Ansi256Color(result).into()); + } + + None +} + +fn color_by_name(color: &str) -> Option<AnsiColor> { + match color { + "black" => Some(AnsiColor::Black), + "red" => Some(AnsiColor::Red), + "green" => Some(AnsiColor::Green), + "yellow" => Some(AnsiColor::Yellow), + "blue" => Some(AnsiColor::Blue), + "magenta" => Some(AnsiColor::Magenta), + "cyan" => Some(AnsiColor::Cyan), + "white" => Some(AnsiColor::White), + "bright_black" => Some(AnsiColor::BrightBlack), + "bright_red" => Some(AnsiColor::BrightRed), + "bright_green" => Some(AnsiColor::BrightGreen), + "bright_yellow" => Some(AnsiColor::BrightYellow), + "bright_blue" => Some(AnsiColor::BrightBlue), + "bright_magenta" => Some(AnsiColor::BrightMagenta), + "bright_cyan" => Some(AnsiColor::BrightCyan), + "bright_white" => Some(AnsiColor::BrightWhite), + "default" => None, + _ => None, + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_hex_to_rgb() { + let result = hex_to_rgb("010203"); + let expected = Vec::from([1, 2, 3]); + assert!(result.is_ok()); + assert_eq!(result.unwrap(), expected); + } + + #[test] + fn test_hex_to_rgb_with_invalid_input() { + let result = hex_to_rgb("#010203"); + assert!(result.is_err()); + + let result = hex_to_rgb(" 010203"); + assert!(result.is_err()); + + let result = hex_to_rgb("010"); + assert!(result.is_err()); + } + + #[test] + fn test_parse_color() { + let mut config: BTreeMap<String, String> = BTreeMap::new(); + config.insert("color_green".to_owned(), "#00ff00".to_owned()); + + let result = parse_color("#010203", &config); + let expected = RgbColor(1, 2, 3); + assert_eq!(result, Some(expected.into())); + + let result = parse_color("255", &config); + let expected = Ansi256Color(255); + assert_eq!(result, Some(expected.into())); + + let result = parse_color("365", &config); + assert_eq!(result, None); + + let result = parse_color("#365", &config); + assert_eq!(result, None); + + let result = parse_color("$green", &config); + let expected = RgbColor(0, 255, 0); + assert_eq!(result, Some(expected.into())); + + let result = parse_color("$blue", &config); + assert_eq!(result, None); + } +} diff --git a/sl0pstatus/src/widgets/command.rs b/sl0pstatus/src/widgets/command.rs new file mode 100644 index 0000000..245c5fc --- /dev/null +++ b/sl0pstatus/src/widgets/command.rs @@ -0,0 +1,614 @@ +use kdl::{KdlDocument, KdlError}; +use lazy_static::lazy_static; +use std::{ + collections::BTreeMap, + fs::{File, remove_file}, + ops::Sub, + path::{Path, PathBuf}, +}; + +use chrono::{DateTime, Duration, Local}; +use regex::Regex; +#[cfg(all(not(feature = "bench"), not(test)))] +use zellij_tile::shim::{run_command, run_command_with_env_variables_and_cwd}; + +use crate::render::{FormattedPart, formatted_parts_from_string_cached}; + +use crate::{config::ZellijState, widgets::widget::Widget}; + +pub const TIMESTAMP_FORMAT: &str = "%s"; + +lazy_static! { + static ref COMMAND_REGEX: Regex = Regex::new("_[a-zA-Z0-9]+$").unwrap(); +} + +const FOCUSED_PANE_CWD: &str = "{focused_pane_cwd}"; + +#[derive(Clone, Debug, PartialEq)] +enum RenderMode { + Static, + Dynamic, + Raw, +} + +#[derive(Clone, Debug)] +struct CommandConfig { + command: String, + format: Vec<FormattedPart>, + env: Option<BTreeMap<String, String>>, + cwd: Option<PathBuf>, + follow_focus_cwd: bool, + interval: i64, + render_mode: RenderMode, + click_action: String, + hide_on_empty_stdout: bool, +} + +#[derive(Clone, Debug, Default)] +pub struct CommandResult { + pub exit_code: Option<i32>, + pub stdout: String, + pub stderr: String, + pub context: BTreeMap<String, String>, +} + +pub struct CommandWidget { + config: BTreeMap<String, CommandConfig>, + zj_conf: BTreeMap<String, String>, +} + +impl CommandWidget { + pub fn new(config: &BTreeMap<String, String>) -> Self { + Self { + config: parse_config(config), + zj_conf: config.clone(), + } + } +} + +impl Widget for CommandWidget { + fn process(&self, name: &str, state: &ZellijState) -> String { + let command_config = match self.config.get(name) { + Some(cc) => cc, + None => { + return "".to_owned(); + } + }; + + run_command_if_needed(command_config.clone(), name, state); + + let command_result = match state.command_results.get(name) { + Some(cr) => cr, + None => { + return "".to_owned(); + } + }; + + if command_config.hide_on_empty_stdout && command_result.stdout.is_empty() { + return "".to_owned(); + } + + let content = command_config + .format + .iter() + .map(|f| { + let mut content = f.content.clone(); + + if content.contains("{exit_code}") { + content = content.replace( + "{exit_code}", + format!("{}", command_result.exit_code.unwrap_or(-1)).as_str(), + ); + } + + if content.contains("{stdout}") { + content = content.replace( + "{stdout}", + command_result + .stdout + .strip_suffix('\n') + .unwrap_or(&command_result.stdout), + ); + } + + if content.contains("{stderr}") { + content = content.replace( + "{stderr}", + command_result + .stderr + .strip_suffix('\n') + .unwrap_or(&command_result.stderr), + ); + } + + (f, content) + }) + .fold("".to_owned(), |acc, (f, content)| { + if command_config.render_mode == RenderMode::Static { + return format!("{acc}{}", f.format_string(&content)); + } + + format!("{acc}{}", content) + }); + + match command_config.render_mode { + RenderMode::Static => content, + RenderMode::Dynamic => render_dynamic_formatted_content(&content, &self.zj_conf), + RenderMode::Raw => command_result + .stdout + .strip_suffix('\n') + .unwrap_or(&command_result.stdout) + .to_owned(), + } + } + + fn process_click(&self, name: &str, _state: &ZellijState, _pos: usize) { + let command_config = match self.config.get(name) { + Some(cc) => cc, + None => { + return; + } + }; + + if command_config.click_action.is_empty() { + return; + } + + let command = commandline_parser(&command_config.click_action); + let context: BTreeMap<String, String> = BTreeMap::new(); + + tracing::debug!("Running command {:?} {:?}", command, context); + + #[cfg(all(not(feature = "bench"), not(test)))] + run_command( + &command.iter().map(|x| x.as_str()).collect::<Vec<&str>>(), + context, + ); + } +} + +fn render_dynamic_formatted_content(content: &str, config: &BTreeMap<String, String>) -> String { + formatted_parts_from_string_cached(content, config) + .iter() + .map(|fp| fp.format_string(&fp.content)) + .collect::<Vec<String>>() + .join("") +} + +#[tracing::instrument(skip(command_config, state))] +fn run_command_if_needed(command_config: CommandConfig, name: &str, state: &ZellijState) -> bool { + let got_result = state.command_results.contains_key(name); + if got_result && command_config.interval == 0 { + return false; + } + + let ts = Local::now(); + let last_run = get_timestamp_from_event_or_default(name, state, command_config.interval); + + if ts.timestamp() - last_run.timestamp() >= command_config.interval { + let cwd = if command_config.follow_focus_cwd { + match &state.focused_pane_cwd { + Some(cwd) => Some(cwd.clone()), + None => return false, + } + } else { + command_config.cwd.clone() + }; + + let mut context = BTreeMap::new(); + context.insert("name".to_owned(), name.to_owned()); + context.insert( + "timestamp".to_owned(), + ts.format(TIMESTAMP_FORMAT).to_string(), + ); + + if let Some(cwd) = &cwd { + context.insert("cwd".to_owned(), cwd.to_string_lossy().into_owned()); + } + + #[allow(unused_variables)] + let command = commandline_parser(&command_config.command); + tracing::debug!("Running command: {:?}", command); + + if command_config.env.is_some() || cwd.is_some() { + #[cfg(all(not(feature = "bench"), not(test)))] + run_command_with_env_variables_and_cwd( + &command.iter().map(|x| x.as_str()).collect::<Vec<&str>>(), + command_config.env.unwrap_or_default(), + cwd.unwrap_or_default(), + context, + ); + + return true; + } + + #[cfg(all(not(feature = "bench"), not(test)))] + run_command( + &command.iter().map(|x| x.as_str()).collect::<Vec<&str>>(), + context, + ); + + return true; + } + + false +} + +pub fn focus_cwd_command_names(zj_conf: &BTreeMap<String, String>) -> Vec<String> { + parse_config(zj_conf) + .into_iter() + .filter(|(_, conf)| conf.follow_focus_cwd) + .map(|(name, _)| name) + .collect() +} + +fn parse_config(zj_conf: &BTreeMap<String, String>) -> BTreeMap<String, CommandConfig> { + let mut keys: Vec<String> = zj_conf + .keys() + .filter(|k| k.starts_with("command_")) + .cloned() + .collect(); + keys.sort(); + + let mut config: BTreeMap<String, CommandConfig> = BTreeMap::new(); + + for key in keys { + let command_name = COMMAND_REGEX.replace(&key, "").to_string(); + + let mut command_conf = CommandConfig { + command: "".to_owned(), + format: Vec::new(), + cwd: None, + follow_focus_cwd: false, + env: None, + interval: 1, + render_mode: RenderMode::Static, + click_action: "".to_owned(), + hide_on_empty_stdout: false, + }; + + if let Some(existing_conf) = config.get(command_name.as_str()) { + command_conf = existing_conf.clone(); + } + + if key.ends_with("command") { + command_conf + .command + .clone_from(&zj_conf.get(&key).unwrap().to_owned()); + } + + if key.ends_with("clickaction") { + command_conf + .click_action + .clone_from(&zj_conf.get(&key).unwrap().to_owned()); + } + + if key.ends_with("env") { + let doc: Result<KdlDocument, KdlError> = zj_conf.get(&key).unwrap().parse(); + + if let Ok(doc) = doc { + command_conf.env = Some(get_env_vars(doc)); + } + } + + if key.ends_with("cwd") { + let value = zj_conf.get(&key).unwrap().to_owned(); + + if value == FOCUSED_PANE_CWD { + command_conf.follow_focus_cwd = true; + command_conf.cwd = None; + } else { + let mut cwd = PathBuf::new(); + cwd.push(value); + + command_conf.cwd = Some(cwd); + command_conf.follow_focus_cwd = false; + } + } + + if key.ends_with("format") { + command_conf.format = + FormattedPart::multiple_from_format_string(zj_conf.get(&key).unwrap(), zj_conf); + } + + if key.ends_with("interval") { + command_conf.interval = zj_conf.get(&key).unwrap().parse::<i64>().unwrap_or(1); + } + + if key.ends_with("rendermode") { + command_conf.render_mode = match zj_conf.get(&key) { + Some(mode) => match mode.as_str() { + "static" => RenderMode::Static, + "dynamic" => RenderMode::Dynamic, + "raw" => RenderMode::Raw, + _ => RenderMode::Static, + }, + None => RenderMode::Static, + }; + } + + if key.ends_with("hideonemptystdout") { + command_conf.hide_on_empty_stdout = match zj_conf.get(&key) { + Some(val) => val == "true", + None => false, + }; + } + + config.insert(command_name, command_conf); + } + + config +} + +fn get_env_vars(doc: KdlDocument) -> BTreeMap<String, String> { + let mut output = BTreeMap::new(); + + for n in doc.nodes() { + let children = n.entries(); + if children.len() != 1 { + continue; + } + + let value = match children.first().unwrap().value().as_string() { + Some(value) => value, + None => continue, + }; + + output.insert(n.name().value().to_string(), value.to_string()); + } + + output +} + +fn get_timestamp_from_event_or_default( + name: &str, + state: &ZellijState, + interval: i64, +) -> DateTime<Local> { + let command_result = state.command_results.get(name); + if command_result.is_none() { + if lock(name, state.clone()) { + return Local::now(); + } + + return Sub::<Duration>::sub(Local::now(), Duration::try_days(1).unwrap()); + } + let command_result = command_result.unwrap(); + + let ts_context = command_result.context.get("timestamp"); + if ts_context.is_none() { + return Sub::<Duration>::sub(Local::now(), Duration::try_days(1).unwrap()); + } + let ts_context = ts_context.unwrap(); + + if Local::now().timestamp() - state.start_time.timestamp() < interval { + release_command_lock(state, name); + } + + match DateTime::parse_from_str(ts_context, TIMESTAMP_FORMAT) { + Ok(ts) => ts.into(), + Err(_) => Sub::<Duration>::sub(Local::now(), Duration::try_days(1).unwrap()), + } +} + +fn lock(name: &str, state: ZellijState) -> bool { + let path = format!("/tmp/{}.{}.lock", state.plugin_uuid, name); + + if !Path::new(&path).exists() { + let _ = File::create(path); + + return false; + } + + true +} + +pub fn release_command_lock(state: &ZellijState, name: &str) { + let path = format!("/tmp/{}.{}.lock", state.plugin_uuid, name); + + if Path::new(&path).exists() { + let _ = remove_file(path); + } +} + +fn commandline_parser(input: &str) -> Vec<String> { + let mut output: Vec<String> = Vec::new(); + + let special_chars = ['"', '\'']; + + let mut found_special_char = '\0'; + let mut buffer = "".to_owned(); + let mut is_escaped = false; + let mut is_in_group = false; + + for character in input.chars() { + if is_escaped { + is_escaped = false; + buffer = format!("{}\\{}", buffer.to_owned(), character); + continue; + } + + if character == '\\' { + is_escaped = true; + continue; + } + + if found_special_char == character && is_in_group { + is_in_group = false; + found_special_char = '\0'; + output.push(buffer.clone()); + "".clone_into(&mut buffer); + continue; + } + + if special_chars.contains(&character) && !is_in_group { + is_in_group = true; + found_special_char = character; + continue; + } + + if character == ' ' && !is_in_group { + output.push(buffer.clone()); + "".clone_into(&mut buffer); + continue; + } + + buffer = format!("{}{}", buffer, character); + } + + if !buffer.is_empty() { + output.push(buffer.clone()); + } + + output +} + +#[cfg(test)] +mod test { + use super::*; + use rstest::rstest; + + #[test] + pub fn test_focused_pane_cwd_parsing() { + let conf = BTreeMap::from([ + ("command_branch_command".to_owned(), "git branch".to_owned()), + ( + "command_branch_cwd".to_owned(), + "{focused_pane_cwd}".to_owned(), + ), + ("command_static_command".to_owned(), "ls".to_owned()), + ("command_static_cwd".to_owned(), "/tmp".to_owned()), + ]); + + let config = parse_config(&conf); + assert!(config.get("command_branch").unwrap().follow_focus_cwd); + assert_eq!(config.get("command_branch").unwrap().cwd, None); + assert!(!config.get("command_static").unwrap().follow_focus_cwd); + assert_eq!( + config.get("command_static").unwrap().cwd, + Some(PathBuf::from("/tmp")) + ); + + assert_eq!(focus_cwd_command_names(&conf), vec!["command_branch"]); + } + + #[test] + pub fn test_commandline_parser() { + let input = "pwd"; + let result = commandline_parser(input); + let expected = Vec::from(["pwd"]); + assert_eq!(result, expected); + + let input = "bash -c \"pwd | base64 -c \\\"bla\\\"\""; + let result = commandline_parser(input); + let expected = Vec::from(["bash", "-c", "pwd | base64 -c \\\"bla\\\""]); + assert_eq!(result, expected); + + let input = "bash -c \"pwd | base64 -c 'bla' | xxd\""; + let result = commandline_parser(input); + let expected = Vec::from(["bash", "-c", "pwd | base64 -c 'bla' | xxd"]); + assert_eq!(result, expected); + } + + #[test] + pub fn test_release_command_lock_allows_rerun_without_result() { + let state = ZellijState { + plugin_uuid: "release_command_lock_test".to_owned(), + ..ZellijState::default() + }; + let command_config = CommandConfig { + command: "echo test".to_owned(), + format: Vec::new(), + env: None, + cwd: None, + follow_focus_cwd: false, + interval: 5, + render_mode: RenderMode::Static, + click_action: "".to_owned(), + hide_on_empty_stdout: false, + }; + + release_command_lock(&state, "test_release"); + + assert!(run_command_if_needed( + command_config.clone(), + "test_release", + &state + )); + assert!(!run_command_if_needed( + command_config.clone(), + "test_release", + &state + )); + + release_command_lock(&state, "test_release"); + + assert!(run_command_if_needed( + command_config, + "test_release", + &state + )); + + release_command_lock(&state, "test_release"); + } + + #[rstest] + // no result, interval 1 second + #[case(1, &ZellijState{ plugin_uuid: "test_command_result_1".to_owned(), ..Default::default() }, true)] + // only run once without a result + #[case(0, &ZellijState::default(), true)] + // do not run with run once and result + #[case(0, &ZellijState { + command_results: BTreeMap::from([( + "test".to_owned(), + CommandResult::default(), + )]), + ..ZellijState::default() + }, false)] + // run if interval is exceeded + #[case(1, &ZellijState { + command_results: BTreeMap::from([( + "test".to_owned(), + CommandResult{ + context: BTreeMap::from([("timestamp".to_owned(), "0".to_owned())]), + ..CommandResult::default() + } + )]), + ..ZellijState::default() + }, true)] + // do not run if interval is not exceeded + #[case(1, &ZellijState { + command_results: BTreeMap::from([( + "test".to_owned(), + CommandResult{ + context: BTreeMap::from([("timestamp".to_owned(), Local::now().format(TIMESTAMP_FORMAT).to_string())]), + ..CommandResult::default() + } + )]), + ..ZellijState::default() + }, false)] + pub fn test_run_command_if_needed( + #[case] interval: i64, + #[case] state: &ZellijState, + #[case] expected: bool, + ) { + let res = run_command_if_needed( + CommandConfig { + command: "echo test".to_owned(), + format: Vec::new(), + env: None, + cwd: None, + follow_focus_cwd: false, + interval, + render_mode: RenderMode::Static, + click_action: "".to_owned(), + hide_on_empty_stdout: false, + }, + "test", + state, + ); + assert_eq!(res, expected); + + release_command_lock(&state, "test"); + } +} diff --git a/sl0pstatus/src/widgets/datetime.rs b/sl0pstatus/src/widgets/datetime.rs new file mode 100644 index 0000000..f500b5d --- /dev/null +++ b/sl0pstatus/src/widgets/datetime.rs @@ -0,0 +1,109 @@ +use std::{collections::BTreeMap, str::FromStr}; + +use chrono::Local; +use chrono_tz::Tz; + +use crate::render::FormattedPart; + +use crate::{config::ZellijState, widgets::widget::Widget}; + +pub struct DateTimeWidget { + format: String, + time_format: String, + date_format: String, + color_format: Vec<FormattedPart>, + time_zone: Option<Tz>, +} + +impl DateTimeWidget { + pub fn new(config: &BTreeMap<String, String>) -> Self { + let mut format = "%H:%M"; + if let Some(form) = config.get("datetime_format") { + format = form; + } + + let mut time_format = "%H:%M"; + if let Some(form) = config.get("datetime_time_format") { + time_format = form; + } + + let mut date_format = "%Y-%m-%d"; + if let Some(form) = config.get("datetime_date_format") { + date_format = form; + } + + let mut time_zone_string = "Etc/UTC"; + if let Some(tz_string) = config.get("datetime_timezone") { + time_zone_string = tz_string; + } + + let time_zone = Tz::from_str(time_zone_string).ok(); + + let mut color_format = ""; + if let Some(form) = config.get("datetime") { + color_format = form; + } + + Self { + format: format.to_owned(), + date_format: date_format.to_owned(), + time_format: time_format.to_owned(), + color_format: FormattedPart::multiple_from_format_string(color_format, config), + time_zone, + } + } +} + +impl Widget for DateTimeWidget { + fn process(&self, _name: &str, _state: &ZellijState) -> String { + let date = Local::now(); + + let mut tz = Tz::UTC; + if let Some(t) = self.time_zone { + tz = t; + } + + self.color_format + .iter() + .map(|f| { + let mut content = f.content.clone(); + + if content.contains("{format}") { + content = content.replace( + "{format}", + format!("{}", date.with_timezone(&tz).format(self.format.as_str())) + .as_str(), + ); + } + + if content.contains("{date}") { + content = content.replace( + "{date}", + format!( + "{}", + date.with_timezone(&tz).format(self.date_format.as_str()) + ) + .as_str(), + ); + } + + if content.contains("{time}") { + content = content.replace( + "{time}", + format!( + "{}", + date.with_timezone(&tz).format(self.time_format.as_str()) + ) + .as_str(), + ); + } + + (f, content) + }) + .fold("".to_owned(), |acc, (f, content)| { + format!("{acc}{}", f.format_string(&content)) + }) + } + + fn process_click(&self, _name: &str, _state: &ZellijState, _pos: usize) {} +} diff --git a/sl0pstatus/src/widgets/mod.rs b/sl0pstatus/src/widgets/mod.rs new file mode 100644 index 0000000..aa60cc3 --- /dev/null +++ b/sl0pstatus/src/widgets/mod.rs @@ -0,0 +1,9 @@ +pub mod command; +pub mod datetime; +pub mod mode; +pub mod notification; +pub mod pipe; +pub mod session; +pub mod swap_layout; +pub mod tabs; +pub mod widget; diff --git a/sl0pstatus/src/widgets/mode.rs b/sl0pstatus/src/widgets/mode.rs new file mode 100644 index 0000000..8544cf9 --- /dev/null +++ b/sl0pstatus/src/widgets/mode.rs @@ -0,0 +1,208 @@ +use std::collections::BTreeMap; + +use zellij_tile::prelude::InputMode; + +use crate::{config::ZellijState, render::FormattedPart}; + +use super::widget::Widget; + +#[derive(Debug)] +pub struct ModeWidget { + normal_format: Vec<FormattedPart>, + locked_format: Vec<FormattedPart>, + resize_format: Vec<FormattedPart>, + pane_format: Vec<FormattedPart>, + tab_format: Vec<FormattedPart>, + scroll_format: Vec<FormattedPart>, + enter_search_format: Vec<FormattedPart>, + search_format: Vec<FormattedPart>, + rename_tab_format: Vec<FormattedPart>, + rename_pane_format: Vec<FormattedPart>, + session_format: Vec<FormattedPart>, + move_format: Vec<FormattedPart>, + prompt_format: Vec<FormattedPart>, + tmux_format: Vec<FormattedPart>, + default_to_mode: Option<String>, +} + +impl ModeWidget { + pub fn new(config: &BTreeMap<String, String>) -> Self { + let normal_format = match config.get("mode_normal") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let locked_format = match config.get("mode_locked") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let resize_format = match config.get("mode_resize") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let pane_format = match config.get("mode_pane") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let tab_format = match config.get("mode_tab") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let scroll_format = match config.get("mode_scroll") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let enter_search_format = match config.get("mode_enter_search") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let search_format = match config.get("mode_search") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let rename_tab_format = match config.get("mode_rename_tab") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let rename_pane_format = match config.get("mode_rename_pane") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let session_format = match config.get("mode_session") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let move_format = match config.get("mode_move") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let prompt_format = match config.get("mode_prompt") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let tmux_format = match config.get("mode_tmux") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => vec![], + }; + + let default_to_mode = config.get("mode_default_to_mode").map(|s| s.to_string()); + + Self { + normal_format, + locked_format, + resize_format, + pane_format, + tab_format, + scroll_format, + enter_search_format, + search_format, + rename_tab_format, + rename_pane_format, + session_format, + move_format, + prompt_format, + tmux_format, + default_to_mode, + } + } +} + +impl Widget for ModeWidget { + fn process(&self, _name: &str, state: &ZellijState) -> String { + self.select_format(state.mode.mode) + .iter() + .map(|f| { + let mut content = f.content.clone(); + + if f.content.contains("{name}") { + content = f + .content + .replace("{name}", format!("{:?}", state.mode.mode).as_str()); + } + + (f, content) + }) + .fold("".to_owned(), |acc, (f, content)| { + format!("{acc}{}", f.format_string(&content)) + }) + } + + fn process_click(&self, _name: &str, _state: &ZellijState, _pos: usize) {} +} + +impl ModeWidget { + fn get_format_by_mode(&self, mode: InputMode) -> &Vec<FormattedPart> { + match mode { + InputMode::Normal => &self.normal_format, + InputMode::Locked => &self.locked_format, + InputMode::Resize => &self.resize_format, + InputMode::Pane => &self.pane_format, + InputMode::Tab => &self.tab_format, + InputMode::Scroll => &self.scroll_format, + InputMode::EnterSearch => &self.enter_search_format, + InputMode::Search => &self.search_format, + InputMode::RenameTab => &self.rename_tab_format, + InputMode::RenamePane => &self.rename_pane_format, + InputMode::Session => &self.session_format, + InputMode::Move => &self.move_format, + InputMode::Prompt => &self.prompt_format, + InputMode::Tmux => &self.tmux_format, + } + } + + fn select_format(&self, mode: InputMode) -> &Vec<FormattedPart> { + let output = self.get_format_by_mode(mode); + + if output.is_empty() { + return match self.default_to_mode { + Some(ref mode) => match map_string_to_mode(mode) { + Some(mode) => { + let out = self.get_format_by_mode(mode); + + if out.is_empty() { + return &self.normal_format; + } + + return out; + } + None => &self.normal_format, + }, + None => &self.normal_format, + }; + } + + output + } +} + +fn map_string_to_mode(s: &str) -> Option<InputMode> { + match s { + "normal" => Some(InputMode::Normal), + "locked" => Some(InputMode::Locked), + "resize" => Some(InputMode::Resize), + "pane" => Some(InputMode::Pane), + "tab" => Some(InputMode::Tab), + "scroll" => Some(InputMode::Scroll), + "enter_search" => Some(InputMode::EnterSearch), + "search" => Some(InputMode::Search), + "rename_tab" => Some(InputMode::RenameTab), + "rename_pane" => Some(InputMode::RenamePane), + "session" => Some(InputMode::Session), + "move" => Some(InputMode::Move), + "prompt" => Some(InputMode::Prompt), + "tmux" => Some(InputMode::Tmux), + _ => None, + } +} diff --git a/sl0pstatus/src/widgets/notification.rs b/sl0pstatus/src/widgets/notification.rs new file mode 100644 index 0000000..458d12a --- /dev/null +++ b/sl0pstatus/src/widgets/notification.rs @@ -0,0 +1,78 @@ +use std::collections::BTreeMap; + +use chrono::{DateTime, Local}; + +use crate::render::FormattedPart; +use crate::{config::ZellijState, widgets::widget::Widget}; + +#[derive(Clone, Debug, Default)] +pub struct Message { + pub body: String, + pub received_at: DateTime<Local>, +} + +pub struct NotificationWidget { + show_interval: i64, + format_unread: Vec<FormattedPart>, + format_no_notifications: Vec<FormattedPart>, +} + +impl NotificationWidget { + pub fn new(config: &BTreeMap<String, String>) -> Self { + let format_unread = match config.get("notification_format_unread") { + Some(f) => FormattedPart::multiple_from_format_string(f, config), + None => FormattedPart::multiple_from_format_string("", config), + }; + + let format_no_notifications = match config.get("notification_format_no_notifications") { + Some(f) => FormattedPart::multiple_from_format_string(f, config), + None => FormattedPart::multiple_from_format_string("", config), + }; + + let show_interval = match config.get("notification_show_interval") { + Some(i) => i.parse::<i64>().unwrap_or(5), + None => 5, + }; + + Self { + show_interval, + format_unread, + format_no_notifications, + } + } +} + +impl Widget for NotificationWidget { + fn process(&self, _name: &str, state: &ZellijState) -> String { + let message = match state.incoming_notification { + Some(ref message) => message.clone(), + None => Message::default(), + }; + + let no_new = + message.received_at.timestamp() + self.show_interval < Local::now().timestamp(); + + tracing::debug!("no_new: {}", no_new); + + let format = match no_new { + true => self.format_no_notifications.clone(), + false => self.format_unread.clone(), + }; + + let mut output = "".to_owned(); + + for f in format.iter() { + let mut content = f.content.clone(); + + if content.contains("{message}") { + content = content.replace("{message}", message.body.as_str()); + } + + output = format!("{}{}", output, f.format_string(&content)); + } + + output.to_owned() + } + + fn process_click(&self, _name: &str, _state: &ZellijState, _pos: usize) {} +} diff --git a/sl0pstatus/src/widgets/pipe.rs b/sl0pstatus/src/widgets/pipe.rs new file mode 100644 index 0000000..2c5f724 --- /dev/null +++ b/sl0pstatus/src/widgets/pipe.rs @@ -0,0 +1,140 @@ +use lazy_static::lazy_static; +use regex::Regex; +use std::collections::BTreeMap; + +use crate::render::{FormattedPart, formatted_parts_from_string_cached}; + +use super::widget::Widget; + +lazy_static! { + static ref PIPE_REGEX: Regex = Regex::new("_[a-zA-Z0-9]+$").unwrap(); +} + +#[derive(Clone, Debug, PartialEq)] +enum RenderMode { + Static, + Dynamic, + Raw, +} + +pub struct PipeWidget { + config: BTreeMap<String, PipeConfig>, + zj_conf: BTreeMap<String, String>, +} + +#[derive(Clone)] +struct PipeConfig { + format: Vec<FormattedPart>, + render_mode: RenderMode, +} + +impl PipeWidget { + pub fn new(config: &BTreeMap<String, String>) -> Self { + Self { + config: parse_config(config), + zj_conf: config.clone(), + } + } +} + +impl Widget for PipeWidget { + fn process(&self, name: &str, state: &crate::config::ZellijState) -> String { + let pipe_config = match self.config.get(name) { + Some(pc) => pc, + None => { + tracing::debug!("pipe no name {name}"); + return "".to_owned(); + } + }; + + let pipe_result = match state.pipe_results.get(name) { + Some(pr) => pr, + None => { + tracing::debug!("pipe no content {name}"); + return "".to_owned(); + } + }; + + let content = pipe_config + .format + .iter() + .map(|f| { + let mut content = f.content.clone(); + + if content.contains("{output}") { + content = content.replace( + "{output}", + pipe_result.strip_suffix('\n').unwrap_or(pipe_result), + ) + } + + (f, content) + }) + .fold("".to_owned(), |acc, (f, content)| { + if pipe_config.render_mode == RenderMode::Static { + return format!("{acc}{}", f.format_string(&content)); + } + + format!("{acc}{}", content) + }); + + match pipe_config.render_mode { + RenderMode::Static => content, + RenderMode::Dynamic => render_dynamic_formatted_content(&content, &self.zj_conf), + RenderMode::Raw => pipe_result.to_owned(), + } + } + + fn process_click(&self, _name: &str, _state: &crate::config::ZellijState, _pos: usize) {} +} + +fn render_dynamic_formatted_content(content: &str, config: &BTreeMap<String, String>) -> String { + formatted_parts_from_string_cached(content, config) + .iter() + .map(|fp| fp.format_string(&fp.content)) + .collect::<Vec<String>>() + .join("") +} + +fn parse_config(zj_conf: &BTreeMap<String, String>) -> BTreeMap<String, PipeConfig> { + let mut keys: Vec<String> = zj_conf + .keys() + .filter(|k| k.starts_with("pipe_")) + .cloned() + .collect(); + keys.sort(); + + let mut config: BTreeMap<String, PipeConfig> = BTreeMap::new(); + + for key in keys { + let pipe_name = PIPE_REGEX.replace(&key, "").to_string(); + let mut pipe_conf = PipeConfig { + format: vec![], + render_mode: RenderMode::Static, + }; + + if let Some(existing_conf) = config.get(pipe_name.as_str()) { + pipe_conf = existing_conf.clone(); + } + + if key.ends_with("format") { + pipe_conf.format = + FormattedPart::multiple_from_format_string(zj_conf.get(&key).unwrap(), zj_conf); + } + + if key.ends_with("rendermode") { + pipe_conf.render_mode = match zj_conf.get(&key) { + Some(mode) => match mode.as_str() { + "static" => RenderMode::Static, + "dynamic" => RenderMode::Dynamic, + "raw" => RenderMode::Raw, + _ => RenderMode::Static, + }, + None => RenderMode::Static, + }; + } + + config.insert(pipe_name, pipe_conf); + } + config +} diff --git a/sl0pstatus/src/widgets/session.rs b/sl0pstatus/src/widgets/session.rs new file mode 100644 index 0000000..9e27f6d --- /dev/null +++ b/sl0pstatus/src/widgets/session.rs @@ -0,0 +1,22 @@ +use std::collections::BTreeMap; + +use crate::{config::ZellijState, widgets::widget::Widget}; + +pub struct SessionWidget {} + +impl SessionWidget { + pub fn new(_config: &BTreeMap<String, String>) -> Self { + Self {} + } +} + +impl Widget for SessionWidget { + fn process(&self, _name: &str, state: &ZellijState) -> String { + match &state.mode.session_name { + Some(name) => name.to_owned(), + None => "".to_owned(), + } + } + + fn process_click(&self, _name: &str, _state: &ZellijState, _pos: usize) {} +} diff --git a/sl0pstatus/src/widgets/swap_layout.rs b/sl0pstatus/src/widgets/swap_layout.rs new file mode 100644 index 0000000..8c9e036 --- /dev/null +++ b/sl0pstatus/src/widgets/swap_layout.rs @@ -0,0 +1,72 @@ +use std::collections::BTreeMap; +use zellij_tile::shim::next_swap_layout; + +use crate::render::FormattedPart; +use crate::{config::ZellijState, widgets::widget::Widget}; + +pub struct SwapLayoutWidget { + format: Vec<FormattedPart>, + hide_if_empty: bool, +} + +impl SwapLayoutWidget { + pub fn new(config: &BTreeMap<String, String>) -> Self { + let mut format: Vec<FormattedPart> = Vec::new(); + if let Some(form) = config.get("swap_layout_format") { + format = FormattedPart::multiple_from_format_string(form, config); + } + + let hide_if_empty = match config.get("swap_layout_hide_if_empty") { + Some(hide_if_empty) => hide_if_empty == "true", + None => false, + }; + + Self { + format, + hide_if_empty, + } + } +} + +impl Widget for SwapLayoutWidget { + fn process(&self, _name: &str, state: &ZellijState) -> String { + let active_tab = state.tabs.iter().find(|t| t.active); + + if active_tab.is_none() { + return "".to_owned(); + } + + let active_tab = active_tab.unwrap(); + + let name = match active_tab.active_swap_layout_name.clone() { + Some(n) => n, + None => "".to_owned(), + }; + + if name.is_empty() && self.hide_if_empty { + return "".to_owned(); + } + + if self.format.is_empty() { + return name; + } + + let mut output = "".to_owned(); + + for f in &self.format { + let mut content = f.content.clone(); + + if content.contains("{name}") { + content = content.replace("{name}", &name); + } + + output = format!("{}{}", output, f.format_string(&content)); + } + + output + } + + fn process_click(&self, _name: &str, _state: &ZellijState, _pos: usize) { + next_swap_layout() + } +} diff --git a/sl0pstatus/src/widgets/tabs.rs b/sl0pstatus/src/widgets/tabs.rs new file mode 100644 index 0000000..b62f581 --- /dev/null +++ b/sl0pstatus/src/widgets/tabs.rs @@ -0,0 +1,842 @@ +use std::{cmp, collections::BTreeMap}; + +use zellij_tile::{ + prelude::{InputMode, ModeInfo, PaneInfo, PaneManifest, TabInfo}, + shim::switch_tab_to, +}; + +use crate::{config::ZellijState, render::FormattedPart}; + +use super::widget::Widget; + +pub struct TabsWidget { + active_tab_format: Vec<FormattedPart>, + active_tab_fullscreen_format: Vec<FormattedPart>, + active_tab_sync_format: Vec<FormattedPart>, + normal_tab_format: Vec<FormattedPart>, + normal_tab_fullscreen_format: Vec<FormattedPart>, + normal_tab_sync_format: Vec<FormattedPart>, + normal_tab_bell_format: Option<Vec<FormattedPart>>, + normal_tab_flashing_bell_format: Option<Vec<FormattedPart>>, + rename_tab_format: Vec<FormattedPart>, + separator: Option<FormattedPart>, + fullscreen_indicator: Option<String>, + floating_indicator: Option<String>, + sync_indicator: Option<String>, + bell_indicator: Option<String>, + flashing_bell_indicator: Option<String>, + tab_display_count: Option<usize>, + tab_truncate_start_format: Vec<FormattedPart>, + tab_truncate_end_format: Vec<FormattedPart>, + tab_zero_based_index: bool, +} + +impl TabsWidget { + pub fn new(config: &BTreeMap<String, String>) -> Self { + let mut normal_tab_format: Vec<FormattedPart> = Vec::new(); + if let Some(form) = config.get("tab_normal") { + normal_tab_format = FormattedPart::multiple_from_format_string(form, config); + } + + let normal_tab_fullscreen_format = match config.get("tab_normal_fullscreen") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => normal_tab_format.clone(), + }; + + let normal_tab_sync_format = match config.get("tab_normal_sync") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => normal_tab_format.clone(), + }; + + let normal_tab_bell_format = config + .get("tab_normal_bell") + .map(|form| FormattedPart::multiple_from_format_string(form, config)); + + let normal_tab_flashing_bell_format = config + .get("tab_normal_flashing_bell") + .map(|form| FormattedPart::multiple_from_format_string(form, config)); + + let mut active_tab_format = normal_tab_format.clone(); + if let Some(form) = config.get("tab_active") { + active_tab_format = FormattedPart::multiple_from_format_string(form, config); + } + + let active_tab_fullscreen_format = match config.get("tab_active_fullscreen") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => active_tab_format.clone(), + }; + + let active_tab_sync_format = match config.get("tab_active_sync") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => active_tab_format.clone(), + }; + + let rename_tab_format = match config.get("tab_rename") { + Some(form) => FormattedPart::multiple_from_format_string(form, config), + None => active_tab_format.clone(), + }; + + let tab_display_count = match config.get("tab_display_count") { + Some(count) => count.parse::<usize>().ok(), + None => None, + }; + + let tab_truncate_start_format = config + .get("tab_truncate_start_format") + .map(|form| FormattedPart::multiple_from_format_string(form, config)) + .unwrap_or_default(); + + let tab_truncate_end_format = config + .get("tab_truncate_end_format") + .map(|form| FormattedPart::multiple_from_format_string(form, config)) + .unwrap_or_default(); + + let tab_zero_based_index = match config.get("tab_zero_based_index") { + Some(e) => matches!(e.as_str(), "true"), + None => false, + }; + + let separator = config + .get("tab_separator") + .map(|s| FormattedPart::from_format_string(s, config)); + + let bell_indicator = config.get("tab_bell_indicator").cloned(); + let flashing_bell_indicator = config + .get("tab_flashing_bell_indicator") + .cloned() + .or_else(|| bell_indicator.clone()); + + Self { + normal_tab_format, + normal_tab_fullscreen_format, + normal_tab_sync_format, + normal_tab_bell_format, + normal_tab_flashing_bell_format, + active_tab_format, + active_tab_fullscreen_format, + active_tab_sync_format, + rename_tab_format, + separator, + floating_indicator: config.get("tab_floating_indicator").cloned(), + sync_indicator: config.get("tab_sync_indicator").cloned(), + fullscreen_indicator: config.get("tab_fullscreen_indicator").cloned(), + bell_indicator, + flashing_bell_indicator, + tab_display_count, + tab_truncate_start_format, + tab_truncate_end_format, + tab_zero_based_index, + } + } +} + +impl Widget for TabsWidget { + fn process(&self, _name: &str, state: &ZellijState) -> String { + let mut output = "".to_owned(); + let mut counter = 0; + + let (truncated_start, truncated_end, tabs) = + get_tab_window(&state.tabs, self.tab_display_count); + + if truncated_start > 0 { + for f in &self.tab_truncate_start_format { + let mut content = f.content.clone(); + + if content.contains("{count}") { + content = content.replace("{count}", (truncated_start).to_string().as_str()); + } + + output = format!("{output}{}", f.format_string(&content)); + } + } + + for tab in &tabs { + let content = self.render_tab(tab, &state.panes, &state.mode); + counter += 1; + + output = format!("{}{}", output, content); + + if counter < tabs.len() + && let Some(sep) = &self.separator + { + output = format!("{}{}", output, sep.format_string(&sep.content)); + } + } + + if truncated_end > 0 { + for f in &self.tab_truncate_end_format { + let mut content = f.content.clone(); + + if content.contains("{count}") { + content = content.replace("{count}", (truncated_end).to_string().as_str()); + } + + output = format!("{output}{}", f.format_string(&content)); + } + } + + output + } + + fn process_click(&self, _name: &str, state: &ZellijState, pos: usize) { + let mut offset = 0; + let mut counter = 0; + + let (truncated_start, truncated_end, tabs) = + get_tab_window(&state.tabs, self.tab_display_count); + + let active_pos = &state + .tabs + .iter() + .find(|t| t.active) + .expect("no active tab") + .position + + 1; + + if truncated_start > 0 { + for f in &self.tab_truncate_start_format { + let mut content = f.content.clone(); + + if content.contains("{count}") { + content = content.replace("{count}", (truncated_end).to_string().as_str()); + } + + offset += console::measure_text_width(&f.format_string(&content)); + + if pos <= offset { + switch_tab_to(active_pos.saturating_sub(1) as u32); + } + } + } + + for tab in &tabs { + counter += 1; + + let mut rendered_content = self.render_tab(tab, &state.panes, &state.mode); + + if counter < tabs.len() + && let Some(sep) = &self.separator + { + rendered_content = + format!("{}{}", rendered_content, sep.format_string(&sep.content)); + } + + let content_len = console::measure_text_width(&rendered_content); + + if pos > offset && pos < offset + content_len { + switch_tab_to(tab.position as u32 + 1); + + break; + } + + offset += content_len; + } + + if truncated_end > 0 { + for f in &self.tab_truncate_end_format { + let mut content = f.content.clone(); + + if content.contains("{count}") { + content = content.replace("{count}", (truncated_end).to_string().as_str()); + } + + offset += console::measure_text_width(&f.format_string(&content)); + + if pos <= offset { + switch_tab_to(cmp::min(active_pos + 1, state.tabs.len()) as u32); + } + } + } + } +} + +impl TabsWidget { + fn select_format(&self, info: &TabInfo, mode: &ModeInfo) -> &Vec<FormattedPart> { + if info.active && mode.mode == InputMode::RenameTab { + return &self.rename_tab_format; + } + + if !info.active && info.is_flashing_bell { + let fmt = self + .normal_tab_flashing_bell_format + .as_ref() + .or(self.normal_tab_bell_format.as_ref()); + if let Some(fmt) = fmt { + return fmt; + } + } + + if !info.active + && info.has_bell_notification + && let Some(fmt) = self.normal_tab_bell_format.as_ref() + { + return fmt; + } + + if info.active && info.is_fullscreen_active { + return &self.active_tab_fullscreen_format; + } + + if info.active && info.is_sync_panes_active { + return &self.active_tab_sync_format; + } + + if info.active { + return &self.active_tab_format; + } + + if info.is_fullscreen_active { + return &self.normal_tab_fullscreen_format; + } + + if info.is_sync_panes_active { + return &self.normal_tab_sync_format; + } + + &self.normal_tab_format + } + + fn render_tab(&self, tab: &TabInfo, panes: &PaneManifest, mode: &ModeInfo) -> String { + let formatters = self.select_format(tab, mode); + let mut output = "".to_owned(); + + for f in formatters.iter() { + let mut content = f.content.clone(); + + let tab_name = match mode.mode { + InputMode::RenameTab => match tab.name.is_empty() { + true => "Enter name...", + false => tab.name.as_str(), + }, + _name => tab.name.as_str(), + }; + + if content.contains("{name}") { + content = content.replace("{name}", tab_name); + } + + if content.contains("{index}") { + let index = match self.tab_zero_based_index { + true => tab.position, + false => tab.position + 1, + }; + content = content.replace("{index}", index.to_string().as_str()); + } + + if content.contains("{floating_total_count}") { + let panes_for_tab: Vec<PaneInfo> = + panes.panes.get(&tab.position).cloned().unwrap_or_default(); + + content = content.replace( + "{floating_total_count}", + &format!("{}", panes_for_tab.iter().filter(|p| p.is_floating).count()), + ); + } + + if content.contains("{focused_pane_title}") { + let panes_for_tab: Vec<PaneInfo> = + panes.panes.get(&tab.position).cloned().unwrap_or_default(); + + let focused_pane_title = panes_for_tab + .iter() + .find(|pane| pane.is_focused) + .map(|pane| pane.title.clone()) + .unwrap_or_default(); + + content = content.replace("{focused_pane_title}", &focused_pane_title); + } + + content = self.replace_indicators(content, tab, panes); + + output = format!("{}{}", output, f.format_string(&content)); + } + + output.to_owned() + } + + fn replace_indicators(&self, content: String, tab: &TabInfo, panes: &PaneManifest) -> String { + let mut content = content; + if content.contains("{fullscreen_indicator}") + && let Some(fullscreen_indicator) = self.fullscreen_indicator.clone() + { + content = content.replace( + "{fullscreen_indicator}", + if tab.is_fullscreen_active { + fullscreen_indicator.as_ref() + } else { + "" + }, + ); + } + + if content.contains("{sync_indicator}") + && let Some(sync_indicator) = self.sync_indicator.clone() + { + content = content.replace( + "{sync_indicator}", + if tab.is_sync_panes_active { + sync_indicator.as_ref() + } else { + "" + }, + ); + } + + if content.contains("{floating_indicator}") + && let Some(floating_indicator) = self.floating_indicator.clone() + { + let panes_for_tab: Vec<PaneInfo> = + panes.panes.get(&tab.position).cloned().unwrap_or_default(); + + let is_floating = panes_for_tab.iter().any(|p| p.is_floating); + + content = content.replace( + "{floating_indicator}", + if is_floating { + floating_indicator.as_ref() + } else { + "" + }, + ); + } + + if content.contains("{bell_indicator}") + && (self.bell_indicator.is_some() || self.flashing_bell_indicator.is_some()) + { + let indicator = if tab.is_flashing_bell { + self.flashing_bell_indicator.as_deref().unwrap_or("") + } else if tab.has_bell_notification { + self.bell_indicator.as_deref().unwrap_or("") + } else { + "" + }; + + content = content.replace("{bell_indicator}", indicator); + } + + content + } +} + +pub fn get_tab_window( + tabs: &Vec<TabInfo>, + max_count: Option<usize>, +) -> (usize, usize, Vec<TabInfo>) { + let max_count = match max_count { + Some(count) => count, + None => return (0, 0, tabs.to_vec()), + }; + + if tabs.len() <= max_count { + return (0, 0, tabs.to_vec()); + } + + let active_index = tabs.iter().position(|t| t.active).expect("no active tab"); + + // active tab is in the last #max_count tabs, so return the last #max_count + if active_index > tabs.len().saturating_sub(max_count) { + return ( + tabs.len().saturating_sub(max_count), + 0, + tabs.iter() + .cloned() + .rev() + .take(max_count) + .rev() + .collect::<Vec<TabInfo>>(), + ); + } + + // tabs must be truncated + let first_index = active_index.saturating_sub(1); + let last_index = cmp::min(first_index + max_count, tabs.len()); + + ( + first_index, + tabs.len().saturating_sub(last_index), + tabs.as_slice()[first_index..last_index].to_vec(), + ) +} + +#[cfg(test)] +mod test { + use zellij_tile::prelude::TabInfo; + + use super::get_tab_window; + use rstest::rstest; + + #[rstest] + #[case( + vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "3".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "4".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "5".to_owned(), + ..TabInfo::default() + }, + ], + Some(3), + (1, 1, vec![ + TabInfo { + active: false, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "3".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "4".to_owned(), + ..TabInfo::default() + }, + ] + ) + )] + #[case( + vec![ + TabInfo { + active: true, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "3".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "4".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "5".to_owned(), + ..TabInfo::default() + }, + ], + Some(3), + (0, 2, vec![ + TabInfo { + active: true, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "3".to_owned(), + ..TabInfo::default() + }, + ] + ) + )] + #[case( + vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "3".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "4".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "5".to_owned(), + ..TabInfo::default() + }, + ], + Some(3), + (0, 2, vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "3".to_owned(), + ..TabInfo::default() + }, + ] + ) + )] + #[case( + vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "3".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "4".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "5".to_owned(), + ..TabInfo::default() + }, + ], + Some(3), + (2, 0, vec![ + TabInfo { + active: false, + name: "3".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "4".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "5".to_owned(), + ..TabInfo::default() + }, + ] + ) + )] + #[case( + vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "3".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "4".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "5".to_owned(), + ..TabInfo::default() + }, + ], + Some(3), + (2, 0, vec![ + TabInfo { + active: false, + name: "3".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "4".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "5".to_owned(), + ..TabInfo::default() + }, + ] + ) + )] + #[case( + vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "3".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "4".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "5".to_owned(), + ..TabInfo::default() + }, + ], + None, + (0, 0, vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "3".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "4".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "5".to_owned(), + ..TabInfo::default() + }, + ] + ) + )] + #[case( + vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "2".to_owned(), + ..TabInfo::default() + }, + ], + Some(3), + (0, 0, vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "2".to_owned(), + ..TabInfo::default() + }, + ] + ) + )] + #[case( + vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "3".to_owned(), + ..TabInfo::default() + }, + ], + Some(3), + (0, 0, vec![ + TabInfo { + active: false, + name: "1".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: true, + name: "2".to_owned(), + ..TabInfo::default() + }, + TabInfo { + active: false, + name: "3".to_owned(), + ..TabInfo::default() + }, + ] + ) + )] + pub fn test_get_tab_window( + #[case] tabs: Vec<TabInfo>, + #[case] max_count: Option<usize>, + #[case] expected: (usize, usize, Vec<TabInfo>), + ) { + let res = get_tab_window(&tabs, max_count); + + assert_eq!(res, expected); + } +} diff --git a/sl0pstatus/src/widgets/widget.rs b/sl0pstatus/src/widgets/widget.rs new file mode 100644 index 0000000..7087cba --- /dev/null +++ b/sl0pstatus/src/widgets/widget.rs @@ -0,0 +1,6 @@ +use crate::config::ZellijState; + +pub trait Widget { + fn process(&self, name: &str, state: &ZellijState) -> String; + fn process_click(&self, name: &str, state: &ZellijState, pos: usize); +} diff --git a/sl0pstatus/tests/zjframes/config.kdl b/sl0pstatus/tests/zjframes/config.kdl new file mode 100644 index 0000000..26b5557 --- /dev/null +++ b/sl0pstatus/tests/zjframes/config.kdl @@ -0,0 +1,422 @@ +// If you'd like to override the default keybindings completely, be sure to change "keybinds" to "keybinds clear-defaults=true" +keybinds { + normal { + // uncomment this and adjust key if using copy_on_select=false + // bind "Alt c" { Copy; } + } + locked { + bind "Ctrl g" { SwitchToMode "Normal"; } + } + resize { + bind "Ctrl n" { SwitchToMode "Normal"; } + bind "h" "Left" { Resize "Increase Left"; } + bind "j" "Down" { Resize "Increase Down"; } + bind "k" "Up" { Resize "Increase Up"; } + bind "l" "Right" { Resize "Increase Right"; } + bind "H" { Resize "Decrease Left"; } + bind "J" { Resize "Decrease Down"; } + bind "K" { Resize "Decrease Up"; } + bind "L" { Resize "Decrease Right"; } + bind "=" "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + } + pane { + bind "Ctrl p" { SwitchToMode "Normal"; } + bind "h" "Left" { MoveFocus "Left"; } + bind "l" "Right" { MoveFocus "Right"; } + bind "j" "Down" { MoveFocus "Down"; } + bind "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { NewPane; SwitchToMode "Normal"; } + bind "d" { NewPane "Down"; SwitchToMode "Normal"; } + bind "r" { NewPane "Right"; SwitchToMode "Normal"; } + bind "x" { CloseFocus; SwitchToMode "Normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "Normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "Normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "Normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "Normal"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0;} + } + move { + bind "Ctrl h" { SwitchToMode "Normal"; } + bind "n" "Tab" { MovePane; } + bind "p" { MovePaneBackwards; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + } + tab { + bind "Ctrl t" { SwitchToMode "Normal"; } + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "Normal"; } + bind "x" { CloseTab; SwitchToMode "Normal"; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "Normal"; } + bind "b" { BreakPane; SwitchToMode "Normal"; } + bind "]" { BreakPaneRight; SwitchToMode "Normal"; } + bind "[" { BreakPaneLeft; SwitchToMode "Normal"; } + bind "1" { GoToTab 1; SwitchToMode "Normal"; } + bind "2" { GoToTab 2; SwitchToMode "Normal"; } + bind "3" { GoToTab 3; SwitchToMode "Normal"; } + bind "4" { GoToTab 4; SwitchToMode "Normal"; } + bind "5" { GoToTab 5; SwitchToMode "Normal"; } + bind "6" { GoToTab 6; SwitchToMode "Normal"; } + bind "7" { GoToTab 7; SwitchToMode "Normal"; } + bind "8" { GoToTab 8; SwitchToMode "Normal"; } + bind "9" { GoToTab 9; SwitchToMode "Normal"; } + bind "Tab" { ToggleTab; } + } + scroll { + bind "Ctrl s" { SwitchToMode "Normal"; } + bind "e" { EditScrollback; SwitchToMode "Normal"; } + bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + // uncomment this and adjust key if using copy_on_select=false + // bind "Alt c" { Copy; } + } + search { + bind "Ctrl s" { SwitchToMode "Normal"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "n" { Search "down"; } + bind "p" { Search "up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + entersearch { + bind "Ctrl c" "Esc" { SwitchToMode "Scroll"; } + bind "Enter" { SwitchToMode "Search"; } + } + renametab { + bind "Ctrl c" { SwitchToMode "Normal"; } + bind "Esc" { UndoRenameTab; SwitchToMode "Tab"; } + } + renamepane { + bind "Ctrl c" { SwitchToMode "Normal"; } + bind "Esc" { UndoRenamePane; SwitchToMode "Pane"; } + } + session { + bind "Ctrl o" { SwitchToMode "Normal"; } + bind "Ctrl s" { SwitchToMode "Scroll"; } + bind "d" { Detach; } + bind "w" { + LaunchOrFocusPlugin "session-manager" { + floating true + move_to_focused_tab true + }; + SwitchToMode "Normal" + } + bind "c" { + LaunchOrFocusPlugin "configuration" { + floating true + move_to_focused_tab true + }; + SwitchToMode "Normal" + } + bind "p" { + LaunchOrFocusPlugin "plugin-manager" { + floating true + move_to_focused_tab true + }; + SwitchToMode "Normal" + } + } + tmux { + bind "[" { SwitchToMode "Scroll"; } + bind "Ctrl b" { Write 2; SwitchToMode "Normal"; } + bind "\"" { NewPane "Down"; SwitchToMode "Normal"; } + bind "%" { NewPane "Right"; SwitchToMode "Normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; } + bind "c" { NewTab; SwitchToMode "Normal"; } + bind "," { SwitchToMode "RenameTab"; } + bind "p" { GoToPreviousTab; SwitchToMode "Normal"; } + bind "n" { GoToNextTab; SwitchToMode "Normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "Normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "Normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "Normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "Normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "Normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "Normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "Normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "Normal"; } + bind "o" { FocusNextPane; } + bind "d" { Detach; } + bind "Space" { NextSwapLayout; } + bind "x" { CloseFocus; SwitchToMode "Normal"; } + } + shared_except "locked" { + bind "Ctrl g" { SwitchToMode "Locked"; } + bind "Ctrl q" { Quit; } + bind "Alt f" { ToggleFloatingPanes; } + bind "Alt n" { NewPane; } + bind "Alt i" { MoveTab "Left"; } + bind "Alt o" { MoveTab "Right"; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "Alt [" { PreviousSwapLayout; } + bind "Alt ]" { NextSwapLayout; } + } + shared_except "normal" "locked" { + bind "Enter" "Esc" { SwitchToMode "Normal"; } + } + shared_except "pane" "locked" { + bind "Ctrl p" { SwitchToMode "Pane"; } + } + shared_except "resize" "locked" { + bind "Ctrl n" { SwitchToMode "Resize"; } + } + shared_except "scroll" "locked" { + bind "Ctrl s" { SwitchToMode "Scroll"; } + } + shared_except "session" "locked" { + bind "Ctrl o" { SwitchToMode "Session"; } + } + shared_except "tab" "locked" { + bind "Ctrl t" { SwitchToMode "Tab"; } + } + shared_except "move" "locked" { + bind "Ctrl h" { SwitchToMode "Move"; } + } + shared_except "tmux" "locked" { + bind "Ctrl b" { SwitchToMode "Tmux"; } + } +} + +// Plugin aliases - can be used to change the implementation of Zellij +// changing these requires a restart to take effect +plugins { + tab-bar location="zellij:tab-bar" + status-bar location="zellij:status-bar" + strider location="zellij:strider" + compact-bar location="zellij:compact-bar" + session-manager location="zellij:session-manager" + welcome-screen location="zellij:session-manager" { + welcome_screen true + } + filepicker location="zellij:strider" { + cwd "/" + } + configuration location="zellij:configuration" + plugin-manager location="zellij:plugin-manager" +} + +// Plugins to load in the background when a new session starts +load_plugins { + "file:./target/wasm32-wasip1/debug/zjframes.wasm" { + hide_frame_for_single_pane "true" + hide_frame_except_for_search "true" + hide_frame_except_for_fullscreen "true" + } + // "file:/path/to/my-plugin.wasm" + // "https://example.com/my-plugin.wasm" +} + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// (Requires restart) +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +// simplified_ui true + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Choose the path to override cwd that zellij will use for opening new panes +// +// default_cwd "" + +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +pane_frames true + + +ui { + pane_frames { + hide_session_name true + rounded_corners true + } +} + +// Toggle between having Zellij lay out panes according to a predefined set of layouts whenever possible +// Options: +// - true (default) +// - false +// +// auto_layout true + +// Whether sessions should be serialized to the cache folder (including their tabs/panes, cwds and running commands) so that they can later be resurrected +// (Requires restart) +// Options: +// - true (default) +// - false +// +session_serialization false + +// Whether pane viewports are serialized along with the session, default is false +// (Requires restart) +// Options: +// - true +// - false (default) +// +// serialize_pane_viewport true + +// Scrollback lines to serialize along with the pane viewport when serializing sessions, 0 +// defaults to the scrollback size. If this number is higher than the scrollback size, it will +// also default to the scrollback size. This does nothing if `serialize_pane_viewport` is not true. +// (Requires restart) +// +// scrollback_lines_to_serialize 10000 + +// Define color themes for Zellij +// For more examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes +// Once these themes are defined, one of them should to be selected in the "theme" section of this file +// +// themes { +// dracula { +// fg 248 248 242 +// bg 40 42 54 +// red 255 85 85 +// green 80 250 123 +// yellow 241 250 140 +// blue 98 114 164 +// magenta 255 121 198 +// orange 255 184 108 +// cyan 139 233 253 +// black 0 0 0 +// white 255 255 255 +// } +// } + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "default" + +// The name of the default layout to load on startup +// Default: "default" +// (Requires restart) +// +// default_layout "compact" + +// Choose the mode that zellij uses when starting up. +// Default: normal +// +// default_mode "locked" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// (Requires restart) +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// (Requires restart) +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +// copy_on_select false + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +// scrollback_editor "/usr/bin/vim" + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// (Requires restart) +// Default: false +// +// mirror_session true + +// The folder in which Zellij will look for layouts +// (Requires restart) +// +// layout_dir "/path/to/my/layout_dir" + +// The folder in which Zellij will look for themes +// (Requires restart) +// +// theme_dir "/path/to/my/theme_dir" + +// Enable or disable the rendering of styled and colored underlines (undercurl). +// May need to be disabled for certain unsupported terminals +// (Requires restart) +// Default: true +// +// styled_underlines false + +// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know +// metadata info on this session) +// (Requires restart) +// Default: false +// +// disable_session_metadata true + +// Enable or disable support for the enhanced Kitty Keyboard Protocol (the host terminal must also support it) +// (Requires restart) +// Default: true (if the host terminal supports it) +// +// support_kitty_keyboard_protocol false diff --git a/sl0pstatus/tests/zjframes/layout.kdl b/sl0pstatus/tests/zjframes/layout.kdl new file mode 100644 index 0000000..8ce2ddf --- /dev/null +++ b/sl0pstatus/tests/zjframes/layout.kdl @@ -0,0 +1,9 @@ +layout { + pane size=1 borderless=true { + plugin location="tab-bar" + } + pane + pane size=1 borderless=true { + plugin location="status-bar" + } +} diff --git a/sl0pstatus/tests/zjstatus/config.kdl b/sl0pstatus/tests/zjstatus/config.kdl new file mode 100644 index 0000000..8119030 --- /dev/null +++ b/sl0pstatus/tests/zjstatus/config.kdl @@ -0,0 +1,409 @@ +// If you'd like to override the default keybindings completely, be sure to change "keybinds" to "keybinds clear-defaults=true" +keybinds { + normal { + // uncomment this and adjust key if using copy_on_select=false + // bind "Alt c" { Copy; } + } + locked { + bind "Ctrl g" { SwitchToMode "Normal"; } + } + resize { + bind "Ctrl n" { SwitchToMode "Normal"; } + bind "h" "Left" { Resize "Increase Left"; } + bind "j" "Down" { Resize "Increase Down"; } + bind "k" "Up" { Resize "Increase Up"; } + bind "l" "Right" { Resize "Increase Right"; } + bind "H" { Resize "Decrease Left"; } + bind "J" { Resize "Decrease Down"; } + bind "K" { Resize "Decrease Up"; } + bind "L" { Resize "Decrease Right"; } + bind "=" "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + } + pane { + bind "Ctrl p" { SwitchToMode "Normal"; } + bind "h" "Left" { MoveFocus "Left"; } + bind "l" "Right" { MoveFocus "Right"; } + bind "j" "Down" { MoveFocus "Down"; } + bind "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { NewPane; SwitchToMode "Normal"; } + bind "d" { NewPane "Down"; SwitchToMode "Normal"; } + bind "r" { NewPane "Right"; SwitchToMode "Normal"; } + bind "x" { CloseFocus; SwitchToMode "Normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "Normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "Normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "Normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "Normal"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0;} + } + move { + bind "Ctrl h" { SwitchToMode "Normal"; } + bind "n" "Tab" { MovePane; } + bind "p" { MovePaneBackwards; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + } + tab { + bind "Ctrl t" { SwitchToMode "Normal"; } + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "Normal"; } + bind "x" { CloseTab; SwitchToMode "Normal"; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "Normal"; } + bind "b" { BreakPane; SwitchToMode "Normal"; } + bind "]" { BreakPaneRight; SwitchToMode "Normal"; } + bind "[" { BreakPaneLeft; SwitchToMode "Normal"; } + bind "1" { GoToTab 1; SwitchToMode "Normal"; } + bind "2" { GoToTab 2; SwitchToMode "Normal"; } + bind "3" { GoToTab 3; SwitchToMode "Normal"; } + bind "4" { GoToTab 4; SwitchToMode "Normal"; } + bind "5" { GoToTab 5; SwitchToMode "Normal"; } + bind "6" { GoToTab 6; SwitchToMode "Normal"; } + bind "7" { GoToTab 7; SwitchToMode "Normal"; } + bind "8" { GoToTab 8; SwitchToMode "Normal"; } + bind "9" { GoToTab 9; SwitchToMode "Normal"; } + bind "Tab" { ToggleTab; } + } + scroll { + bind "Ctrl s" { SwitchToMode "Normal"; } + bind "e" { EditScrollback; SwitchToMode "Normal"; } + bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + // uncomment this and adjust key if using copy_on_select=false + // bind "Alt c" { Copy; } + } + search { + bind "Ctrl s" { SwitchToMode "Normal"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "n" { Search "down"; } + bind "p" { Search "up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + entersearch { + bind "Ctrl c" "Esc" { SwitchToMode "Scroll"; } + bind "Enter" { SwitchToMode "Search"; } + } + renametab { + bind "Ctrl c" { SwitchToMode "Normal"; } + bind "Esc" { UndoRenameTab; SwitchToMode "Tab"; } + } + renamepane { + bind "Ctrl c" { SwitchToMode "Normal"; } + bind "Esc" { UndoRenamePane; SwitchToMode "Pane"; } + } + session { + bind "Ctrl o" { SwitchToMode "Normal"; } + bind "Ctrl s" { SwitchToMode "Scroll"; } + bind "d" { Detach; } + bind "w" { + LaunchOrFocusPlugin "session-manager" { + floating true + move_to_focused_tab true + }; + SwitchToMode "Normal" + } + bind "c" { + LaunchOrFocusPlugin "configuration" { + floating true + move_to_focused_tab true + }; + SwitchToMode "Normal" + } + bind "p" { + LaunchOrFocusPlugin "plugin-manager" { + floating true + move_to_focused_tab true + }; + SwitchToMode "Normal" + } + } + tmux { + bind "[" { SwitchToMode "Scroll"; } + bind "Ctrl b" { Write 2; SwitchToMode "Normal"; } + bind "\"" { NewPane "Down"; SwitchToMode "Normal"; } + bind "%" { NewPane "Right"; SwitchToMode "Normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; } + bind "c" { NewTab; SwitchToMode "Normal"; } + bind "," { SwitchToMode "RenameTab"; } + bind "p" { GoToPreviousTab; SwitchToMode "Normal"; } + bind "n" { GoToNextTab; SwitchToMode "Normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "Normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "Normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "Normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "Normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "Normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "Normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "Normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "Normal"; } + bind "o" { FocusNextPane; } + bind "d" { Detach; } + bind "Space" { NextSwapLayout; } + bind "x" { CloseFocus; SwitchToMode "Normal"; } + } + shared_except "locked" { + bind "Ctrl g" { SwitchToMode "Locked"; } + bind "Ctrl q" { Quit; } + bind "Alt f" { ToggleFloatingPanes; } + bind "Alt n" { NewPane; } + bind "Alt i" { MoveTab "Left"; } + bind "Alt o" { MoveTab "Right"; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "Alt [" { PreviousSwapLayout; } + bind "Alt ]" { NextSwapLayout; } + } + shared_except "normal" "locked" { + bind "Enter" "Esc" { SwitchToMode "Normal"; } + } + shared_except "pane" "locked" { + bind "Ctrl p" { SwitchToMode "Pane"; } + } + shared_except "resize" "locked" { + bind "Ctrl n" { SwitchToMode "Resize"; } + } + shared_except "scroll" "locked" { + bind "Ctrl s" { SwitchToMode "Scroll"; } + } + shared_except "session" "locked" { + bind "Ctrl o" { SwitchToMode "Session"; } + } + shared_except "tab" "locked" { + bind "Ctrl t" { SwitchToMode "Tab"; } + } + shared_except "move" "locked" { + bind "Ctrl h" { SwitchToMode "Move"; } + } + shared_except "tmux" "locked" { + bind "Ctrl b" { SwitchToMode "Tmux"; } + } +} + +// Plugin aliases - can be used to change the implementation of Zellij +// changing these requires a restart to take effect +plugins { + tab-bar location="zellij:tab-bar" + status-bar location="zellij:status-bar" + strider location="zellij:strider" + compact-bar location="zellij:compact-bar" + session-manager location="zellij:session-manager" + welcome-screen location="zellij:session-manager" { + welcome_screen true + } + filepicker location="zellij:strider" { + cwd "/" + } + configuration location="zellij:configuration" + plugin-manager location="zellij:plugin-manager" +} + +// Plugins to load in the background when a new session starts +load_plugins { + // "file:/path/to/my-plugin.wasm" + // "https://example.com/my-plugin.wasm" +} + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// (Requires restart) +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +// simplified_ui true + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Choose the path to override cwd that zellij will use for opening new panes +// +// default_cwd "" + +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +pane_frames false + +// Toggle between having Zellij lay out panes according to a predefined set of layouts whenever possible +// Options: +// - true (default) +// - false +// +// auto_layout true + +// Whether sessions should be serialized to the cache folder (including their tabs/panes, cwds and running commands) so that they can later be resurrected +// (Requires restart) +// Options: +// - true (default) +// - false +// +session_serialization false + +// Whether pane viewports are serialized along with the session, default is false +// (Requires restart) +// Options: +// - true +// - false (default) +// +// serialize_pane_viewport true + +// Scrollback lines to serialize along with the pane viewport when serializing sessions, 0 +// defaults to the scrollback size. If this number is higher than the scrollback size, it will +// also default to the scrollback size. This does nothing if `serialize_pane_viewport` is not true. +// (Requires restart) +// +// scrollback_lines_to_serialize 10000 + +// Define color themes for Zellij +// For more examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes +// Once these themes are defined, one of them should to be selected in the "theme" section of this file +// +// themes { +// dracula { +// fg 248 248 242 +// bg 40 42 54 +// red 255 85 85 +// green 80 250 123 +// yellow 241 250 140 +// blue 98 114 164 +// magenta 255 121 198 +// orange 255 184 108 +// cyan 139 233 253 +// black 0 0 0 +// white 255 255 255 +// } +// } + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "default" + +// The name of the default layout to load on startup +// Default: "default" +// (Requires restart) +// +// default_layout "compact" + +// Choose the mode that zellij uses when starting up. +// Default: normal +// +// default_mode "locked" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// (Requires restart) +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// (Requires restart) +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +// copy_on_select false + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +// scrollback_editor "/usr/bin/vim" + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// (Requires restart) +// Default: false +// +// mirror_session true + +// The folder in which Zellij will look for layouts +// (Requires restart) +// +// layout_dir "/path/to/my/layout_dir" + +// The folder in which Zellij will look for themes +// (Requires restart) +// +// theme_dir "/path/to/my/theme_dir" + +// Enable or disable the rendering of styled and colored underlines (undercurl). +// May need to be disabled for certain unsupported terminals +// (Requires restart) +// Default: true +// +// styled_underlines false + +// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know +// metadata info on this session) +// (Requires restart) +// Default: false +// +// disable_session_metadata true + +// Enable or disable support for the enhanced Kitty Keyboard Protocol (the host terminal must also support it) +// (Requires restart) +// Default: true (if the host terminal supports it) +// +// support_kitty_keyboard_protocol false diff --git a/sl0pstatus/tests/zjstatus/layout.kdl b/sl0pstatus/tests/zjstatus/layout.kdl new file mode 100644 index 0000000..da1d6d4 --- /dev/null +++ b/sl0pstatus/tests/zjstatus/layout.kdl @@ -0,0 +1,89 @@ +layout { + pane split_direction="vertical" { + pane + } + + pane size=2 borderless=true { + plugin location="file:target/wasm32-wasip1/debug/zjstatus.wasm" { + color_blue "#89B4FA" + color_yellow "yellow" + color_bg "#181825" + + format_left "{mode}#[fg=$blue,bg=$bg,bold] {session}" + format_center "{tabs} {command_3} {pipe_1}" + format_right "{notifications}{datetime}" + format_space "#[bg=$bg]" + format_precedence "lrc" + format_hide_on_overlength "false" + + notification_format_unread "#[fg=$blue,bg=$bg,blink] #[fg=$blue,bg=$bg] {message} " + notification_format_no_notifications "#[fg=$blue,bg=$bg,dim] " + notification_show_interval "10" + + pipe_1_format "#[fg=red] {output}" + + border_enabled "true" + border_char "─" + border_format "#[fg=#6C7086]{char}" + border_position "top" + + swap_layout_format "#[bg=blue,fg=#000000] {name} #[bg=red,fg=black] foo " + swap_layout_hide_if_empty "false" + + hide_frame_for_single_pane "false" + hide_frame_except_for_search "true" + hide_frame_except_for_fullscreen "false" + hide_frame_except_for_scroll "true" + + mode_normal "#[bg=$blue] #[bg=yellow] " + mode_tmux "#[bg=$yellow] " + mode_default_to_mode "tmux" + + tab_normal "#[fg=#6C7086,bg=$bg] {index} {name} {floating_indicator}{bell_indicator} " + tab_rename "#[fg=#eba0ac,bg=$bg] {index} {name} {floating_indicator} " + tab_normal_fullscreen "#[fg=#6C7086,bg=$bg] {index} {name} [] " + tab_normal_sync "#[fg=#6C7086,bg=$bg] {index} {name} <> " + tab_normal_bell "#[fg=#f38ba8,bg=$bg,bold] {index} {name} {bell_indicator} " + tab_normal_flashing_bell "#[fg=$bg,bg=#f38ba8,bold] {index} {name} {bell_indicator} " + tab_active "#[fg=#9399B2,bg=$bg,bold,italic] {index} {name} {floating_total_count}{floating_indicator}{sync_indicator}{fullscreen_indicator}" + tab_separator "#[fg=#6C7086,bg=$bg] | " + tab_floating_indicator "F" + tab_sync_indicator "S" + tab_fullscreen_indicator "FS" + tab_bell_indicator "!" + tab_flashing_bell_indicator "!!" + tab_display_count "3" + tab_truncate_start_format "#[fg=$blue,bg=$bg]#[bg=$blue,fg=black] +{count} ... #[fg=$bg,bg=$blue]" + tab_truncate_end_format "#[fg=red,bg=$bg] ... +{count} > #[bg=$yellow] " + tab_zero_based_index "false" + + command_0_command "echo \"平仮名, ひらがな 📦\"" + command_0_clickaction "bash -c \"zellij --session zjstatus-dev pipe 'zjstatus::notify::hello world!' -n zjstatus\"" + command_0_format "#[fg=colour80] {exit_code} #[fg=colour90] {stdout} " + command_0_interval "1" + + command_1_command "date" + command_1_format "#[fg=blue,reverse,bg=default,us=red,blink,dim,strikethrough] {exit_code} {stdout} " + command_1_interval "1" + + command_git_branch_command "bash -c \"echo $FOO\"" + command_git_branch_cwd "/Users/daniel" + command_git_branch_env { + FOO "1" + BAR "foo" + } + command_git_branch_format "#[fg=red] {stdout} " + command_git_branch_interval "2" + + command_3_command "echo -e \"#[fg=$yellow,italic,bold] foo #[dim,bold,italic] bar \"" + command_3_format "{stdout}" + command_3_interval "10" + command_3_rendermode "dynamic" + + datetime "#[fg=#6C7086,bg=$bg,bold] {format} #[bg=#6C7086,fg=$bg,bold] {time}" + datetime_time_format "%H:%M:%S" + datetime_format "%A, %d %b %Y %H:%M" + datetime_timezone "Europe/Berlin" + } + } +} |
