@gjsify/terminal-native 0.4.42 → 0.4.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @gjsify/terminal-native
|
|
2
|
+
|
|
3
|
+
Optional native Vala bridge for real terminal support on GJS: `isatty` via `Posix.isatty`, terminal size via `ioctl(TIOCGWINSZ)`, raw mode via `termios`, and `SIGWINCH` resize events via `GjsifyTerminal.ResizeWatcher`. When installed, this package enhances `@gjsify/tty` and `@gjsify/process` with correct terminal behaviour; without it those packages fall back to environment variables and GLib defaults.
|
|
4
|
+
|
|
5
|
+
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
This package is loaded automatically by `@gjsify/tty` and `@gjsify/process` when present. Install it to enable accurate terminal detection and raw mode in your GJS CLI app:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
gjsify install @gjsify/terminal-native
|
|
13
|
+
|
|
14
|
+
# npm or yarn also work:
|
|
15
|
+
npm install @gjsify/terminal-native
|
|
16
|
+
yarn add @gjsify/terminal-native
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// Consumed via @gjsify/tty / @gjsify/process — no direct use needed.
|
|
23
|
+
// For low-level access:
|
|
24
|
+
import { hasNativeTerminal, nativeTerminal } from '@gjsify/terminal-native';
|
|
25
|
+
|
|
26
|
+
if (hasNativeTerminal()) {
|
|
27
|
+
const term = nativeTerminal!.Terminal;
|
|
28
|
+
console.log('stdout is tty:', term.is_tty(1));
|
|
29
|
+
const [ok, rows, cols] = term.get_size(1);
|
|
30
|
+
if (ok) console.log(`${cols}x${rows}`);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Ships as a prebuilt `.so` + `.typelib` for `linux-x86_64`.
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/terminal-native",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.44",
|
|
4
4
|
"description": "Optional Vala/GObject bridge providing Posix.isatty(), ioctl(TIOCGWINSZ), termios raw-mode and SIGWINCH for GJS. Enhances @gjsify/tty and @gjsify/process with correct terminal behaviour when installed.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/esm/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@girs/gobject-2.0": "2.88.0-4.0.4"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@gjsify/cli": "^0.4.
|
|
59
|
+
"@gjsify/cli": "^0.4.44",
|
|
60
60
|
"@ts-for-gir/cli": "^4.0.4",
|
|
61
61
|
"@types/node": "^25.9.1",
|
|
62
62
|
"typescript": "^6.0.3"
|