{"id":13995479,"url":"https://github.com/ChimeHQ/NicerTouchBar","last_synced_at":"2025-07-22T22:30:59.571Z","repository":{"id":63906877,"uuid":"162041704","full_name":"ChimeHQ/NicerTouchBar","owner":"ChimeHQ","description":"Utilities for a more pleasant NSTouchBar development experience","archived":true,"fork":false,"pushed_at":"2024-07-05T18:44:15.000Z","size":52,"stargazers_count":33,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-18T22:42:10.934Z","etag":null,"topics":["appkit","macos","swift","touchbar"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChimeHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["mattmassicotte"]}},"created_at":"2018-12-16T21:16:23.000Z","updated_at":"2024-08-12T19:10:13.000Z","dependencies_parsed_at":"2024-01-20T18:02:16.638Z","dependency_job_id":"3c63ca72-892a-40dd-bca0-088ec372d568","html_url":"https://github.com/ChimeHQ/NicerTouchBar","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"567dd79a994c42b543a07176e0d1faffa4cb2fdf"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ChimeHQ/NicerTouchBar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FNicerTouchBar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FNicerTouchBar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FNicerTouchBar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FNicerTouchBar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChimeHQ","download_url":"https://codeload.github.com/ChimeHQ/NicerTouchBar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FNicerTouchBar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266585663,"owners_count":23952163,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","macos","swift","touchbar"],"created_at":"2024-08-09T14:03:26.099Z","updated_at":"2025-07-22T22:30:59.227Z","avatar_url":"https://github.com/ChimeHQ.png","language":"Swift","funding_links":["https://github.com/sponsors/mattmassicotte"],"categories":["Swift"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n[![Build Status][build status badge]][build status]\n[![Platforms][platforms badge]][platforms]\n\n\u003c/div\u003e\n\n# NicerTouchBar\n\nNicerTouchBar includes useful utilities for `NSTouchBar`/`NSTouchBarItem` validation, as well as some convenience methods for influencing `NSTouchBar` behavior/setup.\n\n## Validation\n\nWhile we have `NSMenuItemValidation` and `NSUserInterfaceValidations`, as of 10.15, `NSTouchBar` doesn't have a good validation system. This library introduces a `TouchBarItemValidations` protocol, which is checked first during the touch bar validation process. As a fallback, `NSUserInterfaceValidations` is checked if appropriate.\n\n```swift\npublic protocol TouchBarItemValidations {\n    @available(OSX 10.12.2, *)\n    func validateTouchBarItem(_ item: NSTouchBarItem) -\u003e Bool\n}\n```\n\nValidation is `NSTouchBarItem`-subclass dependent. Currently, `NSGroupTouchBarItem` and `NSPopoverTouchBarItem` are supported. `NSCustomTouchBarItem` is supported **if** its view property is a subclass of `NSControl`.\n\n## Triggering Validation\n\nBecause this validation isn't provided by the system, you have to do some work to wire it up. You can just use the `validate` method on `NSTouchBar` directly. This is manual, but can be efficient, especially if your validation needs are simple.\n\nA fancier way is to hook into NSWindow/NSApplication's `didUpdateNotification`. This gives you a easy way to run your validation automatically as the window/app processes events.\n\nAnd, as a convenience, there are a few functions/extensions that make it easier to manually validate.\n\n```swift\nclass MyViewController: NSViewController {\n    func myFunction() {\n        // this can be called safely before 10.12.2\n        validateTouchBar()\n        // or (cannot be called before 10.12.2)\n        touchbar?.validate()\n    }\n}\n```\n\n## Overriding a Window's TouchBar\n\nIt sometimes happens that you need to override a window's default touch bar. Instead of messing with binding, you can use a handy extension on `NSViewController`.\n\n```swift\ndeinit {\n    restoreParentWindowTouchBar()\n}\n\noverride func viewWillAppear() {\n    super.viewWillAppear()\n\n    becomeParentWindowTouchBarProvider()\n}\n```\n\n### Installation\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/ChimeHQ/NicerTouchBar\")\n]\n```\n\n### Suggestions or Feedback\n\nWe'd love to hear from you! Get in touch via an issue or pull request.\n\nPlease note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.\n\n[build status]: https://github.com/ChimeHQ/NicerTouchBar/actions\n[build status badge]: https://github.com/ChimeHQ/NicerTouchBar/workflows/CI/badge.svg\n[platforms]: https://swiftpackageindex.com/ChimeHQ/NicerTouchBar\n[platforms badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FChimeHQ%2FNicerTouchBar%2Fbadge%3Ftype%3Dplatforms\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChimeHQ%2FNicerTouchBar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FChimeHQ%2FNicerTouchBar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChimeHQ%2FNicerTouchBar/lists"}