Skip to content

Commit c109082

Browse files
ctruedenclaude
andcommitted
Update documentation to current reality
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5558292 commit c109082

2 files changed

Lines changed: 19 additions & 118 deletions

File tree

README.md

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The scijava-desktop component provides three kinds of desktop integration:
1818
- Windows: Start Menu shortcuts (planned)
1919
- macOS: Application bundle support
2020

21-
3. **File Extension Registration** (planned)
21+
3. **File Extension Registration**
2222
- Associate file types with your application
2323
- Platform-specific MIME type handling
2424

@@ -56,6 +56,7 @@ Set these properties when launching your application:
5656
java -Dscijava.app.executable="/path/to/myapp" \
5757
-Dscijava.app.name="My Application" \
5858
-Dscijava.app.icon="/path/to/icon.png" \
59+
-Dscijava.app.wmclass="myapp-Main" \
5960
-jar myapp.jar
6061
```
6162

@@ -125,13 +126,15 @@ Desktop integration state is queried directly from the OS (not saved to preferen
125126

126127
## System Properties
127128

128-
| Property | Description | Platforms | Required |
129-
|----------------------------|--------------------------------|-----------|-----------------------------------------------------------|
130-
| `scijava.app.executable` | Path to application executable | All | Yes (for URI schemes) |
131-
| `scijava.app.name` | Application name | All | No (default: "SciJava") |
132-
| `scijava.app.icon` | Icon path | All | No |
133-
| `scijava.app.directory` | Application directory | All | No |
134-
| `scijava.app.desktop-file` | Override .desktop file path | Linux | No (default: `~/.local/share/applications/<app>.desktop`) |
129+
| Property | Description | Platforms | Default |
130+
|----------------------------|-------------------------------------|-----------|--------------------------------------------------|
131+
| `scijava.app.executable` | Path to application executable | All | Required for URI schemes and desktop icon |
132+
| `scijava.app.name` | Application display name | All | `SciJava Application` |
133+
| `scijava.app.icon` | Icon path or theme name | All | None |
134+
| `scijava.app.directory` | Application working directory | All | None |
135+
| `scijava.app.desktop-file` | Override `.desktop` file path | Linux | `~/.local/share/applications/<app>.desktop` |
136+
| `scijava.app.categories` | Desktop entry categories | Linux | `Science;Education;` |
137+
| `scijava.app.wmclass` | X11 WM_CLASS for taskbar matching | Linux | None (field omitted if unset) |
135138

136139
## User Interface
137140

@@ -198,7 +201,7 @@ URI schemes are registered by:
198201
3. Registering with `xdg-mime default <app>.desktop x-scheme-handler/<scheme>`
199202
4. Updating the desktop database with `update-desktop-database`
200203

201-
Desktop icons are created by installing the `.desktop` file with appropriate fields (Name, Exec, Icon, Categories).
204+
Desktop icons are created by installing the `.desktop` file with appropriate fields (`Name`, `Exec`, `Icon`, `Categories`, `TryExec`, `StartupNotify`, and optionally `StartupWMClass`). Set `scijava.app.wmclass` to the X11 WM_CLASS your application's windows carry (e.g. as set via `sun.awt.X11.XToolkit.awtAppClassName`) so GNOME Shell and other compositors can match the running window to the launcher entry for correct taskbar icons and grouping.
202205

203206
### macOS
204207

@@ -219,26 +222,6 @@ HKCU\Software\Classes\myapp
219222
(Default) = "C:\Path\To\App.exe" "%1"
220223
```
221224

222-
## Known Issues
223-
224-
### Hardcoded Elements (Needs Fixes)
225-
226-
1. **Hardcoded "fiji" scheme**: WindowsPlatform:86,102 and LinuxPlatform:112,129 hardcode the "fiji" scheme instead of querying LinkHandler plugins.
227-
- Impact: Only works for Fiji application
228-
- Fix: See NEXT.md Work Item #1
229-
230-
2. **Hardcoded OS checks**: DefaultLinkService:119-132 directly checks OS name instead of using PlatformService.
231-
- Impact: Violates plugin architecture
232-
- Fix: See NEXT.md Work Items #2 and #3
233-
234-
### Missing Features
235-
236-
- File extension registration
237-
- Windows desktop icon (Start Menu shortcut)
238-
- First launch dialog for opt-in
239-
240-
See [NEXT.md](NEXT.md) for details on planned improvements.
241-
242225
## Manual Testing
243226

244227
**Windows**:

doc/WINDOWS.md

Lines changed: 7 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ When the application starts:
1515
1. `DefaultLinkService` initializes and listens for `ContextCreatedEvent`
1616
2. Collects all URI schemes from registered `LinkHandler` plugins via `getSchemes()`
1717
3. Reads the executable path from the `scijava.app.executable` system property
18-
4. Creates a `WindowsSchemeInstaller` (currently hardcoded, should use platform plugin)
18+
4. Creates a `WindowsSchemeInstaller`
1919
5. Registers each scheme in the Windows Registry
2020

2121
### Registry Structure
@@ -105,50 +105,6 @@ set APP_HOME=%~dp0
105105
-jar "%APP_HOME%\lib\myapp.jar"
106106
```
107107

108-
### Creating a LinkHandler
109-
110-
To register custom URI schemes, create a `LinkHandler` plugin:
111-
112-
```java
113-
package com.example;
114-
115-
import org.scijava.desktop.links.AbstractLinkHandler;
116-
import org.scijava.desktop.links.LinkHandler;
117-
import org.scijava.desktop.links.Links;
118-
import org.scijava.plugin.Plugin;
119-
120-
import java.net.URI;
121-
import java.util.Arrays;
122-
import java.util.List;
123-
import java.util.Map;
124-
125-
@Plugin(type = LinkHandler.class)
126-
public class MyAppLinkHandler extends AbstractLinkHandler {
127-
128-
@Override
129-
public boolean supports(final URI uri) {
130-
return "myapp".equals(uri.getScheme());
131-
}
132-
133-
@Override
134-
public void handle(final URI uri) {
135-
// Parse the URI
136-
String operation = Links.operation(uri);
137-
Map<String, String> params = Links.query(uri);
138-
139-
// Your business logic here
140-
System.out.println("Operation: " + operation);
141-
System.out.println("Parameters: " + params);
142-
}
143-
144-
@Override
145-
public List<String> getSchemes() {
146-
// This tells DefaultLinkService to register "myapp://" with Windows
147-
return Arrays.asList("myapp");
148-
}
149-
}
150-
```
151-
152108
### User Experience
153109

154110
1. User installs and launches the application
@@ -207,28 +163,6 @@ mvn test -Dtest=WindowsSchemeInstallerTest
207163

208164
Tests automatically skip on non-Windows platforms using JUnit's `Assume.assumeTrue()`.
209165

210-
## Known Issues
211-
212-
### Hardcoded Scheme Name
213-
214-
**Issue**: `WindowsPlatform` (lines 86, 102) currently hardcodes the "fiji" scheme instead of querying registered `LinkHandler` plugins.
215-
216-
**Impact**: Only works for Fiji; breaks for other applications.
217-
218-
**Workaround**: None; requires code fix.
219-
220-
**Fix**: See NEXT.md Work Item #1 for the solution.
221-
222-
### Hardcoded OS Checks
223-
224-
**Issue**: `DefaultLinkService.createInstaller()` (lines 119-132) hardcodes OS name checks instead of using `PlatformService`.
225-
226-
**Impact**: Violates plugin architecture.
227-
228-
**Workaround**: None; requires code fix.
229-
230-
**Fix**: See NEXT.md Work Items #2 and #3 for the solution.
231-
232166
## Platform Comparison
233167

234168
### Windows vs. Linux vs. macOS
@@ -239,7 +173,7 @@ Tests automatically skip on non-Windows platforms using JUnit's `Assume.assumeTr
239173
| **Admin Rights Required** | No (HKCU) | No (user .desktop file) | N/A (bundle) |
240174
| **Toggleable at Runtime** | Yes | Yes | No (read-only) |
241175
| **Desktop Icon** | Planned (Start Menu) | Yes (.desktop file) | No (user pins to Dock) |
242-
| **File Extensions** | Planned (Registry) | Planned (.desktop MIME types) | Build-time (Info.plist) |
176+
| **File Extensions** | Yes (Registry) | Yes (.desktop MIME types) | Build-time (Info.plist) |
243177

244178
### Why Runtime Registration on Windows?
245179

@@ -252,34 +186,18 @@ Unlike macOS (where the `.app` bundle is code-signed and immutable), Windows all
252186
- Only writes to `HKEY_CURRENT_USER` (per-user settings)
253187
- Does not modify system-wide settings in `HKEY_LOCAL_MACHINE`
254188
- Only registers URI schemes declared by `LinkHandler` plugins
255-
- Does not expose arbitrary command execution
256-
257-
### Command-Line Injection
258-
259-
The `%1` parameter in the registry command is properly quoted:
260-
```
261-
"C:\Path\To\App.exe" "%1"
262-
```
263-
264-
This prevents command-line injection attacks via malicious URIs.
189+
- Uses proper quoting to avoid exposing arbitrary command execution
265190

266191
## Future Enhancements
267192

268193
1. **Start Menu Shortcut**: Implement desktop icon creation
269-
2. **File Extension Registration**: Register file types in the registry
270-
3. **Scheme Validation**: Validate scheme names against RFC 3986
271-
4. **User Prompts**: Optional confirmation before registering schemes
272-
5. **Uninstallation**: Automatic cleanup on application uninstall
273-
6. **Icon Support**: Associate icons with schemes and file types
194+
2. **Scheme Validation**: Validate scheme names against RFC 3986
195+
3. **User Prompts**: Optional confirmation before registering schemes
196+
4. **Uninstallation**: Automatic cleanup on application uninstall
197+
5. **Icon Support**: Associate icons with file type registrations
274198

275199
## Resources
276200

277201
- [Microsoft URI Scheme Documentation](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767914(v=vs.85))
278202
- [Windows Registry Reference](https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry)
279203
- [RFC 3986 - URI Generic Syntax](https://www.rfc-editor.org/rfc/rfc3986)
280-
281-
## See Also
282-
283-
- [NEXT.md](../NEXT.md) - Planned improvements
284-
- [spec/DESKTOP_INTEGRATION_PLAN.md](../spec/DESKTOP_INTEGRATION_PLAN.md) - Architecture overview
285-
- [spec/IMPLEMENTATION_SUMMARY.md](../spec/IMPLEMENTATION_SUMMARY.md) - Implementation details

0 commit comments

Comments
 (0)