Page: https://github.com/Rinkaa/Aseprite_OpenInSameWindow
Language: English | 中文
Open files in an existing Aseprite window.
Most users do not need this extension. It is mainly useful when external tools such as Godot invoke aseprite: the launcher can reuse an existing Aseprite instance and open newly requested files in that same instance.
- Python 3
- Download and extract
aseprite-openinsamewindow-<version>.zip. - Copy
aseprite-openinsamewindow.sh(Linux) oraseprite-openinsamewindow.bat(Windows, untested) to the same directory as the Aseprite executable. If you do not want to place it there, you can specify where to find Aseprite later; see below. - Copy
aseprite-openinsamewindow-server.pyfrom the extracted package to the same directory as the.sh/.batfile. It only uses the Python standard library. - In Aseprite, install the extracted
aseprite-openinsamewindow.aseprite-extensionfromEdit > Preferences > Extensions > Add Extension. - Use the
.shor.batwrapper as if it were Aseprite. Files opened through this wrapper will reuse the previous Aseprite instance. - Special usage: pass
--shutdown-serverto the.shor.batwrapper to stop the long-running event server process.
- Run
make packageto create a release package. You can also copy the development files directly to the matching locations described in "Install From A Release Package". - During development, if you have not installed the
.aseprite-extensionthrough Aseprite'sAdd Extensiondialog, you can runaseprite --script extension/aseprite-openinsamewindow-extension.luafor a simple test.
If the wrapper is not in the same directory as the Aseprite executable, it will try to find aseprite from the environment. You can also set ASEPRITE_BIN explicitly. For example, with the .sh wrapper:
ASEPRITE_BIN=/path/to/aseprite ./aseprite-openinsamewindow.sh /path/to/file.asepriteThe default endpoint is 127.0.0.1:21204. To change the port, set ASEPRITE_OPENINSAMEWINDOW_PORT for the server. Because the Lua side has no direct way to read that value, you must also change the PORT value at the top of the Lua file to the same port.
At runtime, the server writes a temporary PID file such as /tmp/aseprite-openinsamewindow-<uid>.pid to record the server process, which helps shut down an old server process.
- If not already running, start a localhost-only WebSocket server process that publishes open-file events. It keeps running after the shell script exits.
- Pass
--shutdown-serverto the shell script to stop the already running server process.
- Pass
- If not already running, start an Aseprite instance. It keeps running after the shell script exits.
- The Aseprite Lua extension starts a WebSocket client and listens for open-file events.
- Each wrapper invocation reuses the existing WebSocket server and sends open-file events to the WebSocket client inside the existing Aseprite instance.
MIT