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
56 changes: 56 additions & 0 deletions .github/workflows/macos-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: macOS Apple Silicon

on:
push:
branches:
- main
paths:
- "mac/**"
- ".github/workflows/macos-arm64.yml"
pull_request:
paths:
- "mac/**"
- ".github/workflows/macos-arm64.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
build-arm64:
name: Build Apple Silicon DMG
runs-on: macos-15
timeout-minutes: 20

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Show toolchain
run: |
uname -m
sw_vers
swift --version

- name: Build and package arm64
working-directory: mac
run: ./package-dmg.sh --arch arm64

- name: Verify application and bundled tools
working-directory: mac
run: |
test "$(uname -m)" = "arm64"
lipo .build/bundle/MirrorCast.app/Contents/MacOS/MirrorCast -verify_arch arm64
TOOLS=.build/bundle/MirrorCast.app/Contents/Resources/android-tools
"$TOOLS/macos-aarch64/platform-tools/adb" version
"$TOOLS/macos-aarch64/scrcpy/scrcpy" --version
test -f "$TOOLS/macos-aarch64/scrcpy/scrcpy-server"

- name: Upload Apple Silicon DMG
uses: actions/upload-artifact@v4
with:
name: MirrorCast-macOS-arm64
path: |
mac/dist/MirrorCast-*-macOS-arm64.dmg
mac/dist/MirrorCast-*-macOS-arm64.dmg.sha256
if-no-files-found: error
4 changes: 4 additions & 0 deletions .github/workflows/macos-intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
run: |
lipo -archs .build/bundle/MirrorCast.app/Contents/MacOS/MirrorCast
lipo .build/bundle/MirrorCast.app/Contents/MacOS/MirrorCast -verify_arch x86_64
TOOLS=.build/bundle/MirrorCast.app/Contents/Resources/android-tools
"$TOOLS/macos-aarch64/platform-tools/adb" version
"$TOOLS/macos-x86_64/scrcpy/scrcpy" --version
test -f "$TOOLS/macos-x86_64/scrcpy/scrcpy-server"

- name: Upload Intel DMG
uses: actions/upload-artifact@v4
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Windows

on:
push:
branches:
- main
paths:
- "src/**"
- "scripts/package-windows.ps1"
- ".github/workflows/windows.yml"
pull_request:
paths:
- "src/**"
- "scripts/package-windows.ps1"
- ".github/workflows/windows.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
package:
name: Build complete x64 package
runs-on: windows-latest
timeout-minutes: 20

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Build and package
shell: pwsh
run: ./scripts/package-windows.ps1

- name: Upload Windows package
uses: actions/upload-artifact@v4
with:
name: MirrorCast-windows-x64
path: |
dist/MirrorCast-windows-x64.zip
dist/MirrorCast-windows-x64.zip.sha256
if-no-files-found: error
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ x86/
[Ww][Ii][Nn]32/
publish/
artifacts/
dist/
mac/.build/
mac/dist/
*.dll
Expand Down
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ MirrorCast 会把选中的窗口留在主屏原位,同时将它实时显示在
- 自定义全局快捷键,一键开始或停止镜像
- 常驻系统托盘或菜单栏,自动保存常用设置
- 首次运行提供权限和操作流程引导
- 安卓设备作为镜像来源,支持 USB、无线 ADB、音频与鼠标键盘控制

## 平台支持

| | Windows | macOS |
|---|---|---|
| 系统要求 | Windows 10 1809+ / Windows 11 | macOS 13+ |
| 支持架构 | x64 | Apple Silicon arm64、Intel x86_64 |
| 安装包 | 单文件 `MirrorCast.exe` | 按架构提供的 `MirrorCast-*-macOS-*.dmg` |
| 安装包 | 轻量单文件或包含安卓组件的 ZIP | 按架构提供的 `MirrorCast-*-macOS-*.dmg` |
| 镜像技术 | DWM Thumbnail | ScreenCaptureKit + IOSurface |
| 后台入口 | 系统托盘 | 菜单栏 |
| 默认快捷键 | `Ctrl + Alt + M` | `Control + Option + M` |
Expand Down Expand Up @@ -99,6 +100,17 @@ xattr -dr com.apple.quarantine "/Applications/MirrorCast.app"

镜像开始后,可以直接在窗口列表中选择另一个窗口,副屏会自动切换。关闭控制面板不会退出程序;请通过系统托盘或菜单栏重新打开、停止镜像或退出。

### 安卓设备投屏

完整版内置官方 scrcpy 4.1 和 Android Platform-Tools,无需单独安装 ADB 或 scrcpy。

1. 在安卓设备中开启“开发者选项”和“USB 调试”,首次连接时在手机上允许 RSA 授权。
2. 在“安卓设备投屏”中刷新并选择设备,选择目标显示器后点击“投到副屏”。
3. Android 11+ 使用无线调试时,需要先在系统无线调试页面完成一次 `adb pair`;之后 MirrorCast 会通过 ADB mDNS 发现当前连接端口。也可以填写手机 IP 和连接端口。
4. 可设置 30–165 FPS、鼠标键盘控制、电脑播放安卓音频,以及投屏后关闭手机显示屏。

安卓画面进入副屏后仍可使用 `F1`–`F4` 放大、放大镜、聚光灯和标注。进入标注时,应避免同时操作手机画面;标注只绘制在 MirrorCast 显示层,不会写入安卓设备。

### 自定义快捷键

点击界面中的快捷键按钮,然后按下新的组合键。组合键需要包含至少一个修饰键:
Expand All @@ -108,7 +120,7 @@ xattr -dr com.apple.quarantine "/Applications/MirrorCast.app"

按 `Esc` 取消录制。如果组合键被其他应用占用,MirrorCast 会保留原设置。

### 演示辅助(Windows)
### 演示辅助

镜像开始后,可以从运行状态面板或全局快捷键切换以下效果:

Expand All @@ -117,10 +129,12 @@ xattr -dr com.apple.quarantine "/Applications/MirrorCast.app"
- 指针聚光灯:压暗副屏其他区域并突出鼠标附近,默认 `Ctrl + Alt + Shift + P`。
- 屏幕标注:在主屏源窗口上绘制画笔、荧光笔、直线、箭头、矩形和椭圆,副屏同步显示,默认 `Ctrl + Alt + Shift + A`。

放大倍数、指针效果范围和四组快捷键均可在控制面板中调整。屏幕放大与指针放大镜互斥,聚光灯可以与任一模式组合。标注工具栏支持撤销、重做、清空和橡皮擦;按 `Esc` 可退出标注。标注内容仅在本次镜像期间保留。
放大倍数和指针效果范围可在控制面板中调整。Windows 版还支持分别设置四组组合快捷键。屏幕放大与指针放大镜互斥,聚光灯可以与任一模式组合。标注工具栏支持撤销、重做、清空和橡皮擦;按 `Esc` 可退出标注。标注内容仅在本次镜像期间保留。

默认开启“演示快捷模式”:仅在镜像期间使用 `F1` 开关屏幕放大、`F2` 开关指针放大镜、`F3` 开关指针聚光灯、`F4` 开关屏幕标注。按 `Esc` 会先退出最近开启的辅助功能;全部辅助功能都关闭后,再按一次 `Esc` 才会停止镜像。停止镜像后,MirrorCast 会立即释放这些按键。

Mac 键盘若将功能键用于亮度或音量控制,需要按住 `Fn` 再按对应功能键,或在系统设置中启用标准功能键。

## 缩放模式

| 平台 | 模式 | 效果 |
Expand All @@ -136,7 +150,7 @@ xattr -dr com.apple.quarantine "/Applications/MirrorCast.app"

### 通用

- MirrorCast 是只读镜像工具,不会把副屏点击或键盘操作传回源窗口。
- 普通窗口来源保持只读;安卓来源可按用户设置通过 scrcpy 启用鼠标键盘控制。
- 不提供录制、推流、叠加特效或远程控制功能。
- 至少需要两块显示器,并处于扩展模式。

Expand Down Expand Up @@ -170,6 +184,12 @@ dotnet run --project src/MirrorCast
dotnet publish src/MirrorCast -c Release -r win-x64 --self-contained -p:PublishSingleFile=true
```

生成包含安卓投屏组件的完整 ZIP:

```powershell
.\scripts\package-windows.ps1
```

### macOS

需要 macOS 13+ 和 Xcode Command Line Tools:
Expand Down
7 changes: 7 additions & 0 deletions mac/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ xcode-select --install
- 源窗口改变大小时动态更新捕获配置
- 镜像期间单击窗口列表即可切换源窗口
- 鼠标指针显示开关
- GPU 路径的全屏放大、指针放大镜和指针聚光灯
- 主屏矢量标注工具栏,副屏同步显示画笔、荧光笔、图形和箭头
- 镜像期间使用 `F1`、`F2`、`F3`、`F4` 快速切换演示功能,按 `Esc` 逐层退出
- 源窗口关闭或目标显示器断开时自动停止
- 跨 Space 保持副屏镜像
- 副屏镜像窗口点击穿透
- 菜单栏常驻与自定义全局快捷键
- 显示器、缩放、指针、窗口和快捷键设置持久化
- 屏幕录制权限引导与五步使用教学
- 内置 ADB 与 scrcpy 的安卓 USB / 局域网投屏来源

部分 Mac 键盘默认将功能键用于亮度、音量等系统控制,此时需要按住 `Fn` 再按 `F1` 至 `F4`,或在系统设置中启用“将 F1、F2 等键用作标准功能键”。演示快捷模式可以在控制面板中关闭。

## 构建应用

Expand Down Expand Up @@ -103,6 +109,7 @@ Intel 架构名为 `x86_64`,Apple Silicon 为 `arm64`,双架构包为 `unive
mac/Sources/MirrorCast/
├── Capture/ # ScreenCaptureKit 捕获与帧输出
├── Mirror/ # 副屏窗口、CALayer 显示和缩放模式
├── Presentation/ # 放大、聚光灯和矢量标注
├── Services/ # 权限、偏好设置、菜单栏和全局快捷键
├── UI/ # 控制面板、权限引导和使用教学
├── AppDelegate.swift
Expand Down
2 changes: 2 additions & 0 deletions mac/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<string>13.0</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSLocalNetworkUsageDescription</key>
<string>用于发现并连接同一局域网中已授权无线调试的安卓设备。</string>
<key>LSUIElement</key>
<true/>
</dict>
Expand Down
Loading
Loading