@hayasaka7/haya-pet 0.3.12 → 0.3.13

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 CHANGED
@@ -7,6 +7,16 @@ All notable changes to HAYA Pet are documented here. This project adheres to
7
7
  > 0.2.0 npm publish; they are listed under 0.2.1, which is the first version that
8
8
  > ships them.
9
9
 
10
+ ## [0.3.13]
11
+
12
+ ### Added
13
+ - **Right-clicking the pet now opens the tray menu.** A right-click used to behave
14
+ like a left-click (wave + fold/unfold the bubbles). It now pops up the same
15
+ menu as the system-tray icon — Show/Hide Pet, Active Sessions, Installed Pets,
16
+ Reset Position, update, Quit — which is far more discoverable than the tray icon
17
+ (often hidden in the Windows overflow). The menu is built from the one pure tray
18
+ model, so both entry points always match. Left-click behaviour is unchanged.
19
+
10
20
  ## [0.3.12]
11
21
 
12
22
  ### Fixed
package/README.md CHANGED
@@ -220,6 +220,7 @@ non-observe mode keeps terminal input native.
220
220
  |---|---|
221
221
  | Single click | Wave and fold or unfold session bubbles. |
222
222
  | Double click | Jump and expand session bubbles. |
223
+ | Right click | Open the same menu as the tray icon (sessions, pets, reset, updates, quit). |
223
224
  | Drag | Move the pet; position is saved. |
224
225
  | Drag corner grip | Resize from 0.5x to 2x; size is saved. |
225
226
  | Double-click grip | Reset to normal size. |
@@ -291,17 +291,15 @@ function loadTrayIcon() {
291
291
  return fileIcon.isEmpty() ? nativeImage.createFromDataURL(TRAY_ICON_DATA_URL) : fileIcon;
292
292
  }
293
293
 
294
- function refreshTrayMenu() {
295
- if (!tray) {
296
- return;
297
- }
298
-
294
+ // Builds the native menu template from the pure tray model. Shared by the tray
295
+ // icon and the pet's right-click context menu so both stay identical.
296
+ function buildTrayMenuTemplate() {
299
297
  const sessions = (runtime?.listSessions() ?? []).map((session) => ({
300
298
  sessionId: session.sessionId,
301
299
  label: `${session.clientDisplayName} · ${session.projectName}`
302
300
  }));
303
301
 
304
- const template = buildTrayMenu({
302
+ return buildTrayMenu({
305
303
  petVisible: petWindow?.isVisible() ?? true,
306
304
  displayMode: positionState.settings.displayMode,
307
305
  attachBubblesToTerminals: positionState.settings.attachBubblesToTerminals,
@@ -310,8 +308,14 @@ function refreshTrayMenu() {
310
308
  pets: pets.map((pet) => ({ id: pet.manifest.id, name: pet.manifest.name })),
311
309
  updateAvailable
312
310
  }).map(toElectronMenuItem);
311
+ }
312
+
313
+ function refreshTrayMenu() {
314
+ if (!tray) {
315
+ return;
316
+ }
313
317
 
314
- tray.setContextMenu(Menu.buildFromTemplate(template));
318
+ tray.setContextMenu(Menu.buildFromTemplate(buildTrayMenuTemplate()));
315
319
  }
316
320
 
317
321
  function toElectronMenuItem(item) {
@@ -425,6 +429,16 @@ function registerRendererHandlers() {
425
429
  }
426
430
  });
427
431
 
432
+ // Right-click on the pet pops up the same menu as the tray icon (built from
433
+ // the one pure tray model), since the tray icon is often buried in the Windows
434
+ // overflow. Fire-and-forget: the native menu is shown and dispatched in main.
435
+ ipcMain.on("haya-pet:show-pet-menu", () => {
436
+ if (!petWindow || petWindow.isDestroyed()) {
437
+ return;
438
+ }
439
+ Menu.buildFromTemplate(buildTrayMenuTemplate()).popup({ window: petWindow });
440
+ });
441
+
428
442
  // The pet moves within the overlay (CSS), so the renderer reports its new
429
443
  // work-area-relative position instead of moving the window.
430
444
  ipcMain.handle("haya-pet:save-pet-position", async (_event, local) => {
@@ -7,6 +7,7 @@ contextBridge.exposeInMainWorld("aiPet", {
7
7
  savePetPosition: (local) => ipcRenderer.invoke("haya-pet:save-pet-position", local),
8
8
  savePetScale: (scale) => ipcRenderer.invoke("haya-pet:save-pet-scale", scale),
9
9
  setMouseIgnore: (ignore) => ipcRenderer.send("haya-pet:set-mouse-ignore", ignore),
10
+ showPetMenu: () => ipcRenderer.send("haya-pet:show-pet-menu"),
10
11
  onConfig: (handler) => ipcRenderer.on("haya-pet:config", (_event, config) => handler(config)),
11
12
  onSessions: (handler) => ipcRenderer.on("haya-pet:sessions", (_event, payload) => handler(payload)),
12
13
  onPetPosition: (handler) => ipcRenderer.on("haya-pet:pet-position", (_event, pos) => handler(pos)),
@@ -192,6 +192,11 @@ function playOneShot(action) {
192
192
  // --- Pointer interaction (click vs drag distinction lives in the controller) ---
193
193
 
194
194
  canvas.addEventListener("pointerdown", (event) => {
195
+ // Only the primary button drives click/drag; right-click pops the context menu
196
+ // (handled below) and must not also fire a wave/toggle or start a drag.
197
+ if (event.button !== 0) {
198
+ return;
199
+ }
195
200
  canvas.setPointerCapture(event.pointerId);
196
201
  // Hold click-through off for the whole press: a drag swaps to the running
197
202
  // frames, whose opaque pixels differ from the grabbed one, so re-running the
@@ -211,6 +216,11 @@ canvas.addEventListener("pointermove", (event) => {
211
216
  });
212
217
 
213
218
  canvas.addEventListener("pointerup", (event) => {
219
+ // Mirror pointerdown: ignore non-primary releases so a right-click never feeds
220
+ // the click controller (its pointerDown was skipped anyway).
221
+ if (event.button !== 0) {
222
+ return;
223
+ }
214
224
  // Click / double-click are delivered asynchronously via onAction; only the
215
225
  // synchronous drag-end is handled here.
216
226
  petPressed = false;
@@ -227,6 +237,15 @@ canvas.addEventListener("pointercancel", () => {
227
237
  animationState = clearDragAction(animationState);
228
238
  });
229
239
 
240
+ // Right-click the pet to open the same menu as the tray icon. The native menu is
241
+ // built and shown in the main process; preventDefault stops Electron's default
242
+ // context menu. Only fires over opaque pet pixels (transparent areas are
243
+ // click-through and the right-click falls to the desktop, like a left-click).
244
+ canvas.addEventListener("contextmenu", (event) => {
245
+ event.preventDefault();
246
+ bridge?.showPetMenu?.();
247
+ });
248
+
230
249
  // --- Resize grip: drag to scale the pet, double-click to reset ---
231
250
 
232
251
  let resizeDrag; // { startScale, startPointer } while a grip drag is active
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hayasaka7/haya-pet",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "type": "module",
5
5
  "description": "Generic AI CLI pet runtime foundation.",
6
6
  "keywords": [