Closed mhorowitz closed 10 years ago
One way to solve this temporarily until I code something is using a stupid apple script to send the global hotkey, like this:
$ cat ~/bin/yubiswitch-toggle
tell application "System Events"
keystroke "y" using {command down, option down}
end tell
[Exit code 0 @ 11:42:39]
assuming you are using command-option-y it toggles the yubikey status off and on.
Long term solution is to have the application expose am XPC service that enables callers to toggle key on and off, then write a CLI Object-C tool that can call the service. It's explained here:
Writing a standalone cli tool seems awfully heavyweight. Why not just provide a scripting hook? I'd look up stuff in the docs, but developer.apple.com seems to be 404ing for everything right now.
i'm pretty n00b with objective-c, yubiswitch was basically the occasion to start learning something about it. i'll look more at the developer site.
I found this:
Who Should Read This Document
This document is intended for developers who want to make their Cocoa applications scriptable or > who need to know more about how Cocoa applications interact with AppleScript and Apple events."
I'll release a new binary shortly.
Done, download it at https://github.com/pallotron/yubiswitch/releases/tag/v0.5 Let me know if it works well for you :)
This way, I can write a wrapper around ssh which enables the key so I don't need to mess with the menu. This could be done with an applescript hook, and some sample osascript invocations somewhere.