- MWBMac/Awake.swift: DisplayAwake renews an IOPMAssertion (PreventUserIdleDisplaySleep, 90 s timeout) on every Awake (21), the macOS answer to Common.HumanBeingDetected/PokeMyself (Receiver.cs:244-249, Common.cs:561-591) without posting input. - MWBMac/Fullscreen.swift: the frontmost app's excluded-apps test and a covers-a-whole-display window check, cached 250 ms; gated in the Engine by IsEasyMouseSwitchAllowed's two early outs (Common.cs:1638-1650), so it is asked only on the edge path. - MWBMac/FakeCursor.swift: CursorOverlay draws NSCursor.arrow at the last injected position (Receiver.cs:186-188) and hides on park, local input and shutdown (Common.cs:1495, InputHook.cs:256-264); FakeCursor coalesces the main-thread hops. - Settings.drawMouseCursor accessor + the Behaviour-pane toggle, answering app-ui's open request. - UIBridge.TransferNotices wires ClipboardAction.note to the Notifier, answering clipboard's open request (Clipboard.cs:610-618, 869-881, 916). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
115 lines
5.5 KiB
Swift
115 lines
5.5 KiB
Swift
// The Behaviour pane: what the mouse, the clipboard and Easy Mouse do.
|
|
//
|
|
// Every label and explanation here is the modern PowerToys page's, from
|
|
// `Settings.UI/Strings/en-us/Resources.resw` via
|
|
// `SettingsXAML/Views/MouseWithoutBordersPage.xaml:222-352` — "Mouse behavior",
|
|
// "Share clipboard", "Easy Mouse: move between machines by moving the mouse
|
|
// pointer to the screen edges", and so on. Where a phrase is Windows-only it is
|
|
// re-worded for the Mac and the deviation is noted in the feature README.
|
|
|
|
import Foundation
|
|
import MWBCore
|
|
import SwiftUI
|
|
|
|
/// The behaviour flags.
|
|
struct BehaviourPane: View {
|
|
@ObservedObject var model: SettingsViewModel
|
|
|
|
var body: some View {
|
|
SettingsPaneLayout {
|
|
SettingsSection("Mouse behavior") {
|
|
SettingsToggle(
|
|
"Hide mouse at the screen edge",
|
|
help:
|
|
"Hide the cursor at the top edge when switching to another machine, and "
|
|
+ "take focus from full-screen apps to ensure keyboard input is "
|
|
+ "redirected.",
|
|
isOn: model.binding(\.hideMouseAtScreenEdge))
|
|
SettingsToggle(
|
|
"Move mouse relatively",
|
|
help:
|
|
"Use this option when the remote machine's monitor settings are "
|
|
+ "different, or the remote machine has multiple monitors.",
|
|
isOn: model.binding(\.moveMouseRelatively))
|
|
SettingsToggle(
|
|
"Block mouse at screen corners to avoid accident machine-switch at screen "
|
|
+ "corners",
|
|
isOn: model.binding(\.blockMouseAtScreenCorners))
|
|
SettingsToggle(
|
|
"Draw mouse cursor",
|
|
help:
|
|
"Draw an arrow on this Mac where the remote pointer is while another "
|
|
+ "machine is controlling it. macOS already moves the real pointer, so "
|
|
+ "this is a second marker rather than a replacement.",
|
|
isOn: model.binding(\.drawMouseCursor))
|
|
}
|
|
|
|
SettingsSection("Easy Mouse") {
|
|
Picker(
|
|
"Move between machines by moving the mouse pointer to the screen edges",
|
|
selection: model.binding(\.easyMouse)
|
|
) {
|
|
Text("Disabled").tag(EasyMouseMode.disable)
|
|
Text("Enabled").tag(EasyMouseMode.enable)
|
|
Text("Ctrl").tag(EasyMouseMode.ctrl)
|
|
Text("Shift").tag(EasyMouseMode.shift)
|
|
}
|
|
.pickerStyle(.radioGroup)
|
|
SettingsToggle(
|
|
"Disable Easy Mouse when an application is running in full screen",
|
|
help:
|
|
"Prevent Easy Mouse from moving to another machine when an application "
|
|
+ "is in full-screen mode. This only affects this Mac; it does not stop "
|
|
+ "the mouse moving away from remote machines.",
|
|
isOn: model.binding(\.disableEasyMouseWhenFullscreen))
|
|
Text("Ignored full-screen applications")
|
|
.font(.subheadline)
|
|
Text(
|
|
"Allow Easy Mouse to move between machines even if one of these applications "
|
|
+ "is running in full screen. One per line — a bundle name such as "
|
|
+ "Safari, or an executable name such as msedge.exe for a Windows peer."
|
|
)
|
|
.font(.callout).foregroundStyle(.secondary)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
TextEditor(text: $model.excludedAppsDraft)
|
|
.font(.system(.body, design: .monospaced))
|
|
.frame(height: 70)
|
|
.border(.separator)
|
|
HStack {
|
|
Button("Save list") { model.saveExcludedApps() }
|
|
Spacer()
|
|
}
|
|
}
|
|
|
|
SettingsSection("Clipboard and files") {
|
|
SettingsToggle(
|
|
"Share clipboard",
|
|
help: "Copied text and images follow the control to the other machine.",
|
|
isOn: model.binding(\.shareClipboard))
|
|
SettingsToggle(
|
|
"Transfer copied files to the remote machine's clipboard (up to 100 MB)",
|
|
isOn: model.binding(\.transferFile))
|
|
}
|
|
|
|
SettingsSection("Other machines") {
|
|
SettingsToggle(
|
|
"Block screen saver on other machines",
|
|
help:
|
|
"Prevent the screen saver from starting on other machines when you are "
|
|
+ "actively working on this one.",
|
|
isOn: model.binding(\.blockScreenSaverOnOtherMachines))
|
|
SettingsToggle(
|
|
"Show clipboard and network status messages",
|
|
help: "Show clipboard activity and network status as notifications.",
|
|
isOn: model.binding(\.showClipboardAndNetworkStatusMessages))
|
|
}
|
|
|
|
NotYetActive(
|
|
text:
|
|
"Draw mouse cursor is accepted by Windows peers as two settings; the second, "
|
|
+ "DrawMouseEx, selects a Windows-only drawing path and is kept untouched "
|
|
+ "in settings.json for the machines that read it.")
|
|
}
|
|
}
|
|
}
|