@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.
- package/dist/startup.js +9 -15
- 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
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
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
|
-
|
|
124
|
-
|
|
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
|
|
132
|
-
|
|
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 `
|
|
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. */
|