Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ jobs:
artifact_name: target/aarch64-apple-darwin/release/richclip
archive_type: tar.gz

## Windows builds
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: target/x86_64-pc-windows-msvc/release/richclip.exe
archive_type: zip
- os: windows-latest
target: aarch64-pc-windows-msvc
artifact_name: target/aarch64-pc-windows-msvc/release/richclip.exe
archive_type: zip

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -45,13 +55,21 @@ jobs:
strip: true

- name: Archive Release
if: runner.os != 'Windows'
uses: TheDoctor0/zip-release@0.7.6
with:
type: ${{ matrix.archive_type }}
directory: target/${{ matrix.target }}/release
path: richclip
filename: richclip_${{ github.ref_name }}_${{ matrix.target }}.${{ matrix.archive_type }}

- name: Archive Windows Release
if: runner.os == 'Windows'
shell: pwsh
run: |
$archive = "target/${{ matrix.target }}/release/richclip_${{ github.ref_name }}_${{ matrix.target }}.zip"
Compress-Archive -Path "${{ matrix.artifact_name }}" -DestinationPath $archive

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
## macOS builds
- os: macos-latest

## Windows builds
- os: windows-latest

steps:
- uses: actions/checkout@v4
- name: Install Linux test dependencies
Expand All @@ -33,6 +36,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y xvfb xclip
- name: Setup Bats and bats libs
if: runner.os != 'Windows'
id: setup-bats
uses: bats-core/bats-action@3.0.1
- name: Build
Expand All @@ -58,3 +62,15 @@ jobs:
env:
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
TERM: xterm

- name: Run integration tests on Windows
if: runner.os == 'Windows'
run: test/windows/windows.ps1
shell: pwsh

- name: Check Windows ARM64 build
if: runner.os == 'Windows'
run: |
rustup target add aarch64-pc-windows-msvc
cargo build --locked --target aarch64-pc-windows-msvc
shell: pwsh
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Next Release

- Add Windows x86-64 and ARM64 support.

v0.3.0

- Add Mac support.
Expand Down
17 changes: 16 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ build = "build.rs"
[dependencies]
anyhow = "1.0.98"
clap = { version = "4.5.38", features = ["derive"] }
daemonize = "0.5.0"
log = "0.4.27"
libc = "0.2.172"
simplelog = "0.12.2"
objc = "0.2.7"

[target.'cfg(target_os = "linux")'.dependencies]
daemonize = "0.5.0"
wayrs-client = { version = "1.3.1" }
wayrs-protocols = { version = "0.14.9", features = ["wlr-data-control-unstable-v1"] }
x11rb = { version = "0.13.1", features = [] }
nix = "0.29.0"

[target.'cfg(target_os = "macos")'.dependencies]
x11rb = { version = "0.13.1", features = [] }
cocoa = { version = "0.26.0" }
objc = "0.2.7"

[target.'cfg(target_os = "windows")'.dependencies]
clipboard-win = { version = "5.4.1", features = ["std"] }

[build-dependencies]
vergen-git2 = { version = "9.1.0", features = ["build", "cargo"] }
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ command line utility as an alternative to [xclip](https://github.com/astrand/xcl
[xsel](https://github.com/astrand/xclip), [wl-clipboard](https://github.com/bugaevc/wl-clipboard)
or other command line clipboard tools.

- Supports Multiple environments. Xorg, Wayland and macOS are supported by the current
version. Windows is planned.
- Supports multiple environments. Xorg, Wayland, macOS, and Windows are supported.
- Recognizes the environment automatically, and choose the right clipboard to
use.
- Supports multiple content with different mime-types simultaneously. A typical
Expand All @@ -22,13 +21,14 @@ or other command line clipboard tools.

Install `richclip` from the [AUR](https://aur.archlinux.org/packages/richclip).

### macOS & Other Linux Distributions
### macOS, Windows & Other Linux Distributions

Download the static linked binary from the [release page](https://github.com/beeender/richclip/releases).

### Windows

Not supported yet
Release archives are provided for x86-64 and ARM64 Windows. Extract `richclip.exe`
and place it in a directory included in `PATH`.

## Usage

Expand Down
14 changes: 14 additions & 0 deletions src/clipboard/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#[cfg(target_os = "macos")]
mod mac;
#[cfg(any(target_os = "linux", target_os = "windows"))]
mod mime_type;
#[cfg(target_os = "linux")]
mod wayland;
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "linux")]
mod x;

use super::protocol::SourceData;
Expand All @@ -19,20 +23,25 @@ pub trait ClipBackend {
pub struct PasteConfig {
// Only list mime-types
pub list_types_only: bool,
#[cfg(target_os = "linux")]
pub use_primary: bool,
pub expected_mime_type: String,
pub writer: Box<dyn Write>,
}

pub struct CopyConfig {
#[cfg(target_os = "linux")]
pub use_primary: bool,
pub source_data: Box<dyn SourceData>,
// For testing X INCR mode
#[cfg(target_os = "linux")]
pub x_chunk_size: usize,
}

#[cfg(target_os = "macos")]
use mac::MacBackend;
#[cfg(target_os = "windows")]
use windows::WindowsBackend;

#[cfg(target_os = "linux")]
pub use wayland::WaylandBackend;
Expand Down Expand Up @@ -68,3 +77,8 @@ pub fn create_backend() -> Result<Box<dyn ClipBackend>> {

Ok(Box::new(MacBackend {}))
}

#[cfg(target_os = "windows")]
pub fn create_backend() -> Result<Box<dyn ClipBackend>> {
Ok(Box::new(WindowsBackend {}))
}
Loading
Loading