A better offline editor for Scratch 3.
Go to file
2024-06-14 17:48:14 -05:00
.github Hopefully fix macOS release workflow 2024-03-03 18:57:56 -06:00
art Add Discord Rich Presence Support (#1000) 2024-05-24 20:48:25 -05:00
build
debian
docs icons for linux 2024-06-14 03:22:31 -05:00
extensions@2924d00687 Update dependencies 2024-05-28 14:10:49 -05:00
linux-files Add scratch keyword to linux .desktop file 2024-06-14 17:48:14 -05:00
release-automation Add type hint comment 2024-04-06 15:28:00 -05:00
scripts Update packager 2024-05-28 12:56:46 -05:00
src-main Update translations 2024-06-02 14:20:03 -05:00
src-preload Detect Flatpak permission errors on drag and drop (#1004) 2024-05-27 22:42:51 -05:00
src-protocol-error/legacy-file Update legacy file protocol error pages 2024-05-22 21:50:23 -05:00
src-renderer Disable rich presence option in MAS and Snap, and add docs link 2024-05-31 02:08:31 -05:00
src-renderer-webpack/editor Add desktop settings button in more obvious spot 2024-05-24 22:17:25 -05:00
store-listings Update translations 2024-05-12 23:00:49 -05:00
.browserslistrc
.gitignore Modernize macOS notarization and signing 2024-03-03 14:10:38 -06:00
.gitmodules Use new screenshots from TurboWarp/desktop-screenshots 2024-02-17 17:44:07 -06:00
changelog.md Release 1.12.3 2024-06-02 01:08:48 -05:00
LICENSE
package-lock.json 1.12.3 2024-06-02 00:19:35 -05:00
package.json Add scratch keyword to linux .desktop file 2024-06-14 17:48:14 -05:00
README.md Document how to fix Linux sandbox errors for development 2024-05-15 18:10:42 -05:00
webpack.config.js Use no-eval source maps instead 2024-05-15 19:34:34 -05:00

TurboWarp Desktop

TurboWarp as a desktop app.

If you're looking for downloads, head to: https://desktop.turbowarp.org/

Licensed under the GPLv3.0. See LICENSE for more information.

Parts of this repository are based on LLK/scratch-desktop.

Website

The website source code is in the docs folder.

Development

We use submodules, so clone using:

git clone --recursive https://github.com/TurboWarp/desktop turbowarp-desktop

or run this after cloning:

git submodule init
git submodule update

Install dependencies using:

npm ci

Then fetch extra library, packager, and extension files using:

npm run fetch

Repeat the three previous sets of commands every time you pull changes from GitHub.

Due to the security requirements mandated by custom extensions existing, our desktop app is significantly more complicated than Scratch's.

  • src-main is what runs in Electron's main process. There is no build step; this code is included as-is. src-main/entrypoint.js is the entry point to the entire app.
  • src-renderer-webpack runs in an Electron renderer process to make the editor work. This is built by webpack as dist-renderer-webpack.
  • src-renderer also runs in an Electron renderer process, but without webpack. This is used for things like the privacy policy window.
  • src-preload runs as preload scripts in an Electron renderer process. They export glue functions to allow renderer and main to talk to each other in a somewhat controlled manner.
  • dist-library-files and dist-extensions contain additional static resources managed by npm run fetch

To build the webpack portions in src-renderer-webpack for development builds, run this:

npm run webpack:compile

You can also run this instead for source file changes to immediately trigger rebuilds:

npm run webpack:watch

Once you have everything compiled and fetched, you are ready to package it up for Electron. For development, start a development Electron instance with:

npm run electron:start

In Linux, The app icon won't work in the development version, but it will work in the packaged version.

We've found that development can work pretty well if you open two terminals side-by-side and run npm run webpack:watch in one and npm run electron:start in the other. You can refresh the windows with ctrl+R or cmd+R for renderer file changes to apply, and manually restart the app for main file changes to apply.

Linux sandbox helper error

On some Linux distributions, Electron will crash with the message The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/.../turbowarp-desktop/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.. Notably we have seen this happen on Debian 10 and earlier and Ubuntu 24.04 and later.

For development, you can run these commands to enable unprivileged user namespaces until you reboot:

# Enable unprivileged user namespaces.
sudo sysctl -w kernel.unprivileged_userns_clone=1

# Stop AppArmor from preventing unprivileged user namespace creation by default.
# If your distribution does not use AppArmor then you can ignore the error.
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

There are ways to make this persist until the next reboot too but we don't think you should be making permanent kernel configuration changes just to develop this app. This error won't happen in the final .deb package, Flathub, or Snap Store releases.

Final production-ready builds

The development version of the app will be larger and slower than the final release builds.

Build an optimized version of the webpack portions with:

npm run webpack:prod

Then to package up the final Electron binaries, use either our build script release-automation/build.js (see release-automation/README.md) or the electron-builder CLI. Either way the final builds are saved in the dist folder. Here are some examples using the electron-builder CLI directly:

# You can also do manual builds with electron-builder's CLI, for example:
# Windows installer
npx electron-builder --windows nsis --x64
# macOS DMG
npx electron-builder --mac dmg --universal
# Linux Debian
npx electron-builder --linux deb

You can typically only package for a certain operating system while on that operating system.

Advanced customizations

TurboWarp Desktop lets you configure custom JS and CSS without rebuilding the app.

Find TurboWarp Desktop's data path by using the list below or by clicking "?" in the top right corner, then "Desktop Settings", then "Open User Data", then opening the highlighted folder, or refer to this list:

  • Windows (except Microsoft Store): %APPDATA%/turbowarp-desktop
  • Microsoft Store: Open %LOCALAPPDATA%/Packages, find the folder with the word TurboWarpDesktop in it, then open LocalCache/Roaming/turbowarp-desktop
  • macOS (except Mac App Store): ~/Library/Application Support/turbowarp-desktop
  • Mac App Store: ~/Library/Containers/org.turbowarp.desktop/Data/Library/Application Support/turbowarp-desktop (note that the org.turbowarp.desktop part may appear as TurboWarp in Finder)
  • Linux (except Flatpak and Snap): ~/.config/turbowarp-desktop
  • Linux (Flatpak): ~/.var/app/org.turbowarp.TurboWarp/config/turbowarp-desktop
  • Linux (Snap): ~/snap/turbowarp-desktop/current/.config/turbowarp-desktop

Create the file userscript.js in this folder to configure custom JS. Create the file userstyle.css in this folder to configure custom CSS. Completely restart TurboWarp Desktop (including all windows) to apply.

Uninstall

See https://desktop.turbowarp.org/uninstall