zudo-text

検索したい単語を入力

いつでも検索バーを開ける

Device Identity

The device commands manage a per-machine display name stored in app_config_dir()/device.json. 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-app/src/commands/device.rs

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_config_dir>/device.json 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:

NameTypeDescription
namestringNew 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_config_dir>/device.json, 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_config_dir>/device.json. 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();