Skip to content

Commit

Permalink
Upgrade nw.js to 0.55.0 (experimental).
Browse files Browse the repository at this point in the history
Turns out that nw.js 0.42.0 crashes a lot on newer macOS versions, so we
need to upgrade to a later version. As Ico figured out a while ago, the
performance issues in later versions are due to the NW2 upgrade in
0.42.4 (https://nwjs.io/blog/nw2-mode/). This can be disabled which gets
JS execution performance back up to where it was in older versions.

0.55.0 is the last version which doesn't have the nwworkingdir bug on
Linux which causes file dialogs to open in the wrong locations. It also
seems to work just as well (or at least not any worse) than 0.67.x on
Mac and Windows.

The only downside is that 0.55.0 still has the dark mode bug on Linux
(#42); Mac and Windows seem to
be fine. But this is a cosmetic issue which can be worked around by
adjusting the desktop theme, while the nwworkingdir bug breaks important
functionality and has no known work-around. So I think that fixing the
latter at the cost of breaking dark mode is the most sensible choice.

Note that if you absolutely need to have dark mode working on Linux, you
can now just use the new patch-nwjs.sh script to patch your Purr Data
installation to use a later version such as 0.67.0 which doesn't have
the dark mode bug.
  • Loading branch information
agraef committed Aug 22, 2024
1 parent 799e2ae commit ee3d545
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion debuild/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ debdist = purr-data-$(debversion)
# nw.js sdk
# NOTE: arm packages need some special-casing, since they are released
# separately, and the version numbers do not always match up.
nwjsver = 0.28.3
nwjsver = 0.55.0
nwjspkg = nwjs-sdk-v$(nwjsver)-linux
nwjsver_arm = 0.27.6
nwjspkg_arm = nwjs-sdk-v$(nwjsver_arm)-linux
Expand Down
2 changes: 1 addition & 1 deletion debuild/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

nwjsver = 0.28.3
nwjsver = 0.55.0
nwjspkg = nwjs-sdk-v$(nwjsver)-linux
nwjsdir = nwjs-sdk-v$(nwjsver)-linux

Expand Down
6 changes: 3 additions & 3 deletions l2ork_addons/patch-nwjs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# much the last nw.js version that is known to work properly with purr-data).

# You can also invoke the script without the nw.js version argument, it will
# then use the default version that our packages ship with (0.67.0 at the time
# then use the default version that our packages ship with (0.55.0 at the time
# of this writing). Or run ./patch-nwjs.sh -h to print some usage information.

# The script also lets you edit the package.json file of the installed
Expand Down Expand Up @@ -68,12 +68,12 @@ case "$1" in
echo "-h: print this message" 1>&2
echo "-nw1: switch NW2 mode OFF (https://nwjs.io/blog/nw2-mode/)" 1>&2
echo "-nw2: switch NW2 mode ON (this may slow down the application!)" 1>&2
echo "nwjs-version (x.y.z): nw.js version to be used (default: 0.67.0)" 1>&2
echo "nwjs-version (x.y.z): nw.js version to be used (default: 0.55.0)" 1>&2
exit 0 ;;
esac

if [ -z "$nwopt" -a -z "$nwjs_version" ]; then
nwjs_version="0.67.0"
nwjs_version="0.55.0"
fi

os=`uname | tr '[:upper:]' '[:lower:]'`
Expand Down
11 changes: 8 additions & 3 deletions l2ork_addons/tar_em_up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,21 @@ if [ ! -d "../pd/nw/nw" ]; then
# work on newer macOS versions. Note that at present only
# Intel builds are supported, but these should also work on
# Apple Silicon via Rosetta 2.
nwjs_version="v${nwjsver:-0.42.0}"
nwjs_version="v${nwjsver:-0.55.0}"
elif [[ $os == "win" || $os == "win64" ]]; then
# same version works on Windows, too
nwjs_version="v${nwjsver:-0.55.0}"
elif [ $arch == "arm" ]; then
# rpi-- only 0.27.6 is available atm
nwjs_version="v0.27.6"
elif [ $arch == "arm64" ]; then
# dito for rpi arm64-- 0.23.7 version
nwjs_version="v0.23.7"
else
# default for Linux and Windows
nwjs_version="v${nwjsver:-0.42.0}"
# default for Linux -- same as Mac and Windows; note that
# anything past 0.55.0 suffers from the nwworkingdir bug which
# makes file dialogs open in the wrong locations
nwjs_version="v${nwjsver:-0.55.0}"
fi

nwjs="nwjs-sdk"
Expand Down
2 changes: 1 addition & 1 deletion pd/nw/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ function nw_create_window(cid, type, width, height, xpos, ypos, attr_array) {
gui.Window.open(my_file, {
title: my_title,
// ico@vt.edu: position in 0.46.2 overrides x and y below
position: pos,
//position: pos,
focus: true,
width: width,
// We add 23 as a kludge to account for the menubar at the top of
Expand Down
2 changes: 1 addition & 1 deletion pd/nw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "purr-data",
"version": "0.1.0",
"main": "index.html",
"chromium-args": "--proxy-server=http://127.0.0.1 --password-store=basic",
"chromium-args": "--disable-features=nw2 --proxy-server=http://127.0.0.1 --password-store=basic",
"window": {
"icon": "./purr.png",
"position": "center",
Expand Down

0 comments on commit ee3d545

Please sign in to comment.