GoForum🌐 V2EX

由于 macOS 上 iPhone 镜像功能无法利用第三方软件切换滚轮方向,我写了个脚本来切换

Lentin · 2026-06-05 17:03 · 0 次点赞 · 2 条回复

用了 Mos 并不能实现滚轮方向的切换跟 Gemini 聊了一会写了个脚本
格式为 AppleScript ,可以直接用这个快捷指令用聚焦来唤起执行,切换就很方便了
https://www.icloud.com/shortcuts/fff70a282668481da502b81461437c4d
记得在隐私与安全-辅助功能-给“聚焦”和“快捷指令”赋予权限
如果你有其他工具来切换的话可以直接用下面的代码执行脚本,问了 AI 听说可以利用 Hammerspoon 检测鼠标拔插事件来自动执行,我还是更喜欢手动执行,可以自行研究下。

do shell script "open 'x-apple.systempreferences:com.apple.Mouse-Settings.extension'"

tell application "System Events"
	tell process "System Settings"
		set maxWaitTime to 30
		set retryCount to 0
		set isClicked to false
		
		repeat until isClicked or retryCount > maxWaitTime
			try
				click checkbox "自然滚动" of group 1 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window 1
				set isClicked to true
			on error
				delay 0.1
				set retryCount to retryCount + 1
			end try
		end repeat
		
	end tell
end tell

quit application "System Settings"
2 条回复
Chicagoake · 2026-06-05 17:28
#1

我现在只在有触控板的机器上用镜像,用鼠标的机器点都不点开。

Lentin · 2026-06-05 17:28
#2

@Chicagoake 嘛,总有鼠标跟触控板来回切换的兄弟,方便一点是一点

添加回复
你还需要 登录 后发表回复

登录后可发帖和回复

登录 注册
主题信息
作者: Lentin
发布: 2026-06-05
点赞: 0
回复: 0