{"id":16991310,"url":"https://github.com/gmasse/macmatic","last_synced_at":"2025-08-18T11:09:05.583Z","repository":{"id":200215218,"uuid":"704277569","full_name":"gmasse/macmatic","owner":"gmasse","description":"A Rust library for macOS automation with image detection, keyboard and mouse control.","archived":false,"fork":false,"pushed_at":"2023-10-14T23:31:50.000Z","size":5649,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T04:13:09.404Z","etag":null,"topics":["autoclicker","desktop-automation","image-recognition","keyboard","macos","mouse","rust"],"latest_commit_sha":null,"homepage":"https://g.masse.me/macmatic/doc/","language":"Rust","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/gmasse.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}},"created_at":"2023-10-12T23:39:03.000Z","updated_at":"2024-12-03T03:02:06.000Z","dependencies_parsed_at":"2023-10-16T05:16:42.087Z","dependency_job_id":null,"html_url":"https://github.com/gmasse/macmatic","commit_stats":null,"previous_names":["gmasse/macmatic"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gmasse/macmatic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmasse%2Fmacmatic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmasse%2Fmacmatic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmasse%2Fmacmatic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmasse%2Fmacmatic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gmasse","download_url":"https://codeload.github.com/gmasse/macmatic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmasse%2Fmacmatic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270982194,"owners_count":24679447,"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-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["autoclicker","desktop-automation","image-recognition","keyboard","macos","mouse","rust"],"created_at":"2024-10-14T03:25:29.212Z","updated_at":"2025-08-18T11:09:05.548Z","avatar_url":"https://github.com/gmasse.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![macmatic: A Rust library for macOS automation with image detection, keyboard and mouse control](./assets/banner.png)\n\n## Getting started\n\n### Requirements\nOpenCV: `brew install opencv`\n```sh\n$ export DYLD_FALLBACK_LIBRARY_PATH=\"$(xcode-select --print-path)/usr/lib/:/Library/Developer/CommandLineTools/usr/lib/:${DYLD_FALLBACK_LIBRARY_PATH}\"\n$ cargo add --git https://github.com/gmasse/macmatic.git\n$ cargo add enigo\n```\nList available windows:\n```rust\nfn main() {\n    println!(\"{}\", macmatic::WindowList::new().prettify());\n}\n```\nFind image and click on it:\n```rust\nuse std::path::Path;\nuse std::error::Error;\nuse enigo::*;\nuse macmatic::Bot;\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    let mut bot = Bot::new();\n    let enigo = Enigo::new();\n    bot.set_controller(enigo);\n\n    bot.set_window_from_name(\"Wikipedia-logo-v2.svg.png\");\n    bot.activate_window()?; // click on the top of the window to make it active\n    bot.click_on_image(Path::new(\"W.png\"), 500)?; // find the image W.png in the window and click on it\n\n    Ok(())\n}\n```\n\n## Documentation\n[API documentation](https://g.masse.me/macmatic/doc/)\n\n## Example\n```\n$ git clone https://github.com/gmasse/macmatic.git\n$ cd macmatic\n$ export DYLD_FALLBACK_LIBRARY_PATH=\"$(xcode-select --print-path)/usr/lib/:/Library/Developer/CommandLineTools/usr/lib/:${DYLD_FALLBACK_LIBRARY_PATH}\"\n$ cargo run --example preview\n\nAn example of the macmatic framework\n\nUsage: preview [OPTIONS] \u003cCOMMAND\u003e\n\nCommands:\n  list          list windows name\n  screenshot    screenshot a window\n  test_find     Search the template image in a window\n  test_preview  Example of automation of the Preview app\n  help          Print this message or the help of the given subcommand(s)\n\nOptions:\n  -w, --window \u003cNAME\u003e  Name of the window to capture (prefix with ~ for regexp)\n  -i, --id \u003cID\u003e        Id of the window to capture\n  -h, --help           Print help\n```\n\n### List available windows\n```sh\n$ cargo run --example preview list\n\nId     Window Name                    Window Owner Name\n------------------------------------------------------------------\n11833  Item-0                         Antivirus for Mac\n8653   Item-0                         Rectangle\n8899   Item-0                         Bitwarden\n21915  Item-0                         Spotlight\n21505  Menubar                        Window Server\n14474  cargo run --example preview... iTerm2\n25829  Wikipedia-logo-v2.svg.png      Preview\n```\n\n### Image detection\n```sh\n$ open -a Preview examples/img/Wikipedia-logo-v2.svg.png\n$ RUST_LOG=debug cargo run --example preview -- --window 'Wikipedia-logo-v2.svg.png' test_find --template 'examples/img/W.png'\n\n[2023-10-09T21:07:49Z DEBUG preview] Display size: (2560, 1440)\n[2023-10-09T21:07:49Z DEBUG macmatic] Activating window\n[2023-10-09T21:07:49Z DEBUG macmatic] Click on: 565, 39\n[2023-10-09T21:07:51Z DEBUG macmatic] found: Rect { x: 1192, y: 676, width: 300, height: 240 }\n[2023-10-09T21:07:51Z INFO  preview] Template found at Rect {\n        x: 1192,\n        y: 676,\n        width: 300,\n        height: 240,\n    }\n```\n\n### Mouse and keybord automation\n```sh\n$ RUST_LOG=debug cargo run --example preview -- --window 'Wikipedia-logo-v2.svg.png' test_preview\n\n[2023-10-09T21:09:21Z DEBUG preview] Display size: (2560, 1440)\n[2023-10-09T21:09:21Z DEBUG macmatic] Activating window\n[2023-10-09T21:09:21Z DEBUG macmatic] Click on: 565, 39\n[2023-10-09T21:09:23Z DEBUG macmatic] found: Rect { x: 1192, y: 676, width: 300, height: 240 }\n[2023-10-09T21:09:23Z DEBUG macmatic] Mouse down on: 600, 367\n[2023-10-09T21:09:24Z DEBUG macmatic] Mouse up on: 750, 487\n[2023-10-09T21:09:24Z DEBUG macmatic] Key down: Control\n[2023-10-09T21:09:24Z DEBUG macmatic] Key down: Meta\n[2023-10-09T21:09:24Z DEBUG macmatic] Key click: Layout(\n        'T',\n    )\n[2023-10-09T21:09:25Z DEBUG macmatic] Key up: Meta\n[2023-10-09T21:09:25Z DEBUG macmatic] Key up: Control\n[2023-10-09T21:09:25Z DEBUG macmatic] Typing: macmatic\n[2023-10-09T21:09:26Z DEBUG macmatic] Searching examples/img/W.png\n[2023-10-09T21:09:26Z DEBUG macmatic] Image found on: Rect { x: 1192, y: 735, width: 300, height: 240 }\n[2023-10-09T21:09:26Z DEBUG macmatic] Click on: 675, 456\n```\n![Screen recording](assets/macmatic.preview.480.6fps.mov)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmasse%2Fmacmatic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgmasse%2Fmacmatic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmasse%2Fmacmatic/lists"}