Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to hide mouse pointer #177

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions AKPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class AKPlugin: NSObject, Plugin {
warpCursor()
}

func hideCursorMove() {
NSCursor.setHiddenUntilMouseMoves(true)
}

func warpCursor() {
guard let firstScreen = NSScreen.screens.first else {return}
let frame = windowFrame
Expand Down
13 changes: 10 additions & 3 deletions PlayTools/Controls/MenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ extension UIApplication {
func toggleDebugOverlay(_ sender: AnyObject) {
DebugController.instance.toggleDebugOverlay()
}

@objc func hideCursor(_ sender: AnyObject) {
AKInterface.shared!.hideCursorMove()
}
}

extension UIViewController {
Expand Down Expand Up @@ -101,14 +105,17 @@ var keymapping = [
NSLocalizedString("menu.keymapping.rotateDisplay", tableName: "Playtools",
value: "Rotate display area", comment: ""),
NSLocalizedString("menu.keymapping.toggleDebug", tableName: "Playtools",
value: "Toggle Debug Overlay", comment: "")
value: "Toggle Debug Overlay", comment: ""),
NSLocalizedString("menu.keymapping.hide.pointer", tableName: "Playtools",
value: "Hide Mouse Pointer", comment: "")
]
var keymappingSelectors = [#selector(UIApplication.switchEditorMode(_:)),
#selector(UIApplication.removeElement(_:)),
#selector(UIApplication.upscaleElement(_:)),
#selector(UIApplication.downscaleElement(_:)),
#selector(UIApplication.rotateView(_:)),
#selector(UIApplication.toggleDebugOverlay(_:))
#selector(UIApplication.toggleDebugOverlay(_:)),
#selector(UIApplication.hideCursor(_:))
]

class MenuController {
Expand Down Expand Up @@ -150,7 +157,7 @@ class MenuController {

class func keymappingMenu() -> UIMenu {
let keyCommands = [ "K", UIKeyCommand.inputDelete,
UIKeyCommand.inputUpArrow, UIKeyCommand.inputDownArrow, "R", "D"]
UIKeyCommand.inputUpArrow, UIKeyCommand.inputDownArrow, "R", "D", "."]
let arrowKeyChildrenCommands = zip(keyCommands, keymapping).map { (command, btn) in
UIKeyCommand(title: btn,
image: nil,
Expand Down
1 change: 1 addition & 0 deletions Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public protocol Plugin: NSObjectProtocol {
var cmdPressed: Bool { get }

func hideCursor()
func hideCursorMove()
func warpCursor()
func unhideCursor()
func terminateApplication()
Expand Down
Loading