{"id":18412945,"url":"https://github.com/viktorstrate/native-touchbar-addon","last_synced_at":"2025-04-07T11:32:20.602Z","repository":{"id":42365656,"uuid":"310945619","full_name":"viktorstrate/native-touchbar-addon","owner":"viktorstrate","description":"Browser addon that adds native macOS touchbar controls to webpages","archived":false,"fork":false,"pushed_at":"2022-04-08T18:39:23.000Z","size":11319,"stargazers_count":16,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T17:11:27.066Z","etag":null,"topics":["browser-extension","macos","touchbar"],"latest_commit_sha":null,"homepage":"https://addons.mozilla.org/en-US/firefox/addon/native-touchbar/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/viktorstrate.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}},"created_at":"2020-11-07T22:47:55.000Z","updated_at":"2025-02-24T16:35:35.000Z","dependencies_parsed_at":"2022-09-02T18:22:57.279Z","dependency_job_id":null,"html_url":"https://github.com/viktorstrate/native-touchbar-addon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viktorstrate%2Fnative-touchbar-addon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viktorstrate%2Fnative-touchbar-addon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viktorstrate%2Fnative-touchbar-addon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viktorstrate%2Fnative-touchbar-addon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viktorstrate","download_url":"https://codeload.github.com/viktorstrate/native-touchbar-addon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247644623,"owners_count":20972331,"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":["browser-extension","macos","touchbar"],"created_at":"2024-11-06T03:44:08.680Z","updated_at":"2025-04-07T11:32:16.731Z","avatar_url":"https://github.com/viktorstrate.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Native Touchbar Addon\n\nNative macOS touchbar controls for webpages\n\n\u003cimg width=\"720\" src=\"demo.gif\"\u003e\n\n## How it works\n\nThe project consists of two parts, a regular browser extension and a native binary that controls the touchbar.\nThe two parts communicate back and fourth using [Native Messaging](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging).\n\nThe browser extension exposes a bridging API to small JavaScript scripts that are injected into webpages using [URL pattern matching](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts#Matching_URL_patterns).\nThese small scripts are called [touchbar packets](./browser-addon/src/touchbar-packets/), and are formatted much like [Userscripts](https://en.wikipedia.org/wiki/Userscript), with a header describing the name of the packet and one or more url matches.\n\nThe binary is a small CLI app written mostly in Swift, its purpose is to receive configurations for the touchbar from the browser extension, update the touchbar accordingly and send any user interaction events back to the browser.\nThe binary uses a private system API to show the new touchbar on top of the original. Thanks to [Touch Bär](https://github.com/a2/touch-baer).\n\n## Installing\n\n### Build and install the binary\n\nClone the repository, and navigate into it.\n\n```sh\n$ git clone https://github.com/viktorstrate/native-touchbar-addon\n$ cd native-touchbar-addon\n```\n\nMake sure you have the newest version of Xcode installed.\nThen run the following command to build and install the binary.\n\nAlternatively you can open the xcode project and click on `Product` -\u003e `Build`\n\n```sh\n$ xcodebuild -scheme touchbar-browser-helper\n```\n\nThis will build the binary and copy it to `~/Library/Application Support/touchbar-browser-helper/`\n\n### Configure the Native Messaging Host\n\nNext we need to tell Firefox where the binary is located.\nTo do this, copy the [touchbar-browser-helper.json](./browser-addon/touchbar_browser_helper.json) file to `~/Library/Application Support/Mozilla/NativeMessagingHosts/`. Then change the path attribute in the json file to match the username of your account.\n\nYou can do all this by run the following commands.\n\n```sh\n$ mkdir -p ~/Library/Application\\ Support/Mozilla/NativeMessagingHosts/\n$ cp ./browser-addon/touchbar_browser_helper.json ~/Library/Application\\ Support/Mozilla/NativeMessagingHosts/\n$ sed -i '' \"s/YOUR_USERNAME/$USER/g\" ~/Library/Application\\ Support/Mozilla/NativeMessagingHosts/touchbar_browser_helper.json\n```\n\n### Install the browser extension\n\nInstall the browser extension from \nhttps://addons.mozilla.org/en-US/firefox/addon/native-touchbar/\n\nThe extension will automatically start the helper program in the background.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviktorstrate%2Fnative-touchbar-addon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviktorstrate%2Fnative-touchbar-addon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviktorstrate%2Fnative-touchbar-addon/lists"}