@walldock/agent 0.2.6 → 0.2.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.
Files changed (2) hide show
  1. package/dist/startup.js +9 -15
  2. package/package.json +1 -1
package/dist/startup.js CHANGED
@@ -112,24 +112,18 @@ async function unregisterMacOS() {
112
112
  await fs.unlink(PLIST_PATH).catch(() => undefined);
113
113
  }
114
114
  // ─── Windows ─────────────────────────────────────────────────────────────────
115
- const REG_KEY = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';
116
- const REG_VALUE = 'WalldockAgent';
117
- // VBScript launcher: runs walldock-agent.cmd silently (windowStyle=0 = hidden).
118
- // Stored in %APPDATA%\walldock\ so it survives package updates — the .cmd
119
- // wrapper always resolves to whichever version is currently installed.
120
- const VBS_PATH = path.join(process.env['APPDATA'] ?? os.homedir(), 'walldock', 'launch-agent.vbs');
115
+ // Use the per-user Startup folder — always writable, no registry or admin needed.
116
+ const WIN_STARTUP_DIR = path.join(process.env['APPDATA'] ?? os.homedir(), 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup');
117
+ const WIN_VBS_PATH = path.join(WIN_STARTUP_DIR, 'walldock-agent.vbs');
121
118
  async function registerWindows() {
122
119
  const binPath = await resolveGlobalBin();
123
- await fs.mkdir(path.dirname(VBS_PATH), { recursive: true });
124
- // windowStyle=0 = hidden, WaitOnReturn=False
125
- await fs.writeFile(VBS_PATH, `CreateObject("WScript.Shell").Run """${binPath}"" --tray", 0, False\n`, 'utf8');
126
- const wscript = path.join(process.env['SystemRoot'] ?? 'C:\\Windows', 'System32', 'wscript.exe');
127
- const cmd = `"${wscript}" "${VBS_PATH}"`;
128
- await exec('reg', ['add', REG_KEY, '/v', REG_VALUE, '/t', 'REG_SZ', '/d', cmd, '/f'], { windowsHide: true, encoding: 'utf8' });
120
+ // windowStyle=0 = hidden, WaitOnReturn=False no console window at login
121
+ await fs.writeFile(WIN_VBS_PATH, `CreateObject("WScript.Shell").Run """${binPath}"" --tray", 0, False\n`, 'utf8');
129
122
  }
130
123
  async function unregisterWindows() {
131
- await exec('reg', ['delete', REG_KEY, '/v', REG_VALUE, '/f'], { windowsHide: true, encoding: 'utf8' }).catch(() => undefined);
132
- await fs.unlink(VBS_PATH).catch(() => undefined);
124
+ await fs.unlink(WIN_VBS_PATH).catch(() => undefined);
125
+ // Clean up old registry entry left by earlier versions
126
+ await exec('reg', ['delete', 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', 'WalldockAgent', '/f'], { windowsHide: true, encoding: 'utf8' }).catch(() => undefined);
133
127
  }
134
128
  // ─── Linux ───────────────────────────────────────────────────────────────────
135
129
  const SYSTEMD_USER_DIR = path.join(os.homedir(), '.config', 'systemd', 'user');
@@ -208,7 +202,7 @@ function startupDescription() {
208
202
  if (process.platform === 'darwin')
209
203
  return `LaunchAgent at ${PLIST_PATH}`;
210
204
  if (process.platform === 'win32')
211
- return `Registry Run key → wscript launcher at ${VBS_PATH}`;
205
+ return `Startup folder: ${WIN_VBS_PATH}`;
212
206
  return `systemd user service (or ${DESKTOP_PATH})`;
213
207
  }
214
208
  /** Returns the resolved global bin path, or null if not globally installed. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walldock/agent",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Walldock desktop agent — sync wallpapers across all your screens",
5
5
  "license": "MIT",
6
6
  "main": "dist/main.js",