summarylogtreecommitdiffstats
path: root/launch-app.sh
blob: 673e7875e9ffdf180b2d2b090fd7378016777c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

set -euo pipefail

flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/desktop-plus-flags.conf"
old_flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/github-desktop-plus-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 "${old_flags_file}" ]]; then
    mapfile -t lines < "${old_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

exec /opt/desktop-plus/desktop-plus "${flags[@]}" "$@"