-
-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Description
Allow users to append flags via helium-flags.conf at runtime
Who's implementing?
- I'm willing to implement this feature myself
The problem
Linux users expect to be able to set flags at runtime (particularly important with Wayland) with Chromium-based applications via a *.conf file.
Possible solutions
AUR packaging implements this downstream in the wrapper via bash script1, and appends to the binary call. The following version only has support for {$XDG_CONFIG_HOME}/helium-flags.conf:
[Note we add support to set flags via /etc/helium-flags.conf and environment var HELIUM_USER_FLAGS downstream, which is omitted in this patch.]
From b6babf26b1f537b4e751315d2743d218c1d1f506 Mon Sep 17 00:00:00 2001
From: Sam Sinclair <sam@playleft.com>
Date: Wed, 31 Dec 2025 10:59:52 +1100
Subject: [PATCH] feat: add helium-flags.conf support
---
package/helium-wrapper.sh | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/package/helium-wrapper.sh b/package/helium-wrapper.sh
index 191711c..30664ee 100755
--- a/package/helium-wrapper.sh
+++ b/package/helium-wrapper.sh
@@ -11,7 +11,44 @@ export CHROME_VERSION_EXTRA="custom"
CHROME_WRAPPER="$(readlink -f "$0")"
HERE="$(dirname "$CHROME_WRAPPER")"
+# Gather user config dir and .conf
+XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}"
+
+USR_CONF="${XDG_CONFIG_HOME}/helium-flags.conf"
+
+FLAGS=()
+
+append_flags_file() {
+ local file="$1"
+ [[ -r "$file" ]] || return 0
+ local line safe_line
+ # Filter comments & blank lines
+ while IFS= read -r line; do
+ [[ "$line" =~ ^[[:space:]]*(#|$) ]] && continue
+ # Sanitise: block command substitution; prevent $VAR and ~ expansion
+ case "$line" in
+ *'$('*|*'`'*)
+ echo "Warning: ignoring unsafe line in $file: $line" >&2
+ continue
+ ;;
+ esac
+ # Disable globbing during eval
+ set -f
+ # Prevent $VAR and ~ expansion while allowing eval to parse quotes & escapes
+ safe_line=${line//$/\\$}
+ safe_line=${safe_line//~/\\~}
+ eval "set -- $safe_line"
+ # Enable globbing for rest of the script
+ set +f
+ for token in "$@"; do
+ FLAGS+=("$token")
+ done
+ done < "$file"
+}
+
+append_flags_file "$USR_CONF"
+
export CHROME_WRAPPER
export LD_LIBRARY_PATH="$HERE:$HERE/lib:$HERE/lib.target${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
-exec "$HERE/chrome" "$@"
+exec "$HERE/chrome" "${FLAGS[@]}" "$@"
--
2.52.0
Additional context
This implementation has been stable since October 20th, 2025 2.
Official Arch packaging for Chromium3 utilises a C based chromium-launcher which this implementation is a simplified reproduction of.
Footnotes
-
https://aur.archlinux.org/cgit/aur.git/commit/?h=helium-browser-bin&id=f2bf054511b851263caa9288f66b2d3b4a412fd7 ↩
-
https://aur.archlinux.org/cgit/aur.git/commit/?h=helium-browser-bin&id=0b2ff96f5b3772b9592cb7093e118ffd4a3404cb ↩
-
https://gitlab.archlinux.org/archlinux/packaging/packages/chromium/-/blob/main/PKGBUILD?ref_type=heads#L31 ↩