@walldock/agent 0.2.1 → 0.2.2
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/main.js +12 -2
- package/dist/screens/windows.js +1 -1
- package/dist/wallpaper/windows.js +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -75,6 +75,15 @@ async function main() {
|
|
|
75
75
|
const args = process.argv.slice(2);
|
|
76
76
|
// --unlink: remove stored credentials and startup entry
|
|
77
77
|
if (args.includes('--unlink')) {
|
|
78
|
+
// Kill any running background instance first so the user can re-pair immediately
|
|
79
|
+
const bgPid = await (0, pid_1.runningPid)();
|
|
80
|
+
if (bgPid) {
|
|
81
|
+
try {
|
|
82
|
+
process.kill(bgPid);
|
|
83
|
+
}
|
|
84
|
+
catch { /* already dead */ }
|
|
85
|
+
await new Promise(r => setTimeout(r, 600));
|
|
86
|
+
}
|
|
78
87
|
const token = await storage.getDeviceToken();
|
|
79
88
|
if (token) {
|
|
80
89
|
const api = new api_1.AgentApi();
|
|
@@ -105,6 +114,7 @@ async function main() {
|
|
|
105
114
|
}
|
|
106
115
|
catch (err) {
|
|
107
116
|
console.error(`\n${err}`);
|
|
117
|
+
console.error('To re-link: right-click the tray icon → Quit, or run: walldock-agent --unlink');
|
|
108
118
|
process.exit(1);
|
|
109
119
|
}
|
|
110
120
|
const api = new api_1.AgentApi(process.env['WALLDOCK_API_URL'] ?? undefined);
|
|
@@ -201,8 +211,8 @@ async function main() {
|
|
|
201
211
|
return; // sync loop keeps process alive (isTray path)
|
|
202
212
|
}
|
|
203
213
|
// No valid token — need to pair
|
|
204
|
-
if (isDaemon) {
|
|
205
|
-
log('No valid device token found. Run
|
|
214
|
+
if (isDaemon || isTray) {
|
|
215
|
+
log('No valid device token found. Run "walldock-agent" to pair this device.');
|
|
206
216
|
process.exit(1);
|
|
207
217
|
}
|
|
208
218
|
// Interactive pairing
|
package/dist/screens/windows.js
CHANGED
|
@@ -47,7 +47,7 @@ public class MonitorHelper {
|
|
|
47
47
|
[MonitorHelper]::Enumerate() | ForEach-Object { Write-Output $_ }
|
|
48
48
|
`.trim();
|
|
49
49
|
async function listScreensWindows() {
|
|
50
|
-
const { stdout } = await exec('powershell.exe', ['-NoProfile', '-Command', PS_SCRIPT]);
|
|
50
|
+
const { stdout } = await exec('powershell.exe', ['-NoProfile', '-Command', PS_SCRIPT], { windowsHide: true, encoding: 'utf8' });
|
|
51
51
|
const screens = [];
|
|
52
52
|
for (const line of stdout.trim().split(/\r?\n/)) {
|
|
53
53
|
if (!line.trim())
|
|
@@ -53,5 +53,5 @@ public class WallpaperHelper {
|
|
|
53
53
|
"@
|
|
54
54
|
[WallpaperHelper]::Set(${monitorIndex}, '${safePath}')
|
|
55
55
|
`.trim();
|
|
56
|
-
await exec('powershell.exe', ['-NoProfile', '-Command', script]);
|
|
56
|
+
await exec('powershell.exe', ['-NoProfile', '-Command', script], { windowsHide: true, encoding: 'utf8' });
|
|
57
57
|
}
|