Adds keyboard shortcuts for changing script policy

This commit is contained in:
2024-08-05 18:09:04 -07:00
parent 69aa02e303
commit 0fd466d86d
4 changed files with 67 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
//
import UIKit
import UIKit_Private.UIKeyCommand_Private
@objc
protocol ShortcutResponder: AnyObject {
@@ -56,6 +57,12 @@ protocol ShortcutResponder: AnyObject {
@objc
optional func handleOpenURL(_ sender: Any?, forEvent event: OpenURLEvent?)
@objc
optional func lowerScriptPolicyRestriction(_ sender: Any?)
@objc
optional func raiseScriptPolicyRestriction(_ sender: Any?)
}
public class OpenURLEvent: UIEvent {
@@ -153,6 +160,22 @@ public class KeyboardShortcuts {
action: #selector(ShortcutResponder.stop)
)
]),
UIMenu(options: .displayInline, children: [
// Raise Script Policy Restriction
UIKeyCommand(
modifiers: [.alternate], input: "x",
title: "Raise Script Policy Restriction",
action: #selector(ShortcutResponder.raiseScriptPolicyRestriction)
)._nonRepeatable(),
// Lower Script Policy Restriction
UIKeyCommand(
modifiers: [.alternate], input: "c",
title: "Lower Script Policy Restriction",
action: #selector(ShortcutResponder.lowerScriptPolicyRestriction)
)._nonRepeatable(),
])
].removeNulls()
case .go: