swiftbar-github 1.1.0 → 1.1.1

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 CHANGED
@@ -16,6 +16,6 @@ Download [swiftbar-github.3m.sh](https://cdn.jsdelivr.net/npm/swiftbar-github@la
16
16
 
17
17
  Run `chmod +x swiftbar-github.3m.sh`. Updates resolve through `@latest` on each refresh; downloaded versions are cached. For authentication without `gh`, set `GH_TOKEN` or `GITHUB_TOKEN` in SwiftBar's environment.
18
18
 
19
- Allow notifications for the bundled terminal-notifier in macOS System Settings. Click entries to open them on GitHub.
19
+ Allow notifications for terminal-notifier in macOS System Settings. Click entries or desktop notifications to open them on GitHub; desktop notification clicks are available for five minutes.
20
20
 
21
21
  Use **Mark as read** to clear unread threads by type or reason. This does not complete pending review requests. Option-click the menu to access SwiftBar's hidden controls.
@@ -1,12 +1,12 @@
1
- import { execFile } from "node:child_process";
1
+ import { execFile, spawn } from "node:child_process";
2
2
  import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
3
+ import { createRequire } from "node:module";
3
4
  import { homedir } from "node:os";
4
- import { basename, join } from "node:path";
5
+ import { basename, dirname, join } from "node:path";
5
6
  import { promisify } from "node:util";
6
7
  import { Octokit } from "@octokit/rest";
7
- import nodeNotifier from "node-notifier";
8
8
  const exec = promisify(execFile);
9
- const notifier = new nodeNotifier.NotificationCenter({ withFallback: false });
9
+ const notifier = join(dirname(createRequire(import.meta.url).resolve("node-notifier")), "vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier");
10
10
  const inbox = "https://github.com/notifications";
11
11
  const launcher = process.env.SWIFTBAR_PLUGIN_PATH;
12
12
  const cache = process.env.SWIFTBAR_PLUGIN_CACHE_PATH ||
@@ -71,16 +71,28 @@ async function save(file, values) {
71
71
  }
72
72
  function notify(item) {
73
73
  return new Promise((resolve) => {
74
- const notification = {
75
- title: item.alertTitle,
76
- subtitle: item.repository,
77
- message: item.title,
78
- open: item.url,
79
- sound: "default",
80
- group: item.group,
81
- timeout: false,
82
- };
83
- notifier.notify(notification, (error) => resolve(!error));
74
+ const child = spawn(notifier, [
75
+ "-title",
76
+ item.alertTitle,
77
+ "-subtitle",
78
+ item.repository,
79
+ "-message",
80
+ item.title,
81
+ "-open",
82
+ item.url,
83
+ "-group",
84
+ `github-${item.url}`,
85
+ "-sound",
86
+ "default",
87
+ "-timeout",
88
+ "300",
89
+ ], { detached: true, stdio: "ignore" });
90
+ child.once("error", () => resolve(false));
91
+ child.once("spawn", () => {
92
+ // Record the handoff, not the eventual click or timeout.
93
+ child.unref();
94
+ resolve(true);
95
+ });
84
96
  });
85
97
  }
86
98
  function action(label, args, refresh = false) {
@@ -126,7 +138,6 @@ async function fetchActivity(argument) {
126
138
  repository,
127
139
  title,
128
140
  key: item.html_url,
129
- group: `github-review-${item.html_url}`,
130
141
  alertTitle: "Review requested",
131
142
  };
132
143
  });
@@ -150,7 +161,6 @@ async function fetchActivity(argument) {
150
161
  repository,
151
162
  title,
152
163
  url: item.url,
153
- group: `github-notification-${item.id}`,
154
164
  alertTitle: `GitHub: ${reason}`,
155
165
  reason,
156
166
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swiftbar-github",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "GitHub notifications and review requests in the macOS menu bar",
5
5
  "license": "MIT",
6
6
  "repository": "github:jryom/swiftbar-github",
@@ -27,7 +27,6 @@
27
27
  "devDependencies": {
28
28
  "@biomejs/biome": "^2.5.15",
29
29
  "@types/node": "^26.6.5",
30
- "@types/node-notifier": "^8.0.5",
31
30
  "typescript": "^7.0.2"
32
31
  }
33
32
  }