Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to pass arguments to electron after update to 26.0.15 #2000

Closed
2 tasks done
Bryan2333 opened this issue Feb 23, 2025 · 1 comment
Closed
2 tasks done

Unable to pass arguments to electron after update to 26.0.15 #2000

Bryan2333 opened this issue Feb 23, 2025 · 1 comment

Comments

@Bryan2333
Copy link

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

You must agree to search and the code of conduct. You must fill in this entire template. If you delete part/all or miss parts out your issue will be closed.

Describe the bug
I am using Arch Linux.

I tried building the latest version of drawio‑desktop using the PKGBUILD from the Arch Linux official repo. After updating to version 26.0.15, I found that arguments could not be passed to electron, and drawio‑desktop failed to start. It keeps throwing the error: "error: too many arguments. Expected 0 arguments but got 1."

The previous version, 26.0.9, worked fine whether I launched it with electron32 or electron34.

To Reproduce
Steps to reproduce the behavior:

  1. Open terminal
  2. Execute /usr/lib/electron34/electron /usr/lib/drawio-desktop/app.asar --enable-wayland-ime
  3. Electron fail to start.

Expected behavior
drawio-desktop runs normally.

Screenshots
If applicable, add screenshots to help explain your problem.

Here is the screen record of the situation:

_20250223_175345.mp4

draw.io version (In the Help->About menu of the draw.io editor):

  • draw.io 26.0.15 with Electron 34.2.0

Desktop (please complete the following information):
Operating System: Arch Linux
KDE Plasma Version: 6.3.1
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.6.72-x64v3-xanmod1-1-lts (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800H with Radeon Graphics
Memory: 13.5 GiB of RAM
Graphics Processor: AMD Radeon Graphics

Additional context
Here is the PKGBUILD I use.

# Maintainer: Carl Smedstad <[email protected]>
# Contributor: Dmitry Valter <`echo ZHZhbHRlciA8YXQ+IHByb3Rvbm1haWwgPGRvdD4gY29tCg== | base64 -d`>

pkgname=drawio-desktop
pkgver=26.0.15
pkgrel=1
pkgdesc="Official Electron build of draw.io"
arch=(any)
url="https://www.drawio.com"
license=(Apache-2.0)
_electronver=34
_nodever=20
depends=(
  "electron$_electronver"
  hicolor-icon-theme
  sh
)
makedepends=(
  "nodejs>=$_nodever"
  git
  yarn
)
source=(
  "git+https://github.com/jgraph/drawio-desktop.git#tag=v$pkgver"
  "git+https://github.com/jgraph/drawio.git#tag=v$pkgver"
  "drawio.desktop"
  "drawio.sh"
  "drawio.xml"
)
sha256sums=('8ad95d91640c985e5ab5214d94f78978c6a97b431a23bc2a4dacb4917c3c5b54'
            'a29ba424dfd5843c298dccb61f6b55c68342331b8b7577e92a0ccc8eeb5814c7'
            '1064adf2cb2cd69a95d0f820000f48291a19698df707bef8f1aff0b8d368cf4a'
            'd3a12d0e3904555c1ffcef3b55ea871e87b3a7f99e8e7fec1c05c7357a04d123'
            '53fb8df9cd9101d79fd897880dc7c59b3e90cf5d980029a1ecaa5da3031f8606')

prepare() {
  cd $pkgname
  sed -i "s/@_electronver@/$_electronver/" "$srcdir/drawio.sh"

  git submodule init
  git config submodule.drawio.url "$srcdir/drawio"
  git -c protocol.file.allow=always submodule update

  grep -q "\"version\": \"$pkgver\"" package.json \
    || ( echo "Version mismatch in package.json"; exit 1 )
  grep -qE "\"electron\": \".*$_electronver\." package.json \
    || ( echo "Electron version mismatch in package.json"; exit 1 )
  grep -q "\"node\": \">=$_nodever\"" package.json \
    || ( echo "Node version mismatch in package.json"; exit 1 )

  # Disable auto-updates
  sed -i 's/return false;/return true;/' src/main/disableUpdate.js

  yarn install --frozen-lockfile
}

build() {
  cd "$srcdir/$pkgname"
  yarn run electron-builder --linux dir \
    -c.electronDist=/usr/lib/electron$_electronver \
    -c.electronVersion=$_electronver

  sed -i '/^StartupWMClass/d' "$srcdir/drawio.desktop"
}

package() {
  cd "$srcdir/$pkgname"
  install -vDm644 -t "$pkgdir/usr/lib/$pkgname" dist/linux-unpacked/resources/app.asar
  install -vDm755 "$srcdir/drawio.sh" "$pkgdir/usr/bin/drawio"

  install -vDm644 "$srcdir/drawio.xml" "$pkgdir/usr/share/mime/packages/drawio.xml"
  install -vDm644 "$srcdir/drawio.desktop" "$pkgdir/usr/share/applications/draw.io.desktop" 

  for icon in $(find build -regex '.*/[0-9]+x[0-9]+\.png' | sort -n); do
    size=$(basename -s .png "$icon")
    install -vDm644 "build/$size.png" "$pkgdir/usr/share/icons/hicolor/$size/apps/drawio.png"
  done
}

And here is the wrapper script I use to launch drawio-desktop

#!/bin/bash

set -eu

name=electron34
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf"
fallback_file="${XDG_CONFIG_HOME:-$HOME/.config}/electron-flags.conf"

lines=()
if [[ -f "${flags_file}" ]]; then
    mapfile -t lines < "${flags_file}"
elif [[ -f "${fallback_file}" ]]; then
    mapfile -t lines < "${fallback_file}"
fi

flags=()
for line in "${lines[@]}"; do
    if [[ ! "${line}" =~ ^[[:space:]]*#.* ]] && [[ -n "${line}" ]]; then
        flags+=("${line}")
    fi
done

: "${ELECTRON_IS_DEV:=0}"
export ELECTRON_IS_DEV
: "${ELECTRON_FORCE_IS_PACKAGED:=true}"
export ELECTRON_FORCE_IS_PACKAGED
export NODE_ENV=production

exec /usr/lib/${name}/electron /usr/lib/drawio-desktop/app.asar "${flags[@]}" "$@"
@Bryan2333
Copy link
Author

This issue seems duplicated with #1999. I decide to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant