mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-02 02:21:28 +03:00
Compare commits
7 Commits
windows-ms
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e1b5278ce | ||
|
|
4d8f7d7813 | ||
|
|
0ef8edb7b2 | ||
|
|
3eba50a0d3 | ||
|
|
9540739d89 | ||
|
|
810e25a7fc | ||
|
|
9af5f9452e |
24
.editorconfig
Normal file
24
.editorconfig
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
charset = utf-8
|
||||||
|
|
||||||
|
[*.rs]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
max_line_length = 100
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.toml]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.nix]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
34
.githooks/pre-commit
Executable file
34
.githooks/pre-commit
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Ensure we're at the repo root
|
||||||
|
cd "$(git rev-parse --show-toplevel)" || exit 1
|
||||||
|
|
||||||
|
echo "Running cargo fmt (auto-format)..."
|
||||||
|
# Run formatter to apply fixes but do not stage them. If formatting changed,
|
||||||
|
# fail the commit so the user can review and stage the changes manually.
|
||||||
|
cargo fmt --all
|
||||||
|
if ! git diff --quiet --exit-code; then
|
||||||
|
echo "" >&2
|
||||||
|
echo "ERROR: cargo fmt modified files. Review changes, stage them, and commit again." >&2
|
||||||
|
git --no-pager diff --name-only
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running cargo clippy..."
|
||||||
|
# Matches CI: deny warnings to keep code health strict
|
||||||
|
if ! cargo clippy --workspace --all-targets --all-features -- -D warnings; then
|
||||||
|
echo "" >&2
|
||||||
|
echo "ERROR: clippy found warnings/errors. Fix them before committing." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running cargo test..."
|
||||||
|
if ! cargo test --workspace --all-features; then
|
||||||
|
echo "" >&2
|
||||||
|
echo "ERROR: Some tests failed. Fix tests before committing." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "All pre-commit checks passed."
|
||||||
|
exit 0
|
||||||
6
.github/workflows/cachix.yml
vendored
6
.github/workflows/cachix.yml
vendored
@@ -7,6 +7,10 @@ on:
|
|||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
nix:
|
nix:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -19,7 +23,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
name: "pre-release"
|
name: "Release"
|
||||||
|
run-name: "Release - ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || github.event.inputs.name || github.ref_name }}"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
tags:
|
||||||
|
- v**
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
name:
|
||||||
|
description: 'Development release name'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
@@ -13,19 +20,40 @@ jobs:
|
|||||||
linux-release-build:
|
linux-release-build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: install dependencies
|
- name: install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install libx11-dev libxtst-dev
|
sudo apt-get install libx11-dev libxtst-dev
|
||||||
sudo apt-get install libadwaita-1-dev libgtk-4-dev
|
sudo apt-get install libadwaita-1-dev libgtk-4-dev
|
||||||
- name: Release Build
|
- name: Release Build
|
||||||
run: cargo build --release
|
run: |
|
||||||
|
cargo build --release
|
||||||
|
cp target/release/lan-mouse lan-mouse-linux-x86_64
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: lan-mouse-linux
|
name: lan-mouse-linux-x86_64
|
||||||
path: target/release/lan-mouse
|
path: lan-mouse-linux-x86_64
|
||||||
|
|
||||||
|
linux-arm64-release-build:
|
||||||
|
runs-on: ubuntu-22.04-arm
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- name: install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install libx11-dev libxtst-dev
|
||||||
|
sudo apt-get install libadwaita-1-dev libgtk-4-dev
|
||||||
|
- name: Release Build
|
||||||
|
run: |
|
||||||
|
cargo build --release
|
||||||
|
cp target/release/lan-mouse lan-mouse-linux-arm64
|
||||||
|
- name: Upload build artifact
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: lan-mouse-linux-arm64
|
||||||
|
path: lan-mouse-linux-arm64
|
||||||
|
|
||||||
windows-release-build:
|
windows-release-build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
@@ -64,7 +92,7 @@ jobs:
|
|||||||
gvsbuild build --msys-dir=C:\msys64 gtk4 libadwaita librsvg
|
gvsbuild build --msys-dir=C:\msys64 gtk4 libadwaita librsvg
|
||||||
Move-Item "C:\Program Files\Git\usr\notbin" "C:\Program Files\Git\usr\bin"
|
Move-Item "C:\Program Files\Git\usr\notbin" "C:\Program Files\Git\usr\bin"
|
||||||
Move-Item "C:\Program Files\Git\notbin" "C:\Program Files\Git\bin"
|
Move-Item "C:\Program Files\Git\notbin" "C:\Program Files\Git\bin"
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: Release Build
|
- name: Release Build
|
||||||
run: cargo build --release
|
run: cargo build --release
|
||||||
- name: Create Archive
|
- name: Create Archive
|
||||||
@@ -72,19 +100,21 @@ jobs:
|
|||||||
mkdir "lan-mouse-windows"
|
mkdir "lan-mouse-windows"
|
||||||
Get-Childitem -Path "C:\\gtk-build\\gtk\\x64\\release\\bin\\*.dll" -File -Recurse | Copy-Item -Destination "lan-mouse-windows"
|
Get-Childitem -Path "C:\\gtk-build\\gtk\\x64\\release\\bin\\*.dll" -File -Recurse | Copy-Item -Destination "lan-mouse-windows"
|
||||||
Copy-Item -Path "target\release\lan-mouse.exe" -Destination "lan-mouse-windows"
|
Copy-Item -Path "target\release\lan-mouse.exe" -Destination "lan-mouse-windows"
|
||||||
Compress-Archive -Path "lan-mouse-windows\*" -DestinationPath lan-mouse-windows.zip
|
Compress-Archive -Path "lan-mouse-windows\*" -DestinationPath lan-mouse-windows-x86_64.zip
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: lan-mouse-windows
|
name: lan-mouse-windows-x86_64
|
||||||
path: lan-mouse-windows.zip
|
path: lan-mouse-windows-x86_64.zip
|
||||||
|
|
||||||
macos-release-build:
|
macos-release-build:
|
||||||
runs-on: macos-15-intel
|
runs-on: macos-15-intel
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: install dependencies
|
- name: install dependencies
|
||||||
run: brew install gtk4 libadwaita imagemagick
|
run: |
|
||||||
|
brew install --cask inkscape
|
||||||
|
brew install gtk4 libadwaita imagemagick librsvg
|
||||||
- name: Release Build
|
- name: Release Build
|
||||||
run: |
|
run: |
|
||||||
cargo build --release
|
cargo build --release
|
||||||
@@ -102,21 +132,23 @@ jobs:
|
|||||||
cd target/release/bundle/osx
|
cd target/release/bundle/osx
|
||||||
zip -r "lan-mouse-macos-intel.zip" "Lan Mouse.app"
|
zip -r "lan-mouse-macos-intel.zip" "Lan Mouse.app"
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: lan-mouse-macos-intel
|
name: lan-mouse-macos-intel
|
||||||
path: target/release/bundle/osx/lan-mouse-macos-intel.zip
|
path: target/release/bundle/osx/lan-mouse-macos-intel.zip
|
||||||
|
|
||||||
macos-aarch64-release-build:
|
macos-arm64-release-build:
|
||||||
runs-on: macos-14
|
runs-on: macos-15
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: install dependencies
|
- name: install dependencies
|
||||||
run: brew install gtk4 libadwaita imagemagick
|
run: |
|
||||||
|
brew install --cask inkscape
|
||||||
|
brew install gtk4 libadwaita imagemagick librsvg
|
||||||
- name: Release Build
|
- name: Release Build
|
||||||
run: |
|
run: |
|
||||||
cargo build --release
|
cargo build --release
|
||||||
cp target/release/lan-mouse lan-mouse-macos-aarch64
|
cp target/release/lan-mouse lan-mouse-macos-arm64
|
||||||
- name: Make icns
|
- name: Make icns
|
||||||
run: scripts/makeicns.sh
|
run: scripts/makeicns.sh
|
||||||
- name: Install cargo bundle
|
- name: Install cargo bundle
|
||||||
@@ -128,29 +160,45 @@ jobs:
|
|||||||
- name: Zip bundle
|
- name: Zip bundle
|
||||||
run: |
|
run: |
|
||||||
cd target/release/bundle/osx
|
cd target/release/bundle/osx
|
||||||
zip -r "lan-mouse-macos-aarch64.zip" "Lan Mouse.app"
|
zip -r "lan-mouse-macos-arm64.zip" "Lan Mouse.app"
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: lan-mouse-macos-aarch64
|
name: lan-mouse-macos-arm64
|
||||||
path: target/release/bundle/osx/lan-mouse-macos-aarch64.zip
|
path: target/release/bundle/osx/lan-mouse-macos-arm64.zip
|
||||||
|
|
||||||
pre-release:
|
release:
|
||||||
name: "Pre Release"
|
name: "Release"
|
||||||
needs: [windows-release-build, linux-release-build, macos-release-build, macos-aarch64-release-build]
|
needs: [windows-release-build, linux-release-build, linux-arm64-release-build, macos-release-build, macos-arm64-release-build]
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
steps:
|
steps:
|
||||||
- name: Download build artifacts
|
- name: Download build artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
- name: Create Release
|
- name: Create Pre-Release
|
||||||
uses: "marvinpinto/action-automatic-releases@latest"
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
automatic_release_tag: "latest"
|
tag_name: ${{ github.event.inputs.name || github.ref_name }}
|
||||||
|
name: ${{ github.event.inputs.name || github.ref_name }}
|
||||||
prerelease: true
|
prerelease: true
|
||||||
title: "Development Build"
|
generate_release_notes: true
|
||||||
files: |
|
files: |
|
||||||
lan-mouse-linux/lan-mouse
|
lan-mouse-linux-x86_64/lan-mouse-linux-x86_64
|
||||||
|
lan-mouse-linux-arm64/lan-mouse-linux-arm64
|
||||||
lan-mouse-macos-intel/lan-mouse-macos-intel.zip
|
lan-mouse-macos-intel/lan-mouse-macos-intel.zip
|
||||||
lan-mouse-macos-aarch64/lan-mouse-macos-aarch64.zip
|
lan-mouse-macos-arm64/lan-mouse-macos-arm64.zip
|
||||||
lan-mouse-windows/lan-mouse-windows.zip
|
lan-mouse-windows-x86_64/lan-mouse-windows-x86_64.zip
|
||||||
|
- name: Create Tagged Release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
name: ${{ github.ref_name }}
|
||||||
|
generate_release_notes: true
|
||||||
|
files: |
|
||||||
|
lan-mouse-linux-x86_64/lan-mouse-linux-x86_64
|
||||||
|
lan-mouse-linux-arm64/lan-mouse-linux-arm64
|
||||||
|
lan-mouse-macos-intel/lan-mouse-macos-intel.zip
|
||||||
|
lan-mouse-macos-arm64/lan-mouse-macos-arm64.zip
|
||||||
|
lan-mouse-windows-x86_64/lan-mouse-windows-x86_64.zip
|
||||||
8
.github/workflows/rust.yml
vendored
8
.github/workflows/rust.yml
vendored
@@ -9,12 +9,16 @@ on:
|
|||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
fmt:
|
fmt:
|
||||||
name: Formatting
|
name: Formatting
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: cargo fmt
|
- name: cargo fmt
|
||||||
run: cargo fmt --check
|
run: cargo fmt --check
|
||||||
|
|
||||||
@@ -35,7 +39,7 @@ jobs:
|
|||||||
- clippy
|
- clippy
|
||||||
- test
|
- test
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- name: Install Linux deps
|
- name: Install Linux deps
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
|
|||||||
150
.github/workflows/tagged-release.yml
vendored
150
.github/workflows/tagged-release.yml
vendored
@@ -1,150 +0,0 @@
|
|||||||
name: "Tagged Release"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- v**
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
linux-release-build:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: install dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install libx11-dev libxtst-dev
|
|
||||||
sudo apt-get install libadwaita-1-dev libgtk-4-dev
|
|
||||||
- name: Release Build
|
|
||||||
run: cargo build --release
|
|
||||||
- name: Upload build artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: lan-mouse-linux
|
|
||||||
path: target/release/lan-mouse
|
|
||||||
|
|
||||||
windows-release-build:
|
|
||||||
runs-on: windows-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
# needed for cache restore
|
|
||||||
- name: create gtk dir
|
|
||||||
run: mkdir C:\gtk-build\gtk\x64\release
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
id: cache
|
|
||||||
with:
|
|
||||||
path: c:/gtk-build/gtk/x64/release/**
|
|
||||||
key: gtk-windows-build
|
|
||||||
restore-keys: gtk-windows-build
|
|
||||||
- name: Update path
|
|
||||||
run: |
|
|
||||||
echo "PKG_CONFIG=C:\gtk-build\gtk\x64\release\bin\pkgconf.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
||||||
echo "C:\pkg-config-lite-0.28-1\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
||||||
echo "C:\gtk-build\gtk\x64\release\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
||||||
echo $env:GITHUB_PATH
|
|
||||||
echo $env:PATH
|
|
||||||
- name: Install dependencies
|
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
# choco install msys2
|
|
||||||
# choco install visualstudio2022-workload-vctools
|
|
||||||
# choco install pkgconfiglite
|
|
||||||
py -m venv .venv
|
|
||||||
.venv\Scripts\activate.ps1
|
|
||||||
py -m pip install gvsbuild
|
|
||||||
# see https://github.com/wingtk/gvsbuild/pull/1004
|
|
||||||
Move-Item "C:\Program Files\Git\usr\bin" "C:\Program Files\Git\usr\notbin"
|
|
||||||
Move-Item "C:\Program Files\Git\bin" "C:\Program Files\Git\notbin"
|
|
||||||
gvsbuild build --msys-dir=C:\msys64 gtk4 libadwaita librsvg
|
|
||||||
Move-Item "C:\Program Files\Git\usr\notbin" "C:\Program Files\Git\usr\bin"
|
|
||||||
Move-Item "C:\Program Files\Git\notbin" "C:\Program Files\Git\bin"
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Release Build
|
|
||||||
run: cargo build --release
|
|
||||||
- name: Create Archive
|
|
||||||
run: |
|
|
||||||
mkdir "lan-mouse-windows"
|
|
||||||
Get-Childitem -Path "C:\\gtk-build\\gtk\\x64\\release\\bin\\*.dll" -File -Recurse | Copy-Item -Destination "lan-mouse-windows"
|
|
||||||
Copy-Item -Path "target\release\lan-mouse.exe" -Destination "lan-mouse-windows"
|
|
||||||
Compress-Archive -Path "lan-mouse-windows\*" -DestinationPath lan-mouse-windows.zip
|
|
||||||
- name: Upload build artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: lan-mouse-windows
|
|
||||||
path: lan-mouse-windows.zip
|
|
||||||
|
|
||||||
macos-release-build:
|
|
||||||
runs-on: macos-15-intel
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: install dependencies
|
|
||||||
run: brew install gtk4 libadwaita imagemagick
|
|
||||||
- name: Release Build
|
|
||||||
run: |
|
|
||||||
cargo build --release
|
|
||||||
cp target/release/lan-mouse lan-mouse-macos-intel
|
|
||||||
- name: Make icns
|
|
||||||
run: scripts/makeicns.sh
|
|
||||||
- name: Install cargo bundle
|
|
||||||
run: cargo install cargo-bundle
|
|
||||||
- name: Bundle
|
|
||||||
run: |
|
|
||||||
cargo bundle --release
|
|
||||||
scripts/copy-macos-dylib.sh "target/release/bundle/osx/Lan Mouse.app/Contents/MacOS/lan-mouse"
|
|
||||||
- name: Zip bundle
|
|
||||||
run: |
|
|
||||||
cd target/release/bundle/osx
|
|
||||||
zip -r "lan-mouse-macos-intel.zip" "Lan Mouse.app"
|
|
||||||
- name: Upload build artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: lan-mouse-macos-intel.zip
|
|
||||||
path: target/release/bundle/osx/lan-mouse-macos-intel.zip
|
|
||||||
|
|
||||||
macos-aarch64-release-build:
|
|
||||||
runs-on: macos-14
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: install dependencies
|
|
||||||
run: brew install gtk4 libadwaita imagemagick
|
|
||||||
- name: Release Build
|
|
||||||
run: |
|
|
||||||
cargo build --release
|
|
||||||
cp target/release/lan-mouse lan-mouse-macos-aarch64
|
|
||||||
- name: Make icns
|
|
||||||
run: scripts/makeicns.sh
|
|
||||||
- name: Install cargo bundle
|
|
||||||
run: cargo install cargo-bundle
|
|
||||||
- name: Bundle
|
|
||||||
run: |
|
|
||||||
cargo bundle --release
|
|
||||||
scripts/copy-macos-dylib.sh "target/release/bundle/osx/Lan Mouse.app/Contents/MacOS/lan-mouse"
|
|
||||||
- name: Zip bundle
|
|
||||||
run: |
|
|
||||||
cd target/release/bundle/osx
|
|
||||||
zip -r "lan-mouse-macos-aarch64.zip" "Lan Mouse.app"
|
|
||||||
- name: Upload build artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: lan-mouse-macos-aarch64.zip
|
|
||||||
path: target/release/bundle/osx/lan-mouse-macos-aarch64.zip
|
|
||||||
|
|
||||||
tagged-release:
|
|
||||||
name: "Tagged Release"
|
|
||||||
needs: [windows-release-build, linux-release-build, macos-release-build, macos-aarch64-release-build]
|
|
||||||
runs-on: "ubuntu-latest"
|
|
||||||
steps:
|
|
||||||
- name: Download build artifacts
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
- name: Create Release
|
|
||||||
uses: "marvinpinto/action-automatic-releases@latest"
|
|
||||||
with:
|
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
prerelease: false
|
|
||||||
files: |
|
|
||||||
lan-mouse-linux/lan-mouse
|
|
||||||
lan-mouse-macos-intel/lan-mouse-macos-intel.zip
|
|
||||||
lan-mouse-macos-aarch64/lan-mouse-macos-aarch64.zip
|
|
||||||
lan-mouse-windows/lan-mouse-windows.zip
|
|
||||||
65
AGENTS.md
Normal file
65
AGENTS.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# Lan Mouse Agent Instructions
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Lan Mouse is an open-source Software KVM sharing mouse/keyboard input across local networks. The Rust workspace combines a GTK frontend, CLI/daemon mode, and multi-OS capture/emulation backends for Linux, Windows, and macOS.
|
||||||
|
|
||||||
|
## Core principles
|
||||||
|
|
||||||
|
- **Scope discipline.** Only implement what was requested; describe follow-up work instead of absorbing it.
|
||||||
|
- **Clarify OS behavior.** Ask when requirements touch OS-specific capture/emulation (they differ significantly).
|
||||||
|
- **Docs stay current.** Update [README.md](README.md) or [DOC.md](DOC.md) when touching public APIs or platform support.
|
||||||
|
- **Rust idioms.** Use `Result`/`Option`, `thiserror` for errors, descriptive logs, and concise comments for non-obvious invariants.
|
||||||
|
|
||||||
|
## Terminology
|
||||||
|
|
||||||
|
- **Client:** A remote machine that can receive or send input events. Each client is either _active_ (receiving events) or _inactive_ (can send events back). This mutual exclusion prevents feedback loops.
|
||||||
|
- **Backend:** OS-specific implementation for capture or emulation (e.g., libei, layer-shell, wlroots, X11, Windows, macOS).
|
||||||
|
- **Handle:** A per-client identifier used to route events and track state (pressed keys, position).
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
**Pipeline:** `input-capture` → `lan-mouse-ipc` → `input-emulation`
|
||||||
|
|
||||||
|
- **input-capture:** Reads OS events into a `Stream<CaptureEvent>`. Backends tried in priority order (libei → layer-shell → X11 → fallback). Tracks `pressed_keys` to avoid stuck modifiers. `position_map` queues events when multiple clients share a screen edge.
|
||||||
|
- **input-emulation:** Replays events via the `Emulation` trait (`consume`, `create`, `destroy`, `terminate`). Maintains `pressed_keys` and releases them on disconnect.
|
||||||
|
- **lan-mouse-ipc / lan-mouse-proto:** Protocol glue and serialization. Events are UDP; connection requests are TCP on the same port. Version bumps required when serialization changes.
|
||||||
|
- **input-event:** Shared scancode enums and abstract event types—extend here, don't duplicate translations.
|
||||||
|
|
||||||
|
## Feature & cfg discipline
|
||||||
|
|
||||||
|
- Feature flags live in root `Cargo.toml`. Gate OS-specific modules with tight cfgs (e.g., `cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))`).
|
||||||
|
- Prefer module-level gating over per-function cfgs to avoid empty stubs.
|
||||||
|
- New backends: add feature in `Cargo.toml`, create gated module, log backend selection.
|
||||||
|
|
||||||
|
## Async patterns
|
||||||
|
|
||||||
|
- Tokio runtime with `futures` streams and `async_trait`. Model new flows as streams or async methods.
|
||||||
|
- Avoid blocking; use `spawn_blocking` if needed. Prefer existing single-threaded stream handling.
|
||||||
|
- `InputCapture` implements `Stream` and manually pumps backends—don't short-circuit this logic.
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo build --workspace # full build
|
||||||
|
cargo build -p <crate> # single crate
|
||||||
|
cargo test --workspace # all tests
|
||||||
|
cargo fmt && cargo clippy --workspace --all-targets --all-features # lint
|
||||||
|
RUST_LOG=lan_mouse=debug cargo run # debug logging
|
||||||
|
```
|
||||||
|
|
||||||
|
Run from repo root—no `cd` in scripts.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
- Unit tests for utilities; integration tests for protocol behavior.
|
||||||
|
- OS-specific backends: test via GTK/CLI on target OS or document manual verification.
|
||||||
|
- Dummy backend exercises pipeline without real dependencies.
|
||||||
|
- Verify `terminate()` releases keys on unexpected disconnect.
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
1. Clarify ambiguous requirements, especially OS-specific behavior.
|
||||||
|
2. Implement minimal change; flag follow-up work.
|
||||||
|
3. Add proportional tests; run `cargo test` on affected crates.
|
||||||
|
4. Run `cargo fmt` and `cargo clippy --workspace --all-targets --all-features`.
|
||||||
26
README.md
26
README.md
@@ -1,4 +1,9 @@
|
|||||||
# Lan Mouse
|
# Lan Mouse
|
||||||
|
|
||||||
|
[](https://github.com/feschber/lan-mouse/actions/workflows/rust.yml) [](https://github.com/feschber/lan-mouse/actions/workflows/cachix.yml) [](https://github.com/feschber/lan-mouse/actions/workflows/release.yml)
|
||||||
|
|
||||||
|
[](https://crates.io/crates/lan-mouse) [](https://github.com/feschber/lan-mouse/blob/main/Cargo.toml)
|
||||||
|
|
||||||
Lan Mouse is a *cross-platform* mouse and keyboard sharing software similar to universal-control on Apple devices.
|
Lan Mouse is a *cross-platform* mouse and keyboard sharing software similar to universal-control on Apple devices.
|
||||||
It allows for using multiple PCs via a single set of mouse and keyboard.
|
It allows for using multiple PCs via a single set of mouse and keyboard.
|
||||||
This is also known as a Software KVM switch.
|
This is also known as a Software KVM switch.
|
||||||
@@ -177,8 +182,27 @@ For a detailed list of available features, checkout the [Cargo.toml](./Cargo.tom
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
## Installing Dependencies for Development / Compiling from Source
|
### Git pre-commit hook
|
||||||
|
|
||||||
|
This repository includes a local git hooks directory `.githooks/` with a `pre-commit` script that enforces formatting, lints, and tests before allowing a commit. It is optional to enable it, but it will prevent you from committing code with failing unit tests or that needs clippy/fmt fixes. To enable the hook locally:
|
||||||
|
|
||||||
|
1. Make the hook executable:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
chmod +x .githooks/pre-commit
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Point git to the hooks directory (one-time per clone):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git config core.hooksPath .githooks
|
||||||
|
```
|
||||||
|
|
||||||
|
The `pre-commit` script runs `cargo fmt --all` (and fails if files were modified), `cargo clippy --workspace --all-targets --all-features -- -D warnings`, and `cargo test --workspace --all-features`.
|
||||||
|
|
||||||
|
### Dependencies & Compiling from Source
|
||||||
<details>
|
<details>
|
||||||
<summary>MacOS</summary>
|
<summary>MacOS</summary>
|
||||||
|
|
||||||
|
|||||||
3
wix/bundle/.gitignore
vendored
3
wix/bundle/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
/bin
|
|
||||||
/obj
|
|
||||||
icon.ico
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<Project Sdk="WixToolset.Sdk/5.0.0">
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Bundle</OutputType>
|
|
||||||
<TargetExt>.exe</TargetExt>
|
|
||||||
<Platforms>x64</Platforms>
|
|
||||||
<InstallerPlatform>x64</InstallerPlatform>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="WixToolset.Heat">
|
|
||||||
<Version>5.0.2</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="WixToolset.Bal.wixext">
|
|
||||||
<Version>5.0.2</Version>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
|
||||||
xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
|
|
||||||
|
|
||||||
<Bundle
|
|
||||||
Name="Lan Mouse"
|
|
||||||
Version="0.10.0"
|
|
||||||
UpgradeCode="{39A9744D-9D6E-4CD3-A84F-9E034786A7B1}"
|
|
||||||
Compressed="no"
|
|
||||||
SplashScreenSourceFile="icon.ico">
|
|
||||||
|
|
||||||
<BootstrapperApplication>
|
|
||||||
<bal:WixStandardBootstrapperApplication
|
|
||||||
LicenseUrl=""
|
|
||||||
Theme="hyperlinkLicense" />
|
|
||||||
</BootstrapperApplication>
|
|
||||||
|
|
||||||
<Chain>
|
|
||||||
<!-- Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810 -->
|
|
||||||
<ExePackage
|
|
||||||
Id="VC_REDIST_X64"
|
|
||||||
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
|
|
||||||
PerMachine="yes"
|
|
||||||
Permanent="yes"
|
|
||||||
Protocol="burn"
|
|
||||||
InstallCondition="VersionNT64 AND (ARCH_NAME = "AMD64")"
|
|
||||||
DetectCondition="(VCRUNTIME_X64_VER >= VCRUNTIME_VER) AND VersionNT64 AND (ARCH_NAME = "AMD64")"
|
|
||||||
InstallArguments="/install /quiet /norestart"
|
|
||||||
RepairArguments="/repair /quiet /norestart"
|
|
||||||
UninstallArguments="/uninstall /quiet /norestart">
|
|
||||||
<ExePackagePayload
|
|
||||||
Name="VC_redist.x64.exe"
|
|
||||||
ProductName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
|
|
||||||
Description="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
|
|
||||||
Hash="5935B69F5138AC3FBC33813C74DA853269BA079F910936AEFA95E230C6092B92F6225BFFB594E5DD35FF29BF260E4B35F91ADEDE90FDF5F062030D8666FD0104"
|
|
||||||
Size="25397512"
|
|
||||||
Version="14.40.33810.0"
|
|
||||||
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/1754ea58-11a6-44ab-a262-696e194ce543/3642E3F95D50CC193E4B5A0B0FFBF7FE2C08801517758B4C8AEB7105A091208A/VC_redist.x64.exe" />
|
|
||||||
</ExePackage>
|
|
||||||
<MsiPackage SourceFile="..\lan-mouse\bin\Debug\en-US\LanMouse.msi" Compressed="yes"/>
|
|
||||||
</Chain>
|
|
||||||
</Bundle>
|
|
||||||
</Wix>
|
|
||||||
3
wix/lan-mouse/.gitignore
vendored
3
wix/lan-mouse/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
/bin
|
|
||||||
/obj
|
|
||||||
icon.ico
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
|
||||||
<Fragment>
|
|
||||||
<StandardDirectory Id="ProgramFiles64Folder">
|
|
||||||
<Directory Id="INSTALLFOLDER" Name="!(bind.Property.Manufacturer) !(bind.Property.ProductName)">
|
|
||||||
<Directory Id="SHARE" Name="share"/>
|
|
||||||
<Directory Id="LIB" Name="lib"/>
|
|
||||||
</Directory>
|
|
||||||
</StandardDirectory>
|
|
||||||
<StandardDirectory Id="ProgramMenuFolder">
|
|
||||||
<Directory Id="ApplicationProgramsFolder" Name="!(bind.Property.ProductName)"/>
|
|
||||||
</StandardDirectory>
|
|
||||||
</Fragment>
|
|
||||||
</Wix>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<Project Sdk="WixToolset.Sdk/5.0.2">
|
|
||||||
<PropertyGroup>
|
|
||||||
<InstallerPlatform>x64</InstallerPlatform>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="WixToolset.Heat">
|
|
||||||
<Version>5.0.2</Version>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<HarvestDirectory Include="C:\gtk-build\gtk\x64\release\bin">
|
|
||||||
<ComponentGroupName>GTKBIN</ComponentGroupName>
|
|
||||||
<DirectoryRefId>INSTALLFOLDER</DirectoryRefId>
|
|
||||||
<SuppressRegistry>true</SuppressRegistry>
|
|
||||||
</HarvestDirectory>
|
|
||||||
<BindPath Include="C:\gtk-build\gtk\x64\release\bin" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<HarvestDirectory Include="C:\gtk-build\gtk\x64\release\share\icons">
|
|
||||||
<ComponentGroupName>GTKICONS</ComponentGroupName>
|
|
||||||
<DirectoryRefId>SHARE</DirectoryRefId>
|
|
||||||
<SuppressRegistry>true</SuppressRegistry>
|
|
||||||
</HarvestDirectory>
|
|
||||||
<BindPath Include="C:\gtk-build\gtk\x64\release\share\icons" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<HarvestDirectory Include="C:\gtk-build\gtk\x64\release\lib\gdk-pixbuf-2.0">
|
|
||||||
<ComponentGroupName>GTKLIBS</ComponentGroupName>
|
|
||||||
<DirectoryRefId>LIB</DirectoryRefId>
|
|
||||||
<SuppressRegistry>true</SuppressRegistry>
|
|
||||||
</HarvestDirectory>
|
|
||||||
<BindPath Include="C:\gtk-build\gtk\x64\release\lib\gdk-pixbuf-2.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
|
||||||
<Fragment>
|
|
||||||
<ComponentGroup Id="LanMouseComponents" Directory="INSTALLFOLDER" Subdirectory="bin">
|
|
||||||
<Component Guid="{ECB52D3E-28AD-4BEC-B9DF-E01CCAB356BE}">
|
|
||||||
<!-- the main binary -->
|
|
||||||
<File Source="..\..\target\release\lan-mouse.exe"/>
|
|
||||||
|
|
||||||
<!-- visual c runtime dll -->
|
|
||||||
<!--<File Source="C:\windows\system32\VCRUNTIME140.dll"/>-->
|
|
||||||
<!--<File Source="C:\windows\system32\VCRUNTIME140_1.dll"/>-->
|
|
||||||
</Component>
|
|
||||||
<!-- start menu entry-->
|
|
||||||
<Component Id="ApplicationShortcut" Directory="ApplicationProgramsFolder">
|
|
||||||
<Shortcut Id="ApplicationStartMenuShortcut"
|
|
||||||
Name="!(bind.Property.ProductName)"
|
|
||||||
Description ="Mouse and Keyboard sharing Software"
|
|
||||||
Target="[INSTALLFOLDER]bin\lan-mouse.exe"
|
|
||||||
WorkingDirectory="INSTALLFOLDER">
|
|
||||||
<Icon Id="LanMouse" SourceFile=".\icon.ico"/>
|
|
||||||
</Shortcut>
|
|
||||||
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
|
|
||||||
<RegistryValue
|
|
||||||
Root="HKCU"
|
|
||||||
Key="Software\Feschber\LanMouse"
|
|
||||||
Name="installed"
|
|
||||||
Type="integer"
|
|
||||||
Value="1"
|
|
||||||
KeyPath="yes"/>
|
|
||||||
</Component>
|
|
||||||
</ComponentGroup>
|
|
||||||
</Fragment>
|
|
||||||
</Wix>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<!--
|
|
||||||
This file contains the declaration of all the localizable strings.
|
|
||||||
-->
|
|
||||||
<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
|
|
||||||
|
|
||||||
<String Id="DowngradeError" Value="A newer version of [ProductName] is already installed." />
|
|
||||||
|
|
||||||
</WixLocalization>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
|
||||||
<Package Name="Lan Mouse"
|
|
||||||
Manufacturer="Ferdinand Schober"
|
|
||||||
Version="0.10.0.0"
|
|
||||||
UpgradeCode="{a330cd60-4c35-4a54-8bb6-75b3049b46c6}">
|
|
||||||
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
|
|
||||||
|
|
||||||
<MediaTemplate EmbedCab="yes"/>
|
|
||||||
<Feature Id="Main">
|
|
||||||
<ComponentGroupRef Id="GTKBIN"/>
|
|
||||||
<ComponentGroupRef Id="GTKICONS"/>
|
|
||||||
<ComponentGroupRef Id="GTKLIBS"/>
|
|
||||||
<ComponentGroupRef Id="LanMouseComponents"/>
|
|
||||||
</Feature>
|
|
||||||
</Package>
|
|
||||||
</Wix>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
magick -background none -density 384 ..\lan-mouse-gtk\resources\de.feschber.LanMouse.svg -trim -define icon:auto-resize icon.ico
|
|
||||||
dotnet build
|
|
||||||
Reference in New Issue
Block a user