arboard-3.6.1/.cargo_vcs_info.json 0000644 00000000136 00000000001 0012455 0 ustar {
"git": {
"sha1": "a3750c79a5d63f3987317e03c412b7d9dffdc2af"
},
"path_in_vcs": ""
} arboard-3.6.1/.github/workflows/test.yml 0000644 0000000 0000000 00000006630 10461020230 0016351 0 ustar 0000000 0000000 name: Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
rustfmt:
runs-on: ubuntu-22.04
steps:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
needs: rustfmt
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
# Latest stable and MSRV. We only run checks with all features enabled
# for the MSRV build to keep CI fast, since other configurations should also work.
rust_version: [stable, "1.71.0"]
steps:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust_version }}
components: clippy
- uses: actions/checkout@v4
- name: Run `cargo clippy` with no features
if: ${{ matrix.rust_version == 'stable' }}
run: cargo clippy --verbose --no-default-features -- -D warnings -D clippy::dbg_macro
- name: Run `cargo clippy` with `image-data` feature
if: ${{ matrix.rust_version == 'stable' }}
run: cargo clippy --verbose --no-default-features --features image-data -- -D warnings -D clippy::dbg_macro
- name: Run `cargo clippy` with `wayland-data-control` feature
if: ${{ matrix.rust_version == 'stable' }}
run: cargo clippy --verbose --no-default-features --features wayland-data-control -- -D warnings -D clippy::dbg_macro
- name: Run `cargo clippy` with all features
run: cargo clippy --verbose --all-features -- -D warnings -D clippy::dbg_macro
- name: Run `cargo clippy` with dependency version checks
if: ${{ matrix.rust_version == 'stable' }}
run: |
cargo update -p windows-sys
cargo clippy --verbose --all-features -- -D warnings -D clippy::dbg_macro
test:
needs: clippy
runs-on: ${{ matrix.os }}
strategy:
matrix:
# No Linux test for now as it just fails due to not having a desktop environment.
os: [macos-latest, windows-latest]
steps:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Checkout
uses: actions/checkout@v4
- name: Run tests with no features
run: cargo test --no-default-features
- name: Run tests with `image-data` feature
run: cargo test --no-default-features --features image-data
- name: Run tests with `wayland-data-control` feature
run: cargo test --no-default-features --features wayland-data-control
- name: Run tests with all features
run: cargo test --all-features
miri:
needs: clippy
env:
MIRIFLAGS: -Zmiri-symbolic-alignment-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Currently, only Windows has soundness tests.
os: [windows-latest]
steps:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2023-10-08
components: miri
- name: Checkout
uses: actions/checkout@v4
- name: Check soundness
run: cargo miri test windows --features image-data
semver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
arboard-3.6.1/.gitignore 0000644 0000000 0000000 00000000025 10461020230 0013232 0 ustar 0000000 0000000 target
.vscode
*.png
arboard-3.6.1/Cargo.lock 0000644 00000054444 00000000001 0010443 0 ustar # This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aho-corasick"
version = "0.7.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
dependencies = [
"memchr",
]
[[package]]
name = "arboard"
version = "3.6.1"
dependencies = [
"clipboard-win",
"env_logger",
"image",
"log",
"objc2",
"objc2-app-kit",
"objc2-core-foundation",
"objc2-core-graphics",
"objc2-foundation",
"parking_lot",
"percent-encoding",
"windows-sys",
"wl-clipboard-rs",
"x11rb",
]
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
[[package]]
name = "bytemuck"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f5715e491b5a1598fc2bef5a606847b5dc1d48ea625bd3c02c00de8285591da"
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cc"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clipboard-win"
version = "5.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79f4473f5144e20d9aceaf2972478f06ddf687831eafeeb434fbaf0acc4144ad"
dependencies = [
"error-code",
]
[[package]]
name = "crc32fast"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [
"cfg-if",
]
[[package]]
name = "downcast-rs"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]]
name = "env_logger"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580"
dependencies = [
"humantime",
"is-terminal",
"log",
"regex",
"termcolor",
]
[[package]]
name = "errno"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "error-code"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "281e452d3bad4005426416cdba5ccfd4f5c1280e10099e21db27f7c1c28347fc"
[[package]]
name = "fastrand"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "fixedbitset"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "flate2"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
dependencies = [
"crc32fast",
"miniz_oxide",
]
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "gethostname"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818"
dependencies = [
"libc",
"windows-targets 0.48.0",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hermit-abi"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "image"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd54d660e773627692c524beaad361aca785a4f9f5730ce91f42aabe5bce3d11"
dependencies = [
"bytemuck",
"byteorder",
"num-traits",
"png",
"tiff",
]
[[package]]
name = "indexmap"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "is-terminal"
version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e19b23d53f35ce9f56aebc7d1bb4e6ac1e9c0db7ac85c8d1760c04379edced37"
dependencies = [
"hermit-abi",
"libc",
"windows-sys",
]
[[package]]
name = "jpeg-decoder"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"
[[package]]
name = "libc"
version = "0.2.169"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
[[package]]
name = "linux-raw-sys"
version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
[[package]]
name = "lock_api"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[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.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34"
dependencies = [
"adler",
]
[[package]]
name = "nom"
version = "7.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]]
name = "num-traits"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
"autocfg",
]
[[package]]
name = "objc2"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3531f65190d9cff863b77a99857e74c314dd16bf56c538c4b57c7cbc3f3a6e59"
dependencies = [
"objc2-encode",
]
[[package]]
name = "objc2-app-kit"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5906f93257178e2f7ae069efb89fbd6ee94f0592740b5f8a1512ca498814d0fb"
dependencies = [
"bitflags 2.8.0",
"objc2",
"objc2-core-graphics",
"objc2-foundation",
]
[[package]]
name = "objc2-core-foundation"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daeaf60f25471d26948a1c2f840e3f7d86f4109e3af4e8e4b5cd70c39690d925"
dependencies = [
"bitflags 2.8.0",
"objc2",
]
[[package]]
name = "objc2-core-graphics"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dca602628b65356b6513290a21a6405b4d4027b8b250f0b98dddbb28b7de02"
dependencies = [
"bitflags 2.8.0",
"objc2",
"objc2-core-foundation",
"objc2-io-surface",
]
[[package]]
name = "objc2-encode"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
[[package]]
name = "objc2-foundation"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a21c6c9014b82c39515db5b396f91645182611c97d24637cf56ac01e5f8d998"
dependencies = [
"bitflags 2.8.0",
"objc2",
"objc2-core-foundation",
]
[[package]]
name = "objc2-io-surface"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "161a8b87e32610086e1a7a9e9ec39f84459db7b3a0881c1f16ca5a2605581c19"
dependencies = [
"bitflags 2.8.0",
"objc2",
"objc2-core-foundation",
]
[[package]]
name = "once_cell"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
[[package]]
name = "os_pipe"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29d73ba8daf8fac13b0501d1abeddcfe21ba7401ada61a819144b6c2a4f32209"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-targets 0.52.6",
]
[[package]]
name = "percent-encoding"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "petgraph"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143"
dependencies = [
"fixedbitset",
"indexmap",
]
[[package]]
name = "pkg-config"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
[[package]]
name = "png"
version = "0.17.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f0e7f4c94ec26ff209cee506314212639d6c91b80afb82984819fafce9df01c"
dependencies = [
"bitflags 1.3.2",
"crc32fast",
"flate2",
"miniz_oxide",
]
[[package]]
name = "proc-macro2"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quick-xml"
version = "0.37.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "165859e9e55f79d67b96c5d96f4e88b6f2695a1972849c15a6a3f5c59fc2c003"
dependencies = [
"memchr",
]
[[package]]
name = "quote"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
[[package]]
name = "redox_syscall"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
dependencies = [
"bitflags 2.8.0",
]
[[package]]
name = "regex"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
[[package]]
name = "rustix"
version = "0.38.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
dependencies = [
"bitflags 2.8.0",
"errno",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "smallvec"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
[[package]]
name = "syn"
version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52205623b1b0f064a4e71182c3b18ae902267282930c6d5462c91b859668426e"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tempfile"
version = "3.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
"cfg-if",
"fastrand",
"rustix",
"windows-sys",
]
[[package]]
name = "termcolor"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tiff"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e"
dependencies = [
"flate2",
"jpeg-decoder",
"weezl",
]
[[package]]
name = "tree_magic_mini"
version = "3.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aac5e8971f245c3389a5a76e648bfc80803ae066a1243a75db0064d7c1129d63"
dependencies = [
"fnv",
"memchr",
"nom",
"once_cell",
"petgraph",
]
[[package]]
name = "unicode-ident"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd"
[[package]]
name = "wayland-backend"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7208998eaa3870dad37ec8836979581506e0c5c64c20c9e79e9d2a10d6f47bf"
dependencies = [
"cc",
"downcast-rs",
"rustix",
"smallvec",
"wayland-sys",
]
[[package]]
name = "wayland-client"
version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2120de3d33638aaef5b9f4472bff75f07c56379cf76ea320bd3a3d65ecaf73f"
dependencies = [
"bitflags 2.8.0",
"rustix",
"wayland-backend",
"wayland-scanner",
]
[[package]]
name = "wayland-protocols"
version = "0.32.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0781cf46869b37e36928f7b432273c0995aa8aed9552c556fb18754420541efc"
dependencies = [
"bitflags 2.8.0",
"wayland-backend",
"wayland-client",
"wayland-scanner",
]
[[package]]
name = "wayland-protocols-wlr"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "248a02e6f595aad796561fa82d25601bd2c8c3b145b1c7453fc8f94c1a58f8b2"
dependencies = [
"bitflags 2.8.0",
"wayland-backend",
"wayland-client",
"wayland-protocols",
"wayland-scanner",
]
[[package]]
name = "wayland-scanner"
version = "0.31.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484"
dependencies = [
"proc-macro2",
"quick-xml",
"quote",
]
[[package]]
name = "wayland-sys"
version = "0.31.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615"
dependencies = [
"pkg-config",
]
[[package]]
name = "weezl"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
[[package]]
name = "winapi-util"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-targets"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
dependencies = [
"windows_aarch64_gnullvm 0.48.0",
"windows_aarch64_msvc 0.48.0",
"windows_i686_gnu 0.48.0",
"windows_i686_msvc 0.48.0",
"windows_x86_64_gnu 0.48.0",
"windows_x86_64_gnullvm 0.48.0",
"windows_x86_64_msvc 0.48.0",
]
[[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.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[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.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[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.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[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.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[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.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[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.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[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.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "wl-clipboard-rs"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4de22eebb1d1e2bad2d970086e96da0e12cde0b411321e5b0f7b2a1f876aa26f"
dependencies = [
"libc",
"log",
"os_pipe",
"rustix",
"tempfile",
"thiserror",
"tree_magic_mini",
"wayland-backend",
"wayland-client",
"wayland-protocols",
"wayland-protocols-wlr",
]
[[package]]
name = "x11rb"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a"
dependencies = [
"gethostname",
"rustix",
"x11rb-protocol",
]
[[package]]
name = "x11rb-protocol"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34"
arboard-3.6.1/Cargo.toml 0000644 00000010225 00000000001 0010453 0 ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2021"
rust-version = "1.71.0"
name = "arboard"
version = "3.6.1"
build = false
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "Image and text handling for the OS clipboard."
readme = "README.md"
keywords = [
"clipboard",
"image",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/1Password/arboard"
[features]
core-graphics = ["dep:objc2-core-graphics"]
default = ["image-data"]
image = ["dep:image"]
image-data = [
"dep:objc2-core-graphics",
"dep:objc2-core-foundation",
"image",
"windows-sys",
"core-graphics",
]
wayland-data-control = ["wl-clipboard-rs"]
windows-sys = ["windows-sys/Win32_Graphics_Gdi"]
wl-clipboard-rs = ["dep:wl-clipboard-rs"]
[lib]
name = "arboard"
path = "src/lib.rs"
[[example]]
name = "daemonize"
path = "examples/daemonize.rs"
[[example]]
name = "get_image"
path = "examples/get_image.rs"
required-features = ["image-data"]
[[example]]
name = "hello_world"
path = "examples/hello_world.rs"
[[example]]
name = "set_get_html"
path = "examples/set_get_html.rs"
[[example]]
name = "set_image"
path = "examples/set_image.rs"
required-features = ["image-data"]
[dependencies]
[dev-dependencies.env_logger]
version = "0.10.2"
[target.'cfg(all(unix, not(any(target_os="macos", target_os="android", target_os="emscripten"))))'.dependencies.image]
version = "0.25"
features = ["png"]
optional = true
default-features = false
[target.'cfg(all(unix, not(any(target_os="macos", target_os="android", target_os="emscripten"))))'.dependencies.log]
version = "0.4"
[target.'cfg(all(unix, not(any(target_os="macos", target_os="android", target_os="emscripten"))))'.dependencies.parking_lot]
version = "0.12"
[target.'cfg(all(unix, not(any(target_os="macos", target_os="android", target_os="emscripten"))))'.dependencies.percent-encoding]
version = "2.3.1"
[target.'cfg(all(unix, not(any(target_os="macos", target_os="android", target_os="emscripten"))))'.dependencies.wl-clipboard-rs]
version = "0.9.0"
optional = true
[target.'cfg(all(unix, not(any(target_os="macos", target_os="android", target_os="emscripten"))))'.dependencies.x11rb]
version = "0.13"
[target.'cfg(target_os = "macos")'.dependencies.image]
version = "0.25"
features = ["tiff"]
optional = true
default-features = false
[target.'cfg(target_os = "macos")'.dependencies.objc2]
version = "0.6.0"
[target.'cfg(target_os = "macos")'.dependencies.objc2-app-kit]
version = "0.3.0"
features = [
"std",
"objc2-core-graphics",
"NSPasteboard",
"NSPasteboardItem",
"NSImage",
]
default-features = false
[target.'cfg(target_os = "macos")'.dependencies.objc2-core-foundation]
version = "0.3.0"
features = [
"std",
"CFCGTypes",
]
optional = true
default-features = false
[target.'cfg(target_os = "macos")'.dependencies.objc2-core-graphics]
version = "0.3.0"
features = [
"std",
"CGImage",
"CGColorSpace",
"CGDataProvider",
]
optional = true
default-features = false
[target.'cfg(target_os = "macos")'.dependencies.objc2-foundation]
version = "0.3.0"
features = [
"std",
"NSArray",
"NSString",
"NSEnumerator",
"NSGeometry",
"NSValue",
]
default-features = false
[target."cfg(windows)".dependencies.clipboard-win]
version = "5.3.1"
features = ["std"]
[target."cfg(windows)".dependencies.image]
version = "0.25"
features = [
"png",
"bmp",
]
optional = true
default-features = false
[target."cfg(windows)".dependencies.log]
version = "0.4"
[target."cfg(windows)".dependencies.windows-sys]
version = ">=0.52.0, <0.61.0"
features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
"Win32_System_DataExchange",
"Win32_System_Memory",
"Win32_System_Ole",
"Win32_UI_Shell",
]
arboard-3.6.1/Cargo.toml.orig 0000644 0000000 0000000 00000004677 10461020230 0014152 0 ustar 0000000 0000000 [package]
name = "arboard"
version = "3.6.1"
description = "Image and text handling for the OS clipboard."
repository = "https://github.com/1Password/arboard"
license = "MIT OR Apache-2.0"
readme = "README.md"
keywords = ["clipboard", "image"]
edition = "2021"
rust-version = "1.71.0"
[features]
default = ["image-data"]
image-data = [
"dep:objc2-core-graphics",
"dep:objc2-core-foundation",
"image",
"windows-sys",
"core-graphics",
]
wayland-data-control = ["wl-clipboard-rs"]
# For backwards compat
core-graphics = ["dep:objc2-core-graphics"]
windows-sys = ["windows-sys/Win32_Graphics_Gdi"]
image = ["dep:image"]
wl-clipboard-rs = ["dep:wl-clipboard-rs"]
[dependencies]
[dev-dependencies]
env_logger = "0.10.2"
[target.'cfg(windows)'.dependencies]
windows-sys = { version = ">=0.52.0, <0.61.0", features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
"Win32_System_DataExchange",
"Win32_System_Memory",
"Win32_System_Ole",
"Win32_UI_Shell",
] }
clipboard-win = { version = "5.3.1", features = ["std"] }
log = "0.4"
image = { version = "0.25", optional = true, default-features = false, features = [
"png", "bmp"
] }
[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.6.0"
objc2-foundation = { version = "0.3.0", default-features = false, features = [
"std",
"NSArray",
"NSString",
"NSEnumerator",
"NSGeometry",
"NSValue",
] }
objc2-app-kit = { version = "0.3.0", default-features = false, features = [
"std",
"objc2-core-graphics",
"NSPasteboard",
"NSPasteboardItem",
"NSImage",
] }
objc2-core-foundation = { version = "0.3.0", default-features = false, optional = true, features = [
"std",
"CFCGTypes",
] }
objc2-core-graphics = { version = "0.3.0", default-features = false, optional = true, features = [
"std",
"CGImage",
"CGColorSpace",
"CGDataProvider",
] }
image = { version = "0.25", optional = true, default-features = false, features = [
"tiff",
] }
[target.'cfg(all(unix, not(any(target_os="macos", target_os="android", target_os="emscripten"))))'.dependencies]
log = "0.4"
x11rb = { version = "0.13" }
wl-clipboard-rs = { version = "0.9.0", optional = true }
image = { version = "0.25", optional = true, default-features = false, features = [
"png",
] }
parking_lot = "0.12"
percent-encoding = "2.3.1"
[[example]]
name = "get_image"
required-features = ["image-data"]
[[example]]
name = "set_image"
required-features = ["image-data"]
arboard-3.6.1/LICENSE-APACHE.txt 0000644 0000000 0000000 00000023676 10461020230 0014025 0 ustar 0000000 0000000
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
arboard-3.6.1/LICENSE-MIT.txt 0000644 0000000 0000000 00000002071 10461020230 0013517 0 ustar 0000000 0000000 MIT License
Copyright (c) 2022 The Arboard contributors
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.
arboard-3.6.1/README.md 0000644 0000000 0000000 00000014311 10461020230 0012524 0 ustar 0000000 0000000 # Arboard (Arthur's Clipboard)
[](https://crates.io/crates/arboard)
[](https://docs.rs/arboard)

## General
This is a cross-platform library for interacting with the clipboard. It allows
to copy and paste both text and image data in a platform independent way on
Linux, Mac, and Windows.
Please note that this is not an official 1Password product. Feature requests will be considered like any other volunteer-based crate.
## GNU/Linux
### Backend Support
By default, `arboard`'s backend on Linux supports X11 (or XWayland implementations) and uses
that for managing the various Linux clipboard variants. This supports the majority of desktop
environments that exist in the wild today. `arboard` will use the `Clipboard` selection by default,
but the [LinuxClipboardKind](https://docs.rs/arboard/latest/arboard/enum.LinuxClipboardKind.html)
selector lets you operate on the `Primary` or `Secondary` clipboard selections (if supported).
However, Wayland is becoming the majority default as of 2025. Some distributions are
even considering the removal of X by default. To support Wayland correctly, `arboard` users
should enable the `wayland-data-control` feature. If enabled, it will be prioritized over the X clipboard.
Wayland support is not enabled by default because it may be counterintuitive
to some users: it relies on the data-control protocol extension(s), which _are not_
supported by all Wayland compositors. You can check compositor support on `wayland.app`:
- [ext-data-control-v1](https://wayland.app/protocols/ext-data-control-v1)
- [wlr-data-control-unstable-v1](https://wayland.app/protocols/wlr-data-control-unstable-v1)
If you or a user's desktop doesn't support these protocols, `arboard` won't function in a pure
Wayland environment. It is recommended to enable `XWayland` for these cases. If your app runs inside
an isolated sandbox, such as Flatpak or Snap, you'll need to expose the X11 socket to the application
_in addition_ to the Wayland communication interface.
### Clipboard Ownership
Some apps and users may notice that sometimes values copied to a Linux clipboard with this crate vanish
before anyone gets the chance to paste, or just aren't available when you expect them to be. The root behind
these problems is _selection ownership_.
X11 and Wayland put the responsibility for answering paste requests and serving data on the application
which originally copied it onto the clipboard. This usually means the app using `arboard`. Nothing you copy
to the clipboard is sent anywhere to start. It stays inside `arboard` until something else on the system requests it,
which is very different to how the clipboard works on other platforms like macOS or Windows.
Note that `arboard` may attempt to warn you about these conditions when compiled in debug mode, to improve the debugging
experience. Even if you don't see these warnings, you should double check the lifetime of the `Clipboard` in your code.
In some cases, an environment may have a clipboard manager installed. These services monitor the clipboard contents and
do their best to retain a copy when needed to smooth over clipboard ownership changes. A clipboar manager can make contents
available even after a process previously owning it exits.
In order to keep the contents around longer, make sure that you don't `Drop` your `Clipboard` object right away or
terminate the copying process too fast. This is why, at times, adding a call to `sleep()` near the set operation
makes it behave more reliabily: the background thread `arboard` uses for serving clipboard contents has more time to run
and let other apps (including clipboard managers) make requests for the contents. However `sleep` isn't the recommended approach.
If your application is exiting, you must make sure there is a clipboard manager running on the system. If nothing is listening for
the clipboard ownership transfer, or made a copy previously, the data will be lost. Note that this isn't a complete
guarantee as races are possible if your program's main thread is exiting. If you would like to fully synchronize the clipboard "paste"
before exiting, you can use the [wait](https://docs.rs/arboard/latest/arboard/trait.SetExtLinux.html#tymethod.wait) method when setting
contents on the clipboard. This will block the calling thread until another app has requested, and then received, the data.
If your application is longer-running (ie a GUI, TUI, etc), it is highly recommended that you either store the `Clipboard` object in some
long-lived data structure (like app context, etc) or utilize `wait` method mentioned above, and/or threading to make sure another
app can request the clipboard data later.
We welcome suggestions to improve on the above issues in ways that don't degrade other use cases.
## Example
```rust
use arboard::Clipboard;
fn main() {
let mut clipboard = Clipboard::new().unwrap();
println!("Clipboard text was: {}", clipboard.get_text().unwrap());
let the_string = "Hello, world!";
clipboard.set_text(the_string).unwrap();
println!("But now the clipboard text should be: \"{}\"", the_string);
}
```
## Credits
This crate is a combined effort by 1Password staff and `@ArturKovacs`, the crate's past
maintainer.
#### License
Licensed under either of Apache License, Version
2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.
#### History: Yet another clipboard crate
This crate started out as a fork of `rust-clipboard`. The reason for forking is due to the former
crate not being maintained any longer. At this point, `arboard`'s backends and public APIs have diverged
a lot.
`arboard`'s original maintainer noted that "I don't know why this is happening but while it is, we might
as well just start naming the clipboard crates after ourselves. This one is arboard which stands for Artur's clipboard.".
arboard-3.6.1/examples/daemonize.rs 0000644 0000000 0000000 00000002047 10461020230 0015407 0 ustar 0000000 0000000 //! Example showcasing the use of `set_text_wait` and spawning a daemon to allow the clipboard's
//! contents to live longer than the process on Linux.
use arboard::Clipboard;
#[cfg(target_os = "linux")]
use arboard::SetExtLinux;
use std::{env, error::Error, process};
// An argument that can be passed into the program to signal that it should daemonize itself. This
// can be anything as long as it is unlikely to be passed in by the user by mistake.
const DAEMONIZE_ARG: &str = "__internal_daemonize";
fn main() -> Result<(), Box> {
#[cfg(target_os = "linux")]
if env::args().nth(1).as_deref() == Some(DAEMONIZE_ARG) {
Clipboard::new()?.set().wait().text("Hello, world!")?;
return Ok(());
}
env_logger::init();
if cfg!(target_os = "linux") {
process::Command::new(env::current_exe()?)
.arg(DAEMONIZE_ARG)
.stdin(process::Stdio::null())
.stdout(process::Stdio::null())
.stderr(process::Stdio::null())
.current_dir("/")
.spawn()?;
} else {
Clipboard::new()?.set_text("Hello, world!")?;
}
Ok(())
}
arboard-3.6.1/examples/get_image.rs 0000644 0000000 0000000 00000000246 10461020230 0015354 0 ustar 0000000 0000000 use arboard::Clipboard;
fn main() {
let mut ctx = Clipboard::new().unwrap();
let img = ctx.get_image().unwrap();
println!("Image data is:\n{:?}", img.bytes);
}
arboard-3.6.1/examples/hello_world.rs 0000644 0000000 0000000 00000000474 10461020230 0015750 0 ustar 0000000 0000000 use arboard::Clipboard;
fn main() {
env_logger::init();
let mut clipboard = Clipboard::new().unwrap();
println!("Clipboard text was: {:?}", clipboard.get_text());
let the_string = "Hello, world!";
clipboard.set_text(the_string).unwrap();
println!("But now the clipboard text should be: \"{the_string}\"");
}
arboard-3.6.1/examples/set_get_html.rs 0000644 0000000 0000000 00000001053 10461020230 0016106 0 ustar 0000000 0000000 use arboard::Clipboard;
use std::{thread, time::Duration};
fn main() {
env_logger::init();
let mut ctx = Clipboard::new().unwrap();
let html = r#"Hello, World!
Lorem ipsum dolor sit amet,
consectetur adipiscing elit."#;
let alt_text = r#"Hello, World!
Lorem ipsum dolor sit amet,
consectetur adipiscing elit."#;
ctx.set_html(html, Some(alt_text)).unwrap();
thread::sleep(Duration::from_secs(5));
let success = ctx.get().html().unwrap() == html;
println!("Set and Get html operations were successful: {success}");
}
arboard-3.6.1/examples/set_image.rs 0000644 0000000 0000000 00000000512 10461020230 0015364 0 ustar 0000000 0000000 use arboard::{Clipboard, ImageData};
fn main() {
let mut ctx = Clipboard::new().unwrap();
#[rustfmt::skip]
let bytes = [
255, 100, 100, 255,
100, 255, 100, 100,
100, 100, 255, 100,
0, 0, 0, 255,
];
let img_data = ImageData { width: 2, height: 2, bytes: bytes.as_ref().into() };
ctx.set_image(img_data).unwrap();
}
arboard-3.6.1/rustfmt.toml 0000644 0000000 0000000 00000000137 10461020230 0013647 0 ustar 0000000 0000000 hard_tabs=true
use_field_init_shorthand=true
use_small_heuristics="Max"
use_try_shorthand=true
arboard-3.6.1/src/common.rs 0000644 0000000 0000000 00000013726 10461020230 0013703 0 ustar 0000000 0000000 /*
SPDX-License-Identifier: Apache-2.0 OR MIT
Copyright 2022 The Arboard contributors
The project to which this file belongs is licensed under either of
the Apache 2.0 or the MIT license at the licensee's choice. The terms
and conditions of the chosen license apply to this file.
*/
#[cfg(feature = "image-data")]
use std::borrow::Cow;
/// An error that might happen during a clipboard operation.
///
/// Note that both the `Display` and the `Debug` trait is implemented for this type in such a way
/// that they give a short human-readable description of the error; however the documentation
/// gives a more detailed explanation for each error kind.
#[non_exhaustive]
pub enum Error {
/// The clipboard contents were not available in the requested format.
/// This could either be due to the clipboard being empty or the clipboard contents having
/// an incompatible format to the requested one (eg when calling `get_image` on text)
ContentNotAvailable,
/// The selected clipboard is not supported by the current configuration (system and/or environment).
///
/// This can be caused by a few conditions:
/// - Using the Primary clipboard with an older Wayland compositor (that doesn't support version 2)
/// - Using the Secondary clipboard on Wayland
ClipboardNotSupported,
/// The native clipboard is not accessible due to being held by another party.
///
/// This "other party" could be a different process or it could be within
/// the same program. So for example you may get this error when trying
/// to interact with the clipboard from multiple threads at once.
///
/// Note that it's OK to have multiple `Clipboard` instances. The underlying
/// implementation will make sure that the native clipboard is only
/// opened for transferring data and then closed as soon as possible.
ClipboardOccupied,
/// The image or the text that was about the be transferred to/from the clipboard could not be
/// converted to the appropriate format.
ConversionFailure,
/// Any error that doesn't fit the other error types.
///
/// The `description` field is only meant to help the developer and should not be relied on as a
/// means to identify an error case during runtime.
Unknown { description: String },
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::ContentNotAvailable => f.write_str("The clipboard contents were not available in the requested format or the clipboard is empty."),
Error::ClipboardNotSupported => f.write_str("The selected clipboard is not supported with the current system configuration."),
Error::ClipboardOccupied => f.write_str("The native clipboard is not accessible due to being held by another party."),
Error::ConversionFailure => f.write_str("The image or the text that was about the be transferred to/from the clipboard could not be converted to the appropriate format."),
Error::Unknown { description } => f.write_fmt(format_args!("Unknown error while interacting with the clipboard: {description}")),
}
}
}
impl std::error::Error for Error {}
impl std::fmt::Debug for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use Error::*;
macro_rules! kind_to_str {
($( $e: pat ),*) => {
match self {
$(
$e => stringify!($e),
)*
}
}
}
let name = kind_to_str!(
ContentNotAvailable,
ClipboardNotSupported,
ClipboardOccupied,
ConversionFailure,
Unknown { .. }
);
f.write_fmt(format_args!("{name} - \"{self}\""))
}
}
impl Error {
pub(crate) fn unknown>(message: M) -> Self {
Error::Unknown { description: message.into() }
}
}
/// Stores pixel data of an image.
///
/// Each element in `bytes` stores the value of a channel of a single pixel.
/// This struct stores four channels (red, green, blue, alpha) so
/// a `3*3` image is going to be stored on `3*3*4 = 36` bytes of data.
///
/// The pixels are in row-major order meaning that the second pixel
/// in `bytes` (starting at the fifth byte) corresponds to the pixel that's
/// sitting to the right side of the top-left pixel (x=1, y=0)
///
/// Assigning a `2*1` image would for example look like this
/// ```
/// use arboard::ImageData;
/// use std::borrow::Cow;
/// let bytes = [
/// // A red pixel
/// 255, 0, 0, 255,
///
/// // A green pixel
/// 0, 255, 0, 255,
/// ];
/// let img = ImageData {
/// width: 2,
/// height: 1,
/// bytes: Cow::from(bytes.as_ref())
/// };
/// ```
#[cfg(feature = "image-data")]
#[derive(Debug, Clone)]
pub struct ImageData<'a> {
pub width: usize,
pub height: usize,
pub bytes: Cow<'a, [u8]>,
}
#[cfg(feature = "image-data")]
impl ImageData<'_> {
/// Returns a the bytes field in a way that it's guaranteed to be owned.
/// It moves the bytes if they are already owned and clones them if they are borrowed.
pub fn into_owned_bytes(self) -> Cow<'static, [u8]> {
self.bytes.into_owned().into()
}
/// Returns an image data that is guaranteed to own its bytes.
/// It moves the bytes if they are already owned and clones them if they are borrowed.
pub fn to_owned_img(&self) -> ImageData<'static> {
ImageData {
width: self.width,
height: self.height,
bytes: self.bytes.clone().into_owned().into(),
}
}
}
#[cfg(any(windows, all(unix, not(target_os = "macos"))))]
pub(crate) struct ScopeGuard {
callback: Option,
}
#[cfg(any(windows, all(unix, not(target_os = "macos"))))]
impl ScopeGuard {
#[cfg_attr(all(windows, not(feature = "image-data")), allow(dead_code))]
pub(crate) fn new(callback: F) -> Self {
ScopeGuard { callback: Some(callback) }
}
}
#[cfg(any(windows, all(unix, not(target_os = "macos"))))]
impl Drop for ScopeGuard {
fn drop(&mut self) {
if let Some(callback) = self.callback.take() {
(callback)();
}
}
}
/// Common trait for sealing platform extension traits.
pub(crate) mod private {
pub trait Sealed {}
impl Sealed for crate::Get<'_> {}
impl Sealed for crate::Set<'_> {}
impl Sealed for crate::Clear<'_> {}
}
arboard-3.6.1/src/lib.rs 0000644 0000000 0000000 00000037253 10461020230 0013162 0 ustar 0000000 0000000 /*
SPDX-License-Identifier: Apache-2.0 OR MIT
Copyright 2022 The Arboard contributors
The project to which this file belongs is licensed under either of
the Apache 2.0 or the MIT license at the licensee's choice. The terms
and conditions of the chosen license apply to this file.
*/
#![warn(unreachable_pub)]
mod common;
use std::{
borrow::Cow,
path::{Path, PathBuf},
};
pub use common::Error;
#[cfg(feature = "image-data")]
pub use common::ImageData;
mod platform;
#[cfg(all(
unix,
not(any(target_os = "macos", target_os = "android", target_os = "emscripten")),
))]
pub use platform::{ClearExtLinux, GetExtLinux, LinuxClipboardKind, SetExtLinux};
#[cfg(windows)]
pub use platform::SetExtWindows;
#[cfg(target_os = "macos")]
pub use platform::SetExtApple;
/// The OS independent struct for accessing the clipboard.
///
/// Any number of `Clipboard` instances are allowed to exist at a single point in time. Note however
/// that all `Clipboard`s must be 'dropped' before the program exits. In most scenarios this happens
/// automatically but there are frameworks (for example, `winit`) that take over the execution
/// and where the objects don't get dropped when the application exits. In these cases you have to
/// make sure the object is dropped by taking ownership of it in a confined scope when detecting
/// that your application is about to quit.
///
/// It is also valid to have these multiple `Clipboards` on separate threads at once but note that
/// executing multiple clipboard operations in parallel might fail with a `ClipboardOccupied` error.
///
/// # Platform-specific behavior
///
/// `arboard` does its best to abstract over different platforms, but sometimes the platform-specific
/// behavior leaks through unsolvably. These differences, depending on which platforms are being targeted,
/// may affect your app's clipboard architecture (ex, opening and closing a [`Clipboard`] every time
/// or keeping one open in some application/global state).
///
/// ## Linux
///
/// Using either Wayland and X11, the clipboard and its content is "hosted" inside of the application
/// that last put data onto it. This means that when the last `Clipboard` instance is dropped, the contents
/// may become unavailable to other apps. See [SetExtLinux] for more details.
///
/// ## Windows
///
/// The clipboard on Windows is a global object, which may only be opened on one thread at once.
/// This means that `arboard` only truly opens the clipboard during each operation to prevent
/// multiple `Clipboard`s from existing at once.
///
/// This means that attempting operations in parallel has a high likelihood to return an error or
/// deadlock. As such, it is recommended to avoid creating/operating clipboard objects on >1 thread.
#[allow(rustdoc::broken_intra_doc_links)]
pub struct Clipboard {
pub(crate) platform: platform::Clipboard,
}
impl Clipboard {
/// Creates an instance of the clipboard.
///
/// # Errors
///
/// On some platforms or desktop environments, an error can be returned if clipboards are not
/// supported. This may be retried.
pub fn new() -> Result {
Ok(Clipboard { platform: platform::Clipboard::new()? })
}
/// Fetches UTF-8 text from the clipboard and returns it.
///
/// # Errors
///
/// Returns error if clipboard is empty or contents are not UTF-8 text.
pub fn get_text(&mut self) -> Result {
self.get().text()
}
/// Places the text onto the clipboard. Any valid UTF-8 string is accepted.
///
/// # Errors
///
/// Returns error if `text` failed to be stored on the clipboard.
pub fn set_text<'a, T: Into>>(&mut self, text: T) -> Result<(), Error> {
self.set().text(text)
}
/// Places the HTML as well as a plain-text alternative onto the clipboard.
///
/// Any valid UTF-8 string is accepted.
///
/// # Errors
///
/// Returns error if both `html` and `alt_text` failed to be stored on the clipboard.
pub fn set_html<'a, T: Into>>(
&mut self,
html: T,
alt_text: Option,
) -> Result<(), Error> {
self.set().html(html, alt_text)
}
/// Fetches image data from the clipboard, and returns the decoded pixels.
///
/// Any image data placed on the clipboard with `set_image` will be possible read back, using
/// this function. However it's of not guaranteed that an image placed on the clipboard by any
/// other application will be of a supported format.
///
/// # Errors
///
/// Returns error if clipboard is empty, contents are not an image, or the contents cannot be
/// converted to an appropriate format and stored in the [`ImageData`] type.
#[cfg(feature = "image-data")]
pub fn get_image(&mut self) -> Result, Error> {
self.get().image()
}
/// Places an image to the clipboard.
///
/// The chosen output format, depending on the platform is the following:
///
/// - On macOS: `NSImage` object
/// - On Linux: PNG, under the atom `image/png`
/// - On Windows: In order of priority `CF_DIB` and `CF_BITMAP`
///
/// # Errors
///
/// Returns error if `image` cannot be converted to an appropriate format or if it failed to be
/// stored on the clipboard.
#[cfg(feature = "image-data")]
pub fn set_image(&mut self, image: ImageData) -> Result<(), Error> {
self.set().image(image)
}
/// Clears any contents that may be present from the platform's default clipboard,
/// regardless of the format of the data.
///
/// # Errors
///
/// Returns error on Windows or Linux if clipboard cannot be cleared.
pub fn clear(&mut self) -> Result<(), Error> {
self.clear_with().default()
}
/// Begins a "clear" option to remove data from the clipboard.
pub fn clear_with(&mut self) -> Clear<'_> {
Clear { platform: platform::Clear::new(&mut self.platform) }
}
/// Begins a "get" operation to retrieve data from the clipboard.
pub fn get(&mut self) -> Get<'_> {
Get { platform: platform::Get::new(&mut self.platform) }
}
/// Begins a "set" operation to set the clipboard's contents.
pub fn set(&mut self) -> Set<'_> {
Set { platform: platform::Set::new(&mut self.platform) }
}
}
/// A builder for an operation that gets a value from the clipboard.
#[must_use]
pub struct Get<'clipboard> {
pub(crate) platform: platform::Get<'clipboard>,
}
impl Get<'_> {
/// Completes the "get" operation by fetching UTF-8 text from the clipboard.
pub fn text(self) -> Result {
self.platform.text()
}
/// Completes the "get" operation by fetching image data from the clipboard and returning the
/// decoded pixels.
///
/// Any image data placed on the clipboard with `set_image` will be possible read back, using
/// this function. However it's of not guaranteed that an image placed on the clipboard by any
/// other application will be of a supported format.
#[cfg(feature = "image-data")]
pub fn image(self) -> Result, Error> {
self.platform.image()
}
/// Completes the "get" operation by fetching HTML from the clipboard.
pub fn html(self) -> Result {
self.platform.html()
}
/// Completes the "get" operation by fetching a list of file paths from the clipboard.
pub fn file_list(self) -> Result, Error> {
self.platform.file_list()
}
}
/// A builder for an operation that sets a value to the clipboard.
#[must_use]
pub struct Set<'clipboard> {
pub(crate) platform: platform::Set<'clipboard>,
}
impl Set<'_> {
/// Completes the "set" operation by placing text onto the clipboard. Any valid UTF-8 string
/// is accepted.
pub fn text<'a, T: Into>>(self, text: T) -> Result<(), Error> {
let text = text.into();
self.platform.text(text)
}
/// Completes the "set" operation by placing HTML as well as a plain-text alternative onto the
/// clipboard.
///
/// Any valid UTF-8 string is accepted.
pub fn html<'a, T: Into>>(
self,
html: T,
alt_text: Option,
) -> Result<(), Error> {
let html = html.into();
let alt_text = alt_text.map(|e| e.into());
self.platform.html(html, alt_text)
}
/// Completes the "set" operation by placing an image onto the clipboard.
///
/// The chosen output format, depending on the platform is the following:
///
/// - On macOS: `NSImage` object
/// - On Linux: PNG, under the atom `image/png`
/// - On Windows: In order of priority `CF_DIB` and `CF_BITMAP`
#[cfg(feature = "image-data")]
pub fn image(self, image: ImageData) -> Result<(), Error> {
self.platform.image(image)
}
/// Completes the "set" operation by placing a list of file paths onto the clipboard.
pub fn file_list(self, file_list: &[impl AsRef]) -> Result<(), Error> {
self.platform.file_list(file_list)
}
}
/// A builder for an operation that clears the data from the clipboard.
#[must_use]
pub struct Clear<'clipboard> {
pub(crate) platform: platform::Clear<'clipboard>,
}
impl Clear<'_> {
/// Completes the "clear" operation by deleting any existing clipboard data,
/// regardless of the format.
pub fn default(self) -> Result<(), Error> {
self.platform.clear()
}
}
/// All tests grouped in one because the windows clipboard cannot be open on
/// multiple threads at once.
#[cfg(test)]
mod tests {
use super::*;
use std::{sync::Arc, thread, time::Duration};
#[test]
fn all_tests() {
let _ = env_logger::builder().is_test(true).try_init();
{
let mut ctx = Clipboard::new().unwrap();
let text = "some string";
ctx.set_text(text).unwrap();
assert_eq!(ctx.get_text().unwrap(), text);
// We also need to check that the content persists after the drop; this is
// especially important on X11
drop(ctx);
// Give any external mechanism a generous amount of time to take over
// responsibility for the clipboard, in case that happens asynchronously
// (it appears that this is the case on X11 plus Mutter 3.34+, see #4)
thread::sleep(Duration::from_millis(300));
let mut ctx = Clipboard::new().unwrap();
assert_eq!(ctx.get_text().unwrap(), text);
}
{
let mut ctx = Clipboard::new().unwrap();
let text = "Some utf8: 🤓 ∑φ(n)<ε 🐔";
ctx.set_text(text).unwrap();
assert_eq!(ctx.get_text().unwrap(), text);
}
{
let mut ctx = Clipboard::new().unwrap();
let text = "hello world";
ctx.set_text(text).unwrap();
assert_eq!(ctx.get_text().unwrap(), text);
ctx.clear().unwrap();
match ctx.get_text() {
Ok(text) => assert!(text.is_empty()),
Err(Error::ContentNotAvailable) => {}
Err(e) => panic!("unexpected error: {e}"),
};
// confirm it is OK to clear when already empty.
ctx.clear().unwrap();
}
{
let mut ctx = Clipboard::new().unwrap();
let html = "hello world!";
ctx.set_html(html, None).unwrap();
match ctx.get_text() {
Ok(text) => assert!(text.is_empty()),
Err(Error::ContentNotAvailable) => {}
Err(e) => panic!("unexpected error: {e}"),
};
}
{
let mut ctx = Clipboard::new().unwrap();
let html = "hello world!";
let alt_text = "hello world!";
ctx.set_html(html, Some(alt_text)).unwrap();
assert_eq!(ctx.get_text().unwrap(), alt_text);
}
{
let mut ctx = Clipboard::new().unwrap();
let html = "hello world!";
ctx.set().html(html, None).unwrap();
if cfg!(target_os = "macos") {
// Copying HTML on macOS adds wrapper content to work around
// historical platform bugs. We control this wrapper, so we are
// able to check that the full user data still appears and at what
// position in the final copy contents.
let content = ctx.get().html().unwrap();
assert!(content.ends_with(&format!("{html}