summarylogtreecommitdiffstats
path: root/discord-launcher.sh
diff options
context:
space:
mode:
authorManuel Hüsers2024-06-09 21:58:06 +0200
committerManuel Hüsers2024-06-09 21:58:06 +0200
commit9fafba484a420eb6acbc4fa7d92220a621f6e96e (patch)
tree06d91b459d3d7f61cefe0e0b29679e1f6c59cc70 /discord-launcher.sh
parent3cb800694bd6a6c56bb3c399a43193a448dcee83 (diff)
downloadaur-9fafba484a420eb6acbc4fa7d92220a621f6e96e.tar.gz
upgpkg: discord 0.0.55-2: refactor, fix autostart, add deps, use wayland
* Slightly refactor PKGBUILD * Fix autostart desktop file * Add optional dependency used in official arch package * Include patcher to allow Krisp noise suppression support * Add install file to inform user about this change * Use Wayland instead of Xwayland in a Wayland session by setting Electron flag `ozone-platform-hint` to auto (default is X11)
Diffstat (limited to 'discord-launcher.sh')
-rwxr-xr-xdiscord-launcher.sh30
1 files changed, 22 insertions, 8 deletions
diff --git a/discord-launcher.sh b/discord-launcher.sh
index 6e6f47e3f947..e7652dfa95fb 100755
--- a/discord-launcher.sh
+++ b/discord-launcher.sh
@@ -1,21 +1,35 @@
-#!/usr/bin/bash
+#!/usr/bin/env bash
set -euo pipefail
name=@PKGNAME@
+ver=@PKGVER@
electron=@ELECTRON@
-flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf"
declare -a flags
+declare -l PATCH_KRISP
+
+[[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/${name}.conf" ]] && source "${XDG_CONFIG_HOME:-$HOME/.config}/${name}.conf"
+
+flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf"
+krisp_bin="${DISCORD_USER_DATA_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/${name}}/${ver}/modules/${name}_krisp/${name}_krisp.node"
+
+if [[ "${PATCH_KRISP}" == true ]] && [[ -w "${krisp_bin}" ]] && python -c "import capstone; import elftools" &> /dev/null; then
+ # Patch Krisp binary to ignore signature check
+ python /usr/share/${name}/krisp-patcher.py "${krisp_bin}"
+fi
-if [[ -f "${flags_file}" ]]; then
- mapfile -t < "${flags_file}"
+if [[ -r "${flags_file}" ]]; then
+ mapfile -t < "${flags_file}"
fi
for line in "${MAPFILE[@]}"; do
- if [[ ! "${line}" =~ ^[[:space:]]*#.* ]] && [[ -n "${line}" ]]; then
- flags+=("${line}")
- fi
+ if [[ ! "${line}" =~ ^[[:space:]]*#.* ]] && [[ -n "${line}" ]]; then
+ flags+=("${line}")
+ fi
done
-exec /usr/bin/${electron} /usr/share/${name}/resources/app.asar "${flags[@]}" "$@"
+exec /usr/bin/${electron} \
+ /usr/share/${name}/resources/app.asar \
+ --ozone-platform-hint=auto \
+ "${flags[@]}" "$@"