hyper-windowtint 0.3.5 → 0.3.7
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/CHANGELOG.md +7 -0
- package/README.md +28 -27
- package/index.js +12 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to `hyper-windowtint` will be documented here.
|
|
|
5
5
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.6] - 2026-05-16
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- README now shows a real screenshot of four Hyper windows in four projects
|
|
12
|
+
(`docs/demo-hero.png`) instead of the placeholder. Image is referenced via
|
|
13
|
+
full GitHub raw URL so it renders on both github.com and npmjs.com.
|
|
14
|
+
|
|
8
15
|
## [0.3.5] - 2026-05-16
|
|
9
16
|
|
|
10
17
|
### Fixed
|
package/README.md
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
# hyper-windowtint
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Colors every Hyper window based on the project folder its active tab is in. Open five Hyper windows against five different projects and you can tell them apart at a glance.
|
|
4
4
|
|
|
5
|
-
Groups
|
|
5
|
+
Groups sessions by project root (the nearest `.git` walked up from cwd, or the raw cwd if no git repo is found), then assigns each project a random color from a curated 12-slot palette for the current Hyper run. The plugin prefers palette slots that aren't already taken by other open projects, so the first 12 distinct projects you open in one Hyper session are guaranteed to get 12 distinct colors. Restart Hyper and colors reshuffle. Shells that emit OSC 7 retint live when you `cd` between projects.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- matching accents on tabs
|
|
9
|
-
- a tiny color-name badge in the top-right corner (e.g. `ROSE`, `TEAL`)
|
|
7
|
+
The plugin paints, in the active project's color:
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
- a thin border around the window
|
|
10
|
+
- a colored top line in the tab bar
|
|
11
|
+
- a subtle gradient tint on the active tab's background
|
|
12
|
+
- an optional uppercase color-name label in the top-right corner (off by default; opt in with `showBadge: true`)
|
|
13
|
+
|
|
14
|
+
The color signal lives on the window, not on individual tabs. Inside a window with multiple tabs, switching to a tab in a different project retints the whole window; switching between same-project tabs leaves the color unchanged. If cwd resolution ever fails entirely, the plugin falls back to the session UID so the window still gets a color.
|
|
12
15
|
|
|
13
16
|
## Screenshots
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
A 5–10s capture of two tabs in different repos plus one `cd` between them
|
|
17
|
-
sells the plugin better than any prose. -->
|
|
18
|
+

|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
Four Hyper windows open against four different projects — each gets its own border color, so a glance at the screen tells you which terminal belongs to which codebase.
|
|
20
21
|
|
|
21
22
|
## Install
|
|
22
23
|
|
|
@@ -71,8 +72,8 @@ module.exports = {
|
|
|
71
72
|
config: {
|
|
72
73
|
windowTint: {
|
|
73
74
|
borderWidth: '3px', // CSS string
|
|
74
|
-
showBadge:
|
|
75
|
-
glow: true, // inner glow effect
|
|
75
|
+
showBadge: false, // optional uppercase color-name label in the corner (default off)
|
|
76
|
+
glow: true, // inner glow effect on the window border
|
|
76
77
|
palette: [ // optional — override the default palette
|
|
77
78
|
{ name: 'red', hex: '#ef4444' },
|
|
78
79
|
{ name: 'green', hex: '#22c55e' },
|
|
@@ -90,28 +91,27 @@ Palette entries must include both a non-empty `name` and a 6- or 8-digit hex col
|
|
|
90
91
|
|
|
91
92
|
**Main process:**
|
|
92
93
|
|
|
93
|
-
- `decorateSessionOptions(options)` runs when a new session is about to be spawned.
|
|
94
|
-
- `onWindow(win)` wraps `win.rpc.emit` so that immediately before Hyper's own `'session add'` IPC reaches the renderer, the plugin emits a `'windowtint:session-seed'` event with `{uid, seed}`. This avoids a uid→
|
|
95
|
-
- `onUnload` clears the caches.
|
|
94
|
+
- `decorateSessionOptions(options)` runs when a new session is about to be spawned. The plugin schedules async cwd resolution through `realpath`, walks upward looking for a `.git` directory or file (if found, that path is the project group; otherwise the raw cwd is the group), and assigns the group a random seed for the current Hyper main-process lifetime. Seed assignment prefers palette indices not already used by other open projects so the first 12 distinct projects get 12 distinct colors. Caches `cwd → project root`, `project root → seed`, and `uid → seed` (with a short expiry).
|
|
95
|
+
- `onWindow(win)` wraps `win.rpc.emit` so that immediately before Hyper's own `'session add'` IPC reaches the renderer, the plugin emits a `'windowtint:session-seed'` event with `{uid, seed}`. This avoids a uid→project color flicker on session creation. The wrap is idempotent per window, and reload-stable state on `win.rpc` lets the persistent wrapper consume seeds from the newest plugin module after hot reloads.
|
|
96
|
+
- `onUnload` clears the caches and restores the original `win.rpc.emit`.
|
|
96
97
|
|
|
97
98
|
**Renderer process:**
|
|
98
99
|
|
|
99
|
-
- `decorateTerm`
|
|
100
|
-
- `decorateConfig` injects CSS that styles `.hyper_main
|
|
101
|
-
- A `window.rpc.on('windowtint:session-seed', ...)` listener (installed lazily by the middleware and removed on renderer unload) caches `uid → seed`. If a seed
|
|
102
|
-
- `getTabProps` and `decorateTab` add a small color accent to each tab.
|
|
100
|
+
- `decorateTerm` registers an OSC 7 handler on each tab's xterm instance. When a shell reports a new cwd, the renderer asks the main process for that cwd's current project-group seed and retints.
|
|
101
|
+
- `decorateConfig` injects CSS that styles `.hyper_main` (window border + glow), the tab bar's top line, and the active tab's background gradient using CSS custom properties (`--tint-color`, `--tint-glow`, `--tint-tab-bg`, `--tint-name`).
|
|
102
|
+
- A `window.rpc.on('windowtint:session-seed', ...)` listener (installed lazily by the middleware and removed on renderer unload) caches `uid → seed`. If a seed arrives after the session has already been tinted, the active session retints immediately.
|
|
103
103
|
- Redux middleware listens for `SESSION_ADD` and `SESSION_SET_ACTIVE`, looks up the cached seed by uid (falls back to the uid itself), maps it to the palette, and writes the resulting color to the root element's CSS variables.
|
|
104
104
|
|
|
105
105
|
## Project grouping
|
|
106
106
|
|
|
107
107
|
Color assignment is intentionally not permanent. The grouping rules are:
|
|
108
108
|
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
- After restarting Hyper,
|
|
109
|
+
- Sessions whose cwd resolves to the same project root (nearest `.git`, or the raw cwd if there's no repo) share a color for the current Hyper run.
|
|
110
|
+
- The window's visible color follows whichever tab is currently active. Switching active tab to a different project retints the window; switching to a same-project tab leaves it alone.
|
|
111
|
+
- After restarting Hyper, projects can receive different colors.
|
|
112
112
|
- If Hyper does not provide a cwd, the plugin falls back to the session UID.
|
|
113
113
|
|
|
114
|
-
Live
|
|
114
|
+
Live retinting after `cd` requires OSC 7 cwd reporting from the shell. Many modern prompts/shell integrations already emit it; if yours does not, the color is set when a tab is created and stays put until you switch active tabs or restart Hyper.
|
|
115
115
|
|
|
116
116
|
The plugin uses two custom Hyper RPC event names internally: `windowtint:session-seed` and `windowtint:cwd-change`. This depends on Hyper's current runtime RPC passthrough for arbitrary event names.
|
|
117
117
|
|
|
@@ -160,10 +160,11 @@ osc7_cwd
|
|
|
160
160
|
|
|
161
161
|
## Roadmap
|
|
162
162
|
|
|
163
|
-
1. **
|
|
164
|
-
2. **
|
|
165
|
-
3. **
|
|
166
|
-
4. **
|
|
163
|
+
1. **Per-tab outlines for inactive tabs.** Today the color signal is window-level (whichever tab is active). The original plan was to also outline each tab in the tab bar with its own project color, but Hyper 3.x's Tab component drops most plugin-injected props, so it would need a renderer-side DOM observer approach. Deferred until that's worth building.
|
|
164
|
+
2. **Optional color labels.** Expose the current in-memory project group color so helper scripts can find matching windows without making the assignment permanent.
|
|
165
|
+
3. **Admin/sudo override.** Force red for elevated shells (steal this from `hyperborder`'s `adminBorderColors`).
|
|
166
|
+
4. **OKLCH-spaced palette generator** for any N colors with guaranteed perceptual distinctness.
|
|
167
|
+
5. **Tests.** Pure-function tests for `hashToIndex`, `parseOsc7Cwd`, `readUserConfig`, and `withAlpha`.
|
|
167
168
|
|
|
168
169
|
## License
|
|
169
170
|
|
package/index.js
CHANGED
|
@@ -4,22 +4,21 @@
|
|
|
4
4
|
* hyper-windowtint
|
|
5
5
|
*
|
|
6
6
|
* Assigns each Hyper project group an ephemeral random color from a curated
|
|
7
|
-
* palette, then paints the window border, tab
|
|
8
|
-
*
|
|
7
|
+
* 12-color palette, then paints the window border, the tab bar's top line,
|
|
8
|
+
* and the active tab's background gradient in that color. Optionally shows
|
|
9
|
+
* the color's name in the top-right corner (`config.windowTint.showBadge`).
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* walking up from cwd to the nearest `.git`; if none, the raw cwd is used.
|
|
18
|
-
* Falls back to session UID if cwd never arrives.
|
|
11
|
+
* Groups sessions by the project root of the session's cwd, walking up to
|
|
12
|
+
* the nearest `.git` directory or file; if none, the raw cwd is the group.
|
|
13
|
+
* Each project root gets a random seed for the current Hyper main-process
|
|
14
|
+
* lifetime — seeds prefer palette slots not already in use by other open
|
|
15
|
+
* projects, so the first 12 distinct projects get 12 distinct colors.
|
|
16
|
+
* Restarting Hyper reassigns colors. Falls back to session UID if cwd
|
|
17
|
+
* resolution fails entirely.
|
|
19
18
|
*
|
|
20
19
|
* This module is loaded in BOTH Hyper processes. decorateSessionOptions /
|
|
21
20
|
* onWindow / onUnload run in main; decorateConfig / middleware / decorateTerm
|
|
22
|
-
* /
|
|
21
|
+
* / onRendererUnload run in renderer. The two sides communicate via
|
|
23
22
|
* win.rpc — we piggyback a `windowtint:session-seed` event onto the normal
|
|
24
23
|
* `session add` rpc emit so the renderer has the project-group seed before
|
|
25
24
|
* SESSION_ADD reaches the Redux store (no uid→project color flicker).
|
|
@@ -81,7 +80,7 @@ function withAlpha(hex, alpha) {
|
|
|
81
80
|
let userOpts = {
|
|
82
81
|
palette: DEFAULT_PALETTE,
|
|
83
82
|
borderWidth: '3px',
|
|
84
|
-
showBadge:
|
|
83
|
+
showBadge: false,
|
|
85
84
|
glow: true,
|
|
86
85
|
};
|
|
87
86
|
|
package/package.json
CHANGED