Skip to content

All your computers and your phone/iPhone, working as one desk. Screens, apps, files, clipboard, calls, texts, notifications, mouse and keyboard, shared between Mac, Windows, Linux , Android, Web and ios / ipados . Free and open source. No account, no cloud, and no shared network needed.

3.3.2: quiet automatic folder mount (#415), Photos copy on Electron 44 (#414), desktop selection on Windows (#410)

inukaasith306dd41ce9e4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8e776241..7dba9fc7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,15 @@ Everyone who sent code, reported a problem or tested is thanked under their vers
reconnecting, Bluetooth in the background and Bluetooth-only pairing work. The Windows helper
reports the advertising state as Windows does, retries an aborted one with a growing pause, and
stops after five aborts in a row. Macs are unchanged.
+- **Windows: "Location is not available" for Z:\ at every phone connect** (#415): with the phone's
+ shared folder set to mount by itself, each connect opened Explorer on its drive, and Windows said
+ the drive was unavailable when the phone's server didn't answer yet. The automatic mount now maps
+ it quietly; Open still shows it. Mac and Linux the same (no Finder or file manager window each time).
+- **Photos › Copy did nothing on the computer** (#414): Electron 44 took out the call it used; the
+ picture goes on the clipboard as every other picture does. Pictures sent from TwinDesk Web too.
+- **Windows: copying files selected on the desktop with the copy shortcut** (#410): the desktop's
+ selection is read through a typed call to Windows' shell, as the late-bound one could fail and
+ gave nothing to copy. When it can't be read, the log says why.
## 3.3.1
diff --git a/shared/foldershare.js b/shared/foldershare.js
index 3ac56ffa..7c9d59bb 100644
--- a/shared/foldershare.js
+++ b/shared/foldershare.js
@@ -146,9 +146,12 @@ class FolderShare extends EventEmitter {
return name.replace(/[/:\\"<>|?*%#]/g, ' ').replace(/\s+/g, ' ').trim().slice(0, 60) || 'Phone';
}
+ // Open waiting for Wi-Fi Direct opens the folder once mounted; the automatic mount of a phone
+ // that shares one (shareMount, at every connect) maps it quietly: no file manager window each
+ // time, nor Windows' "Location is not available" when the phone's server isn't answering yet (#415).
_auto() {
if (this.offer && this.wantMount && !this.mountPath && !this.busy && this._ctx()) return this.mount();
- if (this.offer && this.settings.shareMount && !this.mountPath && !this.busy && this._ctx()) this.mount();
+ if (this.offer && this.settings.shareMount && !this.mountPath && !this.busy && this._ctx()) this.mount({ quiet: true });
}
// Cable in or out moves the session (a new address): the phone sends its offer again then; this
@@ -165,9 +168,9 @@ class FolderShare extends EventEmitter {
// ---- the phone's folder here ----
- async mount() {
+ async mount({ quiet = false } = {}) {
if (this.busy) return;
- if (this.mountPath) return this.reveal();
+ if (this.mountPath) return quiet ? undefined : this.reveal();
const c = this.hub.phone;
if (c && c.transport === 'ble' && this.offerBle && this.wifi) {
// Wi-Fi Direct first: the phone offers it again there, and _auto mounts it then.
@@ -200,7 +203,7 @@ class FolderShare extends EventEmitter {
this.mountPort = local;
this.mountPath = await this.mounter.mount(url, { user: 'twindesk', password: secret, port: local, host: '127.0.0.1', volume: name });
this._set('', '');
- this.reveal();
+ if (!quiet) this.reveal();
} catch (e) {
this._set('', `Couldn’t open it: ${String(e.message).split('\n')[0]}`);
if (this.wifi) this.wifi(false);
diff --git a/shared/phonehub.js b/shared/phonehub.js
index d6f7ac0e..04fb20bc 100644
--- a/shared/phonehub.js
+++ b/shared/phonehub.js
@@ -274,7 +274,9 @@ class PhoneHub extends EventEmitter {
copyImage(data) {
const img = photoImage(data);
if (!img) return false;
- require('electron').clipboard.writeImage(img);
+ // Electron 44 has no clipboard.writeImage (#414): clipimage.js writes a ClipboardItem there.
+ const { writeClipImage } = require('./clipimage.js');
+ writeClipImage(require('electron').clipboard, img, img.toPNG()).catch((e) => console.warn('[hub] copy picture:', e.message));
return true;
}
diff --git a/shared/test/foldershare-quiet.js b/shared/test/foldershare-quiet.js
new file mode 100644
index 00000000..21a76146
--- /dev/null
+++ b/shared/test/foldershare-quiet.js
@@ -0,0 +1,26 @@
+// TwinDesk — Copyright (C) 2026 inukaasith. GPL-3.0, see LICENSE.
+// shared/foldershare.js: the automatic mount of a phone's shared folder (shareMount, at every connect)
+// maps it without opening the file manager; Open does open it (#415: Explorer on Z:\ at each connect,
+// "Location is not available" when the phone's server wasn't answering yet).
+// Run: node shared/test/foldershare-quiet.js
+'use strict';
+
+const assert = require('assert');
+const { FolderShare } = require('../foldershare.js');
+
+(async () => {
+ const revealed = [];
+ const mounter = { mount: async () => 'Z:', mountedAt: async () => 'Z:', unmount: async () => {}, reveal: (at) => revealed.push(at) };
+ const app = { hub: { shareMount: true, shareServe: false }, drive: { folders: [] } };
+ const hub = { settings: app.hub, getSettings: () => app, phone: { deviceId: 'PHONE', address: '127.0.0.2', transport: 'wifi' }, server: { sendToClient() {} }, save() {} };
+ const fsh = new FolderShare(hub, { mounter, defaultFolder: '/tmp', tls: () => null });
+ fsh._proxy = async (to) => (to ? 50000 : 0);
+ fsh.onOffer({ on: true, port: 4000, secret: 'a'.repeat(32), name: 'POCO', cert: 'A'.repeat(120) });
+ await new Promise((r) => setTimeout(r, 20));
+ assert.strictEqual(fsh.mountPath, 'Z:', 'mounted by itself');
+ assert.deepStrictEqual(revealed, [], 'no file manager for the automatic mount');
+ await fsh.act('open');
+ assert.deepStrictEqual(revealed, ['Z:'], 'Open shows it');
+ console.log('foldershare-quiet: ok');
+ process.exit(0);
+})().catch((e) => { console.error(e); process.exit(1); });
diff --git a/shared/web/webwire.js b/shared/web/webwire.js
index f9ff4c5b..93e22645 100644
--- a/shared/web/webwire.js
+++ b/shared/web/webwire.js
@@ -98,7 +98,7 @@ function startWeb(o) {
onImage: (file) => {
const { nativeImage, clipboard } = require('electron');
const img = nativeImage.createFromPath(file);
- if (!img.isEmpty()) clipboard.writeImage(img);
+ if (!img.isEmpty()) require('../clipimage.js').writeClipImage(clipboard, img, img.toPNG()).catch((e) => console.warn('[web] picture:', e.message));
},
say: (title, body) => o.say(title, body),
capture, camRecv, notifSource: o.notifs || null, devLocal: o.devLocal || null,
diff --git a/windows-helper/src/Shell.cs b/windows-helper/src/Shell.cs
index a7371765..666377dc 100644
--- a/windows-helper/src/Shell.cs
+++ b/windows-helper/src/Shell.cs
@@ -87,9 +87,39 @@ namespace MacShare
return null;
}
+ // IShellWindows, typed: late-bound FindWindowSW (an out argument through IDispatch) can fail
+ // and left the desktop's selection empty (#410). The slots before FindWindowSW are only
+ // there to keep the vtable's order; they're never called.
+ [ComImport, Guid("85CB6900-4D95-11CF-960C-0080C7F4EE85"), InterfaceType(ComInterfaceType.InterfaceIsDual)]
+ interface IShellWindows
+ {
+ void _Count(); void _Item(); void _NewEnum(); void _Register(); void _RegisterPending();
+ void _Revoke(); void _OnNavigate(); void _OnActivated();
+ [PreserveSig]
+ int FindWindowSW(ref object pvarloc, ref object pvarlocRoot, int swClass, out int phwnd, int swfwOptions,
+ [MarshalAs(UnmanagedType.IDispatch)] out object ppdispOut);
+ }
+
+ static bool deskWarned;
+
// The desktop's own view: IShellWindows.FindWindowSW(CSIDL_DESKTOP, SWC_DESKTOP, SWFO_NEEDDISPATCH).
static object DesktopView(object windows)
{
+ try
+ {
+ IShellWindows sw = windows as IShellWindows;
+ if (sw != null)
+ {
+ object loc = 0, root = null, disp;
+ int hwnd;
+ if (sw.FindWindowSW(ref loc, ref root, 8, out hwnd, 1, out disp) == 0 && disp != null)
+ {
+ object d = Get(disp, "Document");
+ if (d != null) return d;
+ }
+ }
+ }
+ catch (Exception e) { if (!deskWarned) { deskWarned = true; try { Console.Error.WriteLine("[files] the desktop's view, typed: " + e.Message); } catch (Exception) { } } }
try
{
object[] args = new object[] { 0, null, 8, 0, 1 }; // pvarloc = CSIDL_DESKTOP, swClass = SWC_DESKTOP, phwnd, SWFO_NEEDDISPATCH
@@ -98,7 +128,11 @@ namespace MacShare
object w = windows.GetType().InvokeMember("FindWindowSW", BindingFlags.InvokeMethod, null, windows, args, new ParameterModifier[] { mod }, null, null);
return Get(w, "Document");
}
- catch (Exception) { return null; }
+ catch (Exception e)
+ {
+ try { Console.Error.WriteLine("[files] no view of the desktop, its selected files can't be read: " + e.Message); } catch (Exception) { }
+ return null;
+ }
}
// The files selected in the Explorer window (or on the desktop) in front; frontExplorer =