{"id":48834860,"url":"https://github.com/scijava/scijava-desktop","last_synced_at":"2026-04-14T22:30:41.808Z","repository":{"id":284424939,"uuid":"954883175","full_name":"scijava/scijava-desktop","owner":"scijava","description":"URI scheme handlers in SciJava","archived":false,"fork":false,"pushed_at":"2026-03-23T22:41:58.000Z","size":187,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-03-24T21:30:10.509Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scijava.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-25T19:04:19.000Z","updated_at":"2026-03-23T22:42:01.000Z","dependencies_parsed_at":"2025-03-25T20:44:18.123Z","dependency_job_id":"1b20c181-8ed6-4687-8482-43e256d0116c","html_url":"https://github.com/scijava/scijava-desktop","commit_stats":null,"previous_names":["scijava/scijava-links","scijava/scijava-desktop"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/scijava/scijava-desktop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scijava%2Fscijava-desktop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scijava%2Fscijava-desktop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scijava%2Fscijava-desktop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scijava%2Fscijava-desktop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scijava","download_url":"https://codeload.github.com/scijava/scijava-desktop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scijava%2Fscijava-desktop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31818831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"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":[],"created_at":"2026-04-14T22:30:41.070Z","updated_at":"2026-04-14T22:30:41.795Z","avatar_url":"https://github.com/scijava.png","language":"Java","readme":"# scijava-desktop\n\n[![Build Status](https://github.com/scijava/scijava-desktop/actions/workflows/build.yml/badge.svg)](https://github.com/scijava/scijava-desktop/actions/workflows/build.yml)\n\nUnified desktop integration for SciJava applications.\n\n## Features\n\nThe scijava-desktop component provides three kinds of desktop integration:\n\n1. **URI Link Scheme Registration \u0026 Handling**\n   - Register custom URI schemes (e.g., `myapp://`) with the operating system\n   - Handle URI clicks from web browsers and other applications\n   - Automatic scheme registration on application startup\n\n2. **Desktop Icon Generation**\n   - Linux: `.desktop` file creation in application menus\n   - Windows: Start Menu shortcuts (planned)\n   - macOS: Application bundle support\n\n3. **File Extension Registration** (planned)\n   - Associate file types with your application\n   - Platform-specific MIME type handling\n\n## Platform Support\n\n- **Linux**: Full support for URI schemes and desktop icons via `.desktop` files\n- **Windows**: URI scheme registration via Windows Registry (desktop icons planned)\n- **macOS**: Read-only support (configuration via Info.plist at build time)\n\n## Requirements\n\n- Java 11 or later (due to use of `java.awt.Desktop` features)\n- Platform-specific tools:\n  - Linux: `xdg-utils` (for `xdg-mime` and `update-desktop-database`)\n  - Windows: `reg` command (built-in)\n  - macOS: No runtime dependencies\n\n## Quick Start\n\n### 1. Add Dependency\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.scijava\u003c/groupId\u003e\n    \u003cartifactId\u003escijava-desktop\u003c/artifactId\u003e\n    \u003cversion\u003e\u003c!-- latest version --\u003e\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### 2. Configure System Properties\n\nSet these properties when launching your application:\n\n```bash\njava -Dscijava.app.executable=\"/path/to/myapp\" \\\n     -Dscijava.app.name=\"My Application\" \\\n     -Dscijava.app.icon=\"/path/to/icon.png\" \\\n     -jar myapp.jar\n```\n\n### 3. Create a LinkHandler Plugin\n\n```java\npackage com.example;\n\nimport org.scijava.desktop.links.AbstractLinkHandler;\nimport org.scijava.desktop.links.LinkHandler;\nimport org.scijava.plugin.Plugin;\n\nimport java.net.URI;\nimport java.util.Arrays;\nimport java.util.List;\n\n@Plugin(type = LinkHandler.class)\npublic class MyAppLinkHandler extends AbstractLinkHandler {\n\n    @Override\n    public boolean supports(final URI uri) {\n        return \"myapp\".equals(uri.getScheme());\n    }\n\n    @Override\n    public void handle(final URI uri) {\n        // Handle the URI (e.g., open a file, navigate to a view)\n        System.out.println(\"Handling: \" + uri);\n    }\n\n    @Override\n    public List\u003cString\u003e getSchemes() {\n        // Schemes to register with the OS\n        return Arrays.asList(\"myapp\");\n    }\n}\n```\n\n### 4. Launch and Test\n\n1. Start your application\n2. The `myapp://` scheme is automatically registered with your OS\n3. Click a `myapp://action?param=value` link in your browser\n4. Your application launches and handles the URI\n\n## Architecture\n\n### Link Handling System\n\n- **LinkService**: Service for routing URIs to appropriate handlers\n- **LinkHandler**: Plugin interface for implementing URI handlers\n- **LinkArgument**: Console argument plugin for command-line URI handling\n- **SchemeInstaller**: Platform-specific OS registration\n\n### Platform Integration\n\n- **Platform Plugins**: LinuxPlatform, WindowsPlatform, MacOSPlatform\n- **DesktopIntegrationProvider**: Interface for querying/toggling desktop features\n- **OptionsDesktop**: User-facing options plugin (Edit \u003e Options \u003e Desktop...)\n\n### State Management\n\nDesktop integration state is queried directly from the OS (not saved to preferences):\n- On load: Query OS for current registration state\n- On save: Apply changes directly to OS (e.g. registry, .desktop files)\n- Keeps UI in sync with actual OS state\n\n## System Properties\n\n| Property                   | Description                    | Platforms | Required                                                  |\n|----------------------------|--------------------------------|-----------|-----------------------------------------------------------|\n| `scijava.app.executable`   | Path to application executable | All       | Yes (for URI schemes)                                     |\n| `scijava.app.name`         | Application name               | All       | No (default: \"SciJava\")                       |\n| `scijava.app.icon`         | Icon path                      | All       | No                                                        |\n| `scijava.app.directory`    | Application directory          | All       | No                                                        |\n| `scijava.app.desktop-file` | Override .desktop file path    | Linux     | No (default: `~/.local/share/applications/\u003capp\u003e.desktop`) |\n\n## User Interface\n\nUsers can manage desktop integration via **Edit \u003e Options \u003e Desktop...** in your application:\n\n- **Enable web links**: Register/unregister URI schemes\n- **Add desktop icon**: Install/remove application launcher\n\nThe UI automatically grays out features that are not available on the current platform.\n\n## Documentation\n\n- [doc/WINDOWS.md](doc/WINDOWS.md) - Windows Registry-based URI scheme registration\n\n## Examples\n\n### Parse URI Components\n\n```java\nimport org.scijava.desktop.links.Links;\n\nURI uri = new URI(\"myapp://view/document?id=123\u0026mode=edit\");\n\nString operation = Links.operation(uri);  // \"view\"\nList\u003cString\u003e pathFragments = Links.pathFragments(uri);  // [\"view\", \"document\"]\nMap\u003cString, String\u003e query = Links.query(uri);  // {\"id\": \"123\", \"mode\": \"edit\"}\n```\n\n### Multiple Schemes\n\n```java\n@Plugin(type = LinkHandler.class)\npublic class MultiSchemeLinkHandler extends AbstractLinkHandler {\n\n    @Override\n    public boolean supports(final URI uri) {\n        String scheme = uri.getScheme();\n        return \"myapp\".equals(scheme) || \"myapp-dev\".equals(scheme);\n    }\n\n    @Override\n    public void handle(final URI uri) {\n        if (\"myapp-dev\".equals(uri.getScheme())) {\n            // Handle development scheme\n        } else {\n            // Handle production scheme\n        }\n    }\n\n    @Override\n    public List\u003cString\u003e getSchemes() {\n        return Arrays.asList(\"myapp\", \"myapp-dev\");\n    }\n}\n```\n\n## Platform-Specific Details\n\n### Linux\n\nURI schemes are registered by:\n1. Creating a `.desktop` file in `~/.local/share/applications/`\n2. Adding `x-scheme-handler/\u003cscheme\u003e` to the MimeType field\n3. Registering with `xdg-mime default \u003capp\u003e.desktop x-scheme-handler/\u003cscheme\u003e`\n4. Updating the desktop database with `update-desktop-database`\n\nDesktop icons are created by installing the `.desktop` file with appropriate fields (Name, Exec, Icon, Categories).\n\n### macOS\n\nURI schemes are declared in the application's `Info.plist` file within the `.app` bundle. This is configured at build time (bundle is code-signed and immutable), so runtime registration is not supported.\n\nThe MacOSPlatform correctly reports read-only status for all desktop integration features.\n\n### Windows\n\nURI schemes are registered in the Windows Registry under `HKEY_CURRENT_USER\\Software\\Classes\\\u003cscheme\u003e`. No administrator privileges are required.\n\nThe registry structure:\n```\nHKCU\\Software\\Classes\\myapp\n    (Default) = \"URL:myapp\"\n    URL Protocol = \"\"\n    shell\\open\\command\\\n        (Default) = \"C:\\Path\\To\\App.exe\" \"%1\"\n```\n\n## Known Issues\n\n### Hardcoded Elements (Needs Fixes)\n\n1. **Hardcoded \"fiji\" scheme**: WindowsPlatform:86,102 and LinuxPlatform:112,129 hardcode the \"fiji\" scheme instead of querying LinkHandler plugins.\n   - Impact: Only works for Fiji application\n   - Fix: See NEXT.md Work Item #1\n\n2. **Hardcoded OS checks**: DefaultLinkService:119-132 directly checks OS name instead of using PlatformService.\n   - Impact: Violates plugin architecture\n   - Fix: See NEXT.md Work Items #2 and #3\n\n### Missing Features\n\n- File extension registration\n- Windows desktop icon (Start Menu shortcut)\n- First launch dialog for opt-in\n\nSee [NEXT.md](NEXT.md) for details on planned improvements.\n\n## Manual Testing\n\n**Windows**:\n```bash\n# Check registry after running your app\nregedit\n# Navigate to HKCU\\Software\\Classes\\myapp\n```\n\n**Linux**:\n```bash\n# Check .desktop file\ncat ~/.local/share/applications/myapp.desktop\n\n# Check MIME associations\nxdg-mime query default x-scheme-handler/myapp\n```\n\n**Test URI handling**:\n```bash\n# Linux/macOS\nxdg-open \"myapp://test\"\n\n# Windows\nstart \"myapp://test\"\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscijava%2Fscijava-desktop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscijava%2Fscijava-desktop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscijava%2Fscijava-desktop/lists"}