{"id":13785157,"url":"https://github.com/arran4/dart_unix_single_instance","last_synced_at":"2026-03-27T03:23:02.946Z","repository":{"id":236878582,"uuid":"793342450","full_name":"arran4/dart_unix_single_instance","owner":"arran4","description":"A library which uses unix sockets to ensure a single instance","archived":false,"fork":false,"pushed_at":"2026-02-28T03:46:04.000Z","size":207,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-28T06:53:36.187Z","etag":null,"topics":["dart","dart-library","dartlang","flutter","flutter-library","library","single-instance","unix"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/unix_single_instance","language":"Dart","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/arran4.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-04-29T03:22:40.000Z","updated_at":"2026-02-28T03:39:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"7df14ea7-aa2c-4471-81f9-f3b284bbcb0b","html_url":"https://github.com/arran4/dart_unix_single_instance","commit_stats":null,"previous_names":["arran4/dart_unix_single_instance"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/arran4/dart_unix_single_instance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arran4%2Fdart_unix_single_instance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arran4%2Fdart_unix_single_instance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arran4%2Fdart_unix_single_instance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arran4%2Fdart_unix_single_instance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arran4","download_url":"https://codeload.github.com/arran4/dart_unix_single_instance/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arran4%2Fdart_unix_single_instance/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31013973,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T02:58:54.984Z","status":"ssl_error","status_checked_at":"2026-03-27T02:58:46.993Z","response_time":164,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["dart","dart-library","dartlang","flutter","flutter-library","library","single-instance","unix"],"created_at":"2024-08-03T19:00:57.592Z","updated_at":"2026-03-27T03:22:57.923Z","avatar_url":"https://github.com/arran4.png","language":"Dart","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# Unix Single Instance\n\nRestrict a Linux or Mac OS X app to only be able to open one instance at a time. (Currently per user)\n\nThis uses Unix sockets to ensure a single instance. There are other ways of doing this however this was\nthe most \"portable.\" For windows support cosnider adding: windows_single_instance\n\nhttps://pub.dev/packages/unix_single_instance\n\n## Installing\n\n1. Add the `async` modifier to your apps `main` function.\n1. Write a function `cmdProcessor(List\u003cdynamic\u003e decodedArgs)` which re-processes command line options\n1. Add a call to `unixSingleInstance()` inside the appropriate conditions. Placement in the main function\nto taste.\n\n## Notes\n\nIf using flutter, recommend using this with the: `window_manager` plugin\n\n### Future expansion\n\nCurrently it is on a per-user basis and ignores multiple displays. It could be greatly improved with\noptions which allow you to toggle if it's per X, per user, etc. (If per X and per user and for linux only\nconsider using dbus -- not a strong recommendation.)\n\n## Example\n\n```\nimport 'package:unix_single_instance/unix_single_instance.dart';\n\nvoid main(List\u003cString\u003e args) async {\n    WidgetsFlutterBinding.ensureInitialized();\n    if (Platform.isLinux) {\n      if (!await unixSingleInstance(arguments, cmdProcessor)) {\n        exit(0);\n        return;\n      }\n    } else if (Platform.isMacOS) {\n      if (!await unixSingleInstance(arguments, cmdProcessor)) {\n        exit(0);\n        return;\n      }\n    }\n    runApp(const MyApp());\n}\n\nvoid cmdProcessor(List\u003cdynamic\u003e decodedArgs) {\n  if (decodedArgs.isEmpty \u0026\u0026 !Platform.isWindows) {\n    windowManager.waitUntilReadyToShow(null, () async {\n      await windowManager.show();\n      await windowManager.focus();\n    });\n  }\n  for (var each in decodedArgs) {\n    if (each is! String) {\n      continue;\n    }\n    doSomethingWithThis(each);\n  }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farran4%2Fdart_unix_single_instance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farran4%2Fdart_unix_single_instance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farran4%2Fdart_unix_single_instance/lists"}