{"id":18031730,"url":"https://github.com/dagronf/appkitfocusoverlay","last_synced_at":"2025-07-08T10:38:41.061Z","repository":{"id":63907275,"uuid":"443644558","full_name":"dagronf/AppKitFocusOverlay","owner":"dagronf","description":"Add hotkey(s) to display the key focus path for any window in your AppKit application.","archived":false,"fork":false,"pushed_at":"2024-10-01T20:34:55.000Z","size":65,"stargazers_count":66,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T09:25:28.785Z","etag":null,"topics":["appkit","focus","focus-management","macos","objective-c","swift","tab"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dagronf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-01T23:36:51.000Z","updated_at":"2025-03-09T01:37:49.000Z","dependencies_parsed_at":"2024-10-30T10:21:39.603Z","dependency_job_id":null,"html_url":"https://github.com/dagronf/AppKitFocusOverlay","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"a594d2c545166d7902aa1c4d60ecfec12c465dc2"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FAppKitFocusOverlay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FAppKitFocusOverlay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FAppKitFocusOverlay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FAppKitFocusOverlay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dagronf","download_url":"https://codeload.github.com/dagronf/AppKitFocusOverlay/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253785852,"owners_count":21964039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appkit","focus","focus-management","macos","objective-c","swift","tab"],"created_at":"2024-10-30T10:10:36.042Z","updated_at":"2025-05-12T17:25:42.368Z","avatar_url":"https://github.com/dagronf.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AppKitFocusOverlay\n\nA simple package for displaying the current focus (`nextKeyView`) target path for an AppKit window.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/tag/dagronf/AppKitFocusOverlay\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/macOS-10.13+-purple\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n   \u003ca href=\"https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/AppKitFocusOverlay/focus-before.png?raw=true\"\u003e\n\t   \u003cimg src=\"https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/AppKitFocusOverlay/focus-before.png?raw=true\" width=\"400\"/\u003e\n\t\u003c/a\u003e\n   \n   \u003ca href=\"https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/AppKitFocusOverlay/focus-after.png?raw=true\"\u003e\n\t   \u003cimg src=\"https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/AppKitFocusOverlay/focus-after.png?raw=true\" width=\"400\"/\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n* Press and hold `command-option-[` key to display the focus key path for the currently focussed window\n* Press and hold `command-option-]` key to display the focus key path from the currently focussed UI element.\n\nSupports both Swift and Objective-C projects.\n\n## Why?\n\nIt's important for your app to be keyboard navigable and that the tab path makes sense to a user. There's been a bit of discussion of recent regarding keyboard navigation on iOS, [highlighting the `-UIFocusLoopDebuggerEnabled YES` launch argument option for iOS apps in Xcode.](https://twitter.com/stroughtonsmith/status/1473669534712274944?s=20). The question was posed as to whether this also worked for AppKit, and the short answer was no.\n\nI built the prototype for this a few years back for use in my own apps. It's not as frictionless as adding a launch argument but it's straight forward enough to add. Given how useful it's been for me I thought I'd package it up cleanly and make it public.\n\n## Demo\n\n\u003ca href=\"https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/AppKitFocusOverlay/example.mp4?raw=true\"\u003eClick here to see a demo video\u003c/a\u003e of the focus overlay added to the wonderful '[ControlRoom](https://github.com/twostraws/ControlRoom)' application.\n\nThere are also very basic AppKit example applications (using both Swift and Objective-C) in the `Demo` subfolder you can play with.\n\n## Simple setup\n\n* Add the `https://github.com/dagronf/AppKitFocusOverlay` package to your application.\n\n* Define a global instance of `AppKitFocusOverlay` in your app and access the instance within a method that gets called early in your app's lifecycle, such as `applicationDidFinishLaunching`.\n\n```swift\nimport AppKitFocusOverlay\nlet _globalFocusOverlay = AppKitFocusOverlay()\n\nfunc applicationDidFinishLaunching(_ aNotification: Notification) {\n   // Force the focus overlay instance to init.\n   _ = _globalFocusOverlay\n   ...\n}\n```\n\n## Features\n\n### Custom hotkeys\n\nYou can define the hotkeys to use in the initializer of the instance. By default, these are `command-option-[` and `command-option-]`, but you can change them to `f13` and `f14` (for example) if you want.\n\nNote that as of macOS 15.0 Sequoia [shortcuts _must_ include a modifier that isn't shift or option](https://developer.apple.com/forums//thread/763878?src=push\u0026answerId=804374022#804374022) \n\n\u003e This was an intentional change in macOS Sequoia to limit the ability of key-logging malware to observe keys in other applications. The issue of concern was that shift+option can be used to generate alternate characters in passwords, such as Ø (shift-option-O).\n\u003e \n\u003e There is no workaround; macOS Sequoia now requires that a hotkey registration use at least one modifier that is not shift or option.\n\n#### Example\n\n```swift\nimport AppKitFocusOverlay\nimport HotKey               // Available due to AppKitFocusOverlay dependency \n\nlet _globalFocusOverlay: AppKitFocusOverlay(\n   windowHotKey: HotKey(key: .f13, modifiers: []),\n   viewHotKey: HotKey(key: .f14, modifiers: [])\n)\n\nfunc applicationDidFinishLaunching(_ aNotification: Notification) {\n   // Force the focus overlay instance to init.\n   _ = _globalFocusOverlay\n   ...\n}\n```\n\n### Objective-C support\n\nYou can add `AppKitFocusOverlay` to your Objective-C project easily.\n\n```objc\n@import AppKitFocusOverlay;\n\n@interface AppDelegate ()\n/// Define an instance of the focus overlay\n@property (nonatomic, strong) AppKitFocusOverlay* focusOverlay;\n@end\n\n@implementation AppDelegate\n\n- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {\n   /// Create the overlay and attach\n   AppKitFocusOverlay* focus = [[AppKitFocusOverlay alloc] init];\n   [self setFocusOverlay: focus];\n}\n\n@end\n```\n\n#### Notes\n\n* You may need to embed the swift libraries (Build settings) if your app doesn't already if you're planning to distribute an archive or release build to (eg.) your QA dept.\n* If you need to customize the hotkeys for objective-c you'll need to fork this library and change the code in `AppKitFocusOverlay.swift`, as the HotKey library is not exposed through Objective-C and as such the hotkey-setting initializers are not exposed to objc.\n\n# Screenshots\n\n\u003cimg src=\"https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/AppKitFocusOverlay/qr-example.jpg?raw=true\" width=\"600\"/\u003e\n\n\u003cimg src=\"https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/AppKitFocusOverlay/custom-tabbing-order-objc.jpg?raw=true\" width=\"380\"/\u003e\n\n\n# Thanks!\n\nUses [HotKey](https://github.com/soffes/HotKey) to define and detect hot-key presses.\n\n# License\n\n## AppKitFocusOverlay\n\n```\nMIT License\n\nCopyright (c) 2024 Darren Ford\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n## HotKey\n\n```\nCopyright (c) 2017–2019 Sam Soffes, http://soff.es\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagronf%2Fappkitfocusoverlay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdagronf%2Fappkitfocusoverlay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagronf%2Fappkitfocusoverlay/lists"}