# Window

The vast majority of plugins should be developed using this method. It provides a browser window where you can develop the desired features, and this window will automatically pop up when the user clicks on the plugin.

<figure><img src="https://1590693372-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8ag8XBIM3olHOU7WmBBx%2Fuploads%2Fgit-blob-b8d618997d0dc7e53df2a4b775bb0f4d21e25ed9%2Fimage%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

We can set the window properties by setting the main field in the manifest.json file.

{% code lineNumbers="true" %}

```json
{
    "main": {}
}
```

{% endcode %}

Set the default open link URL for the window:

```json
{
    "main": {
        "url": "index.html"
    }
}
```

Set the default width and height of the window:

```json
{
    "main": {
        "url": "index.html",
        "width": 640,
        "height": 480
    }
}
```

After setting other metadata.json fields, the final code is as follows:

{% tabs %}
{% tab title="manifest.json" %}

```json
{
    "id": "LBCZE8V6LPCKD",
    "version": "1.0.0",
    "name": "Window Plugin",
    "logo": "/logo.png",
    "keywords": [],
    "main":
    {
        "url": "index.html",
        "width": 640,
        "height": 480
    }
}
```

{% endtab %}

{% tab title="index.html" %}

```html
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <script type="text/javascript" src="js/plugin.js"></script>
</head>

<body>
    <div id="message"></div>
</body>
</html>
```

{% endtab %}

{% tab title="plugin.js" %}

```javascript
eagle.onPluginCreate((plugin) => {
    console.log('eagle.onPluginCreate');
    console.log(plugin);
    document.querySelector('#message').innerHTML = `
    <ul>
        <li>id: ${plugin.manifest.id}</li>
        <li>version: ${plugin.manifest.version}</li>
        <li>name: ${plugin.manifest.name}</li>
        <li>logo: ${plugin.manifest.logo}</li>
        <li>path: ${plugin.path}</li>
    </ul>
`;
});

eagle.onPluginShow(() => {
    console.log('eagle.onPluginShow');
});

eagle.onPluginHide(() => {
    console.log('eagle.onPluginHide');
});

eagle.onPluginBeforeExit((event) => {
    console.log('eagle.onPluginBeforeExit');
});
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Check out this sample code!**

Looking for inspiration? Come and explore our sample code; there's a wealth of exciting content waiting for you!

<https://github.com/eagle-app/eagle-plugin-examples/tree/main/Window>
{% endhint %}

{% hint style="info" %}
**Sample code for Multilanguage + Multitheme**

For developers aiming to achieve multilanguage internationalization (i18n), this GitHub project is your best learning companion! Click the link below to explore how to cleverly combine i18n with multitheme design, adding a touch of magic to your application's multilanguage support.

<https://github.com/eagle-app/eagle-plugin-examples/tree/main/i18n+theme>
{% endhint %}

{% hint style="info" %}
Note: You can refer to [this article](https://developer.eagle.cool/plugin-api/tutorial/manifest) to learn about all the configuration methods for manifest.json
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.eagle.cool/plugin-api/get-started/plugin-types/window.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
