Expand description
File-manager icon registration for .devprune.json.
The target here is the OS file manager, not the editor. What is actually achievable differs per platform, and this module is deliberate about saying so rather than implying more than it does:
- Linux — a real, complete registration. A
shared-mime-infopackage declares the glob*.devprune.jsonasapplication/x-devprune, and matching icons go into the hicolor theme. Nautilus, Dolphin, Thunar, Nemo and PCManFM all honour this. - Windows — Explorer resolves a file’s icon from the last extension only, so
*.devprune.jsonis indistinguishable from any other.jsonto it. Claiming the icon would mean claiming every JSON file on the machine, which is not ours to take. The config folder gets its own icon viadesktop.ini; individual files keep the system JSON icon. - macOS — a UTI has to be exported by an application bundle’s
Info.plist, and a single CLI binary is not a bundle. Not supported.
Editors are handled by printing a snippet the user can paste; nothing here edits an editor’s settings file.
Everything written lands in either dev-prune’s own config directory or the user’s XDG data directory. PATH, shell startup files and the binary are untouched.
Constants§
- EMBEDDED_
ICO_ BYTES - EMBEDDED_
MIME_ ICONS - Mimetype icons, one per hicolor size directory. Downscaled from
assets/icon.pngand shipped under the same Apache-2.0 licence as the rest of the repository — seeassets/README.md. - EMBEDDED_
PNG_ BYTES - The 256px icon doubles as the config-folder icon on Linux.
- EMBEDDED_
SCHEMA_ BYTES - MIME_
ICON_ NAME - Icon name derived from the MIME type, as the icon-naming spec requires: the type with
its
/replaced by-. A file manager looks up exactly this name and no other. - MIME_
TYPE - The MIME type
*.devprune.jsonis registered as.
Functions§
- is_
registered - Whether everything
sync_app_directorywrites is already on disk. - mime_
package_ xml - The XDG MIME package describing the glob.
- run_
install - Register custom file icon associations for
*.devprune.json. - sync_
app_ directory - Write the icon assets and JSON Schema into the config directory, then register the file type with the OS file manager as far as the platform allows.
- unregister_
file_ type - Undo
register_file_type. Called bydevp uninstall; a no-op off Linux.