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.
This commit is contained in:
Naïm Camille Favier
2025-07-08 21:37:45 +02:00
parent d14923dec2
commit 0025e0ec6e
2 changed files with 6 additions and 2 deletions
@@ -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
'';
@@ -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