Files
mac_without_borders/Sources/MWBMac/SettingsWindow/BehaviourPane.swift
T
lucioandClaude Opus 5 6b2b3fc65a app-ui: menu bar, settings window, notifications, login item
The real user interface, replacing app-engine's placeholder status item.

- MWBMac/StatusItem.swift: NSStatusItem with a code-drawn icon, the
  documented status colours (doc/devdocs/modules/mousewithoutborders.md)
  and the menu the Windows tray menu offers (frmScreen.Designer.cs:91-180).
- MWBMac/SettingsWindow/*: one NSWindow hosting a SwiftUI TabView with six
  panes; every property in README §Settings is reachable. Labels and help
  text taken from MouseWithoutBordersPage.xaml + Resources.resw, cited per
  file.
- MWBMac/Notifications.swift, LaunchAgent.swift: UNUserNotificationCenter
  and SMAppService.mainApp, both guarded on a bundle identifier.
- mwb/UIBridge.swift: EngineSnapshot -> StatusModel, clicks -> Engine, and
  the connected/lost/invalid-key notification diff.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:14:11 -07:00

112 lines
5.3 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))
}
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:
"Clipboard sharing, file transfer and screen-saver blocking are saved here "
+ "and sent to the other machines as settings, but this build does not act "
+ "on them yet — they arrive with the clipboard and extras work.")
NotYetActive(
text:
"Draw mouse cursor has no macOS equivalent and is not shown here; the value "
+ "in settings.json is kept untouched for the Windows machines that read it.")
}
}
}