BlueGit

timfa posprint

Merge branch 'fix/pos-mime-type'

timfa Tim Falken · pushed by timfa

Authored 2026-07-16 · 4 months ago

Hash
29e79945c172e73254bfc328a1c2147f476efaf0
4 files changed +39 −6
docs/BUILD.md +22 −0
@@ -93,6 +93,28 @@ sudo pacman -S --needed base-devel rust pkgconf openssl libxkbcommon libxcb dbus
93 93 wayland libx11 fontconfig freetype2 libglvnd git rsync
94 94 ```
95 95
96 ### File association (`.pos` → posprint)
97
98 The package installs:
99
100 - `/usr/share/mime/packages/posprint.xml` → MIME type `application/x-posprint` for `*.pos`
101 - `/usr/share/applications/posprint.desktop` → claims that MIME type
102
103 After `pacman -U`, pacman hooks refresh the MIME and desktop databases. To make posprint the **default** opener (double-click):
104
105 ```bash
106 xdg-mime default posprint.desktop application/x-posprint
107 xdg-mime query filetype some.pos # expect: application/x-posprint
108 xdg-mime query default application/x-posprint # expect: posprint.desktop
109 ```
110
111 If `query filetype` still says `text/plain`, the MIME package was not installed or the cache is stale:
112
113 ```bash
114 sudo update-mime-database /usr/share/mime
115 sudo update-desktop-database /usr/share/applications
116 ```
117
96 118 ## Tests before release
97 119
98 120 ```bash
@@ -93,6 +93,28 @@ sudo pacman -S --needed base-devel rust pkgconf openssl libxkbcommon libxcb dbus
93 wayland libx11 fontconfig freetype2 libglvnd git rsync
93 wayland libx11 fontconfig freetype2 libglvnd git rsync
94```
94```
95
95
96### File association (`.pos` → posprint)
97
98The package installs:
99
100- `/usr/share/mime/packages/posprint.xml` → MIME type `application/x-posprint` for `*.pos`
101- `/usr/share/applications/posprint.desktop` → claims that MIME type
102
103After `pacman -U`, pacman hooks refresh the MIME and desktop databases. To make posprint the **default** opener (double-click):
104
105```bash
106xdg-mime default posprint.desktop application/x-posprint
107xdg-mime query filetype some.pos # expect: application/x-posprint
108xdg-mime query default application/x-posprint # expect: posprint.desktop
109```
110
111If `query filetype` still says `text/plain`, the MIME package was not installed or the cache is stale:
112
113```bash
114sudo update-mime-database /usr/share/mime
115sudo update-desktop-database /usr/share/applications
116```
117
96## Tests before release
118## Tests before release
97
119
98```bash
120```bash
docs/FILE-FORMAT.md +2 −1
@@ -3,7 +3,8 @@
3 3 A `.pos` file stores a POS print template: metadata (page settings, title) plus the DSL document body as plain text.
4 4
5 5 **Format:** JSON envelope with a `.pos` extension (human-readable, git-friendly).
6 **MIME type (suggested):** `application/vnd.posprint+json`
6 **MIME type:** `application/x-posprint` (registered via `packaging/mime/posprint.xml`; claimed by `*.pos`)
7
7 8
8 9 ---
9 10
@@ -3,7 +3,8 @@
3A `.pos` file stores a POS print template: metadata (page settings, title) plus the DSL document body as plain text.
3A `.pos` file stores a POS print template: metadata (page settings, title) plus the DSL document body as plain text.
4
4
5**Format:** JSON envelope with a `.pos` extension (human-readable, git-friendly).
5**Format:** JSON envelope with a `.pos` extension (human-readable, git-friendly).
6**MIME type (suggested):** `application/vnd.posprint+json`
6**MIME type:** `application/x-posprint` (registered via `packaging/mime/posprint.xml`; claimed by `*.pos`)
7
7
8
8---
9---
9
10
docs/HELP.md +7 −0
@@ -197,3 +197,10 @@ Receipt: ${DocumentNumber}
197 197 ## `.pos` file format
198 198
199 199 JSON with `version`, `metadata`, and `body` (template source).
200
201 **MIME type:** `application/x-posprint` (extension `*.pos`). On Linux, after installing the package, set posprint as the default opener if needed:
202
203 ```bash
204 xdg-mime default posprint.desktop application/x-posprint
205 xdg-mime query filetype ~/Templates/receipt.pos # should print application/x-posprint
206 ```
@@ -197,3 +197,10 @@ Receipt: ${DocumentNumber}
197## `.pos` file format
197## `.pos` file format
198
198
199JSON with `version`, `metadata`, and `body` (template source).
199JSON with `version`, `metadata`, and `body` (template source).
200
201**MIME type:** `application/x-posprint` (extension `*.pos`). On Linux, after installing the package, set posprint as the default opener if needed:
202
203```bash
204xdg-mime default posprint.desktop application/x-posprint
205xdg-mime query filetype ~/Templates/receipt.pos # should print application/x-posprint
206```
packaging/mime/posprint.xml +8 −5
@@ -1,6 +1,9 @@
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 <mime-type xmlns="http://www.freedesktop.org/stand-alone/xml-mime-type">
3 <comment>POS print template</comment>
4 <glob pattern="*.pos"/>
5 <icon name="posprint"/>
6 </mime-type>
2 <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
3 <mime-type type="application/x-posprint">
4 <comment>POS print template</comment>
5 <comment xml:lang="nl">POS-printsjabloon</comment>
6 <glob pattern="*.pos"/>
7 <icon name="posprint"/>
8 </mime-type>
9 </mime-info>
@@ -1,6 +1,9 @@
1<?xml version="1.0" encoding="UTF-8"?>
1<?xml version="1.0" encoding="UTF-8"?>
2<mime-type xmlns="http://www.freedesktop.org/stand-alone/xml-mime-type">
2<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
3 <comment>POS print template</comment>
3 <mime-type type="application/x-posprint">
4 <glob pattern="*.pos"/>
4 <comment>POS print template</comment>
5 <icon name="posprint"/>
5 <comment xml:lang="nl">POS-printsjabloon</comment>
6</mime-type>
6 <glob pattern="*.pos"/>
7 <icon name="posprint"/>
8 </mime-type>
9</mime-info>