mirror of
https://github.com/home-assistant/iOS.git
synced 2026-04-20 07:38:31 -05:00
## Summary Adds a basic menu structure to the status item. This includes: - Toggling the app (e.g. activate or deactivate) - Performing actions - Opening About, Checking for Updates, opening Preferences and Quitting ## Screenshots <img width="259" alt="Screen Shot 2021-01-24 at 22 51 24" src="https://user-images.githubusercontent.com/74188/105670916-b59cf580-5e96-11eb-9143-19ac5d4af92c.png"><img width="260" alt="Screen Shot 2021-01-24 at 22 51 16" src="https://user-images.githubusercontent.com/74188/105670921-b6ce2280-5e96-11eb-9c25-eddf4bb7ae12.png"> ## Any other notes There's not a clean way to do the left/right click handling. There's a few ways, all with their own pluses and negatives: - Calling `popUpMenu(_:)` programmatically works, but it's marked as deprecated and it's tough to get Swift to not care. - Handling `menuWillOpen` to instead do the left-click behavior and abort the menu display.
12 lines
289 B
Swift
12 lines
289 B
Swift
import AppKit
|
|
|
|
extension NSEvent {
|
|
var isRightClickEquivalentEvent: Bool {
|
|
switch type {
|
|
case .rightMouseUp, .rightMouseDown: return true
|
|
case .leftMouseUp, .leftMouseDown: return modifierFlags.contains(.control)
|
|
default: return false
|
|
}
|
|
}
|
|
}
|