Device Identity
The device commands manage a per-machine display name stored in app_. This name identifies the local machine in cloud sync conflict resolution and the sync UI — it is never shared with other users directly.
Source: tauri-
Commands
device_get_name
Get the current device name, if set.
const name = await invoke<string | null>('device_get_name');Parameters: none
Returns: string if a name has been set, null if no device name exists yet.
Storage: Reads <app_ as { "name": "..." }. Returns null if the file is missing or has no name field.
device_set_name
Set or update the device name.
await invoke('device_set_name', { name: 'MacBook Pro' });Parameters:
| Name | Type | Description |
|---|---|---|
name | string | New device name. Must be non-empty and non-whitespace. |
Returns: null on success. Throws a string error if name is blank or if the write fails.
Behavior: Writes { "name": "<name>" } to <app_, creating the file if it does not exist.
device_clear_name
Remove the stored device name.
await invoke('device_clear_name');Parameters: none
Returns: null on success. Throws a string error if the delete fails (but not if the file was never set — clearing a non-existent name is a no-op).
Behavior: Deletes <app_. Subsequent device_get_name calls return null.
Bridge Facade (bridge.device)
// Get the current device name
const name = await bridge.device.getName(); // string | null
// Set a new name
await bridge.device.setName('MacBook Pro');
// Clear the name
await bridge.device.clearName();