# Electron → Tauri v2 Migration (Current State)

## Supported widget types

Only these widget types are currently supported:

- `text`
- `web`

Image widgets are removed.

---

## Project structure

```text
desktop-widgets/
├── src-tauri/
│   ├── src/
│   │   └── main.rs
│   ├── capabilities/
│   │   └── default.json
│   ├── Cargo.toml
│   ├── build.rs
│   └── tauri.conf.json
├── renderer/
│   └── text.html
└── widgets/
    ├── my-text-widget/
    │   └── config.json
    └── my-web-widget/
        └── config.json
```

---

## config.json fields

### `text` widget

```json
{
  "type": "text",
  "width": 300,
  "height": 400,
  "enabled": true,
  "display": 0,
  "x": 100,
  "y": 50,
  "text": "Hello",
  "fontSize": 14,
  "color": "#ffffff",
  "opacity": 0.95
}
```

### `web` widget

```json
{
  "type": "web",
  "width": 1000,
  "height": 800,
  "enabled": true,
  "display": 1,
  "x": 0,
  "y": 10,
  "url": "https://example.com"
}
```

Removed config fields:

- `row`
- `background`

---

## Key API mapping

| Electron | Tauri v2 |
|---|---|
| `new BrowserWindow({...})` | `WebviewWindowBuilder::new(app, label, url)` |
| `frame: false` | `.decorations(false)` |
| `transparent: true` | `.transparent(true)` |
| `skipTaskbar: true` | `.skip_taskbar(true)` |
| `type: "desktop"` | `.always_on_bottom(true)` |
| `win.setIgnoreMouseEvents(true)` | `window.set_ignore_cursor_events(true)` |
| `win.loadURL(url)` | `WebviewUrl::External(url.parse()?)` |
| `screen.getAllDisplays()` | `app.available_monitors()` |

---

## Getting started

```bash
cargo tauri dev
cargo tauri build
```
