Commit 35c272a9 authored by Naïm Camille Favier's avatar Naïm Camille Favier Committed by github-actions[bot]
Browse files

discord: add commandLineArgs

Adds an option to append arbitrary command-line arguments to the wrapper.

This allows fixing an issue with DPI scaling in Electron apps by passing
`--force-device-scale-factor=<scale>`, like for Chrome and VSCode.

(cherry picked from commit 0025e0ec)
parent 10e68723
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
  vencord,
  withMoonlight ? false,
  moonlight,
  commandLineArgs ? "",
}:

assert lib.assertMsg (
@@ -64,7 +65,8 @@ stdenv.mkDerivation {
    # wrap executable to $out/bin
    mkdir -p $out/bin
    makeWrapper "$out/Applications/${desktopName}.app/Contents/MacOS/${binaryName}" "$out/bin/${binaryName}" \
      --run ${lib.getExe disableBreakingUpdates}
      --run ${lib.getExe disableBreakingUpdates} \
      --add-flags ${lib.escapeShellArg commandLineArgs}

    runHook postInstall
  '';
+3 −1
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@
  # The intended use-case for this is when SKIP_HOST_UPDATE is enabled via other means,
  # for example if a settings.json is linked declaratively (e.g., with home-manager).
  disableUpdates ? true,
  commandLineArgs ? "",
}:
assert lib.assertMsg (
  !(withMoonlight && withVencord)
@@ -184,7 +185,8 @@ stdenv.mkDerivation rec {
        ${lib.strings.optionalString enableAutoscroll "--add-flags \"--enable-blink-features=MiddleClickAutoscroll\""} \
        --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
        --prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/${binaryName} \
        ${lib.strings.optionalString disableUpdates "--run ${lib.getExe disableBreakingUpdates}"}
        ${lib.strings.optionalString disableUpdates "--run ${lib.getExe disableBreakingUpdates}"} \
        --add-flags ${lib.escapeShellArg commandLineArgs}

    ln -s $out/opt/${binaryName}/${binaryName} $out/bin/
    # Without || true the install would fail on case-insensitive filesystems