@@ -31,6 +31,7 @@ xdg_config=${XDG_CONFIG_HOME:-$HOME/.config}
31
31
data=${XDG_DATA_HOME:- $HOME / .local/ share} /betterdiscordctl
32
32
snap_bin=snap
33
33
flatpak_bin=flatpak
34
+ nix_bin=' nix-store'
34
35
35
36
show_help () {
36
37
cat << EOF
@@ -42,22 +43,20 @@ Options:
42
43
-v, --verbose Increase verbosity
43
44
-s, --scan=DIRECTORIES Colon-separated list of directories to scan for
44
45
a Discord installation
45
- (default '/opt:/usr/share')
46
46
-f, --flavors=FLAVORS Colon-separated list of Discord flavors
47
- (default ':canary:ptb')
48
47
-d, --discord=DIRECTORY Use the specified Discord directory
49
48
(requires --modules)
50
49
-m, --modules=DIRECTORY Use the specified Discord modules directory
51
50
-r, --bd-repo=REPOSITORY Use the specified Git repo for BetterDiscord
52
51
--bd-repo-branch=BRANCH Use the specified Git branch for BetterDiscord
53
- (default 'stable16')
54
52
-b, --betterdiscord=DIRECTORY Use the specified BetterDiscord directory
55
53
-c, --copy-bd Copy BD directory instead of symlinking
56
54
--snap[=COMMAND] Use the Snap version of Discord (optionally
57
55
using the specified snap command)
58
56
--flatpak[=COMMAND] Use the Flatpak version of Discord (optionally
59
57
using the specified flatpak command)
60
- --nix Look for Discord in the nix store
58
+ --nix[=COMMAND] Look for Discord in the nix store (optionally
59
+ using the specified nix-store command)
61
60
--upgrade-url=URL Custom URL to upgrade betterdiscordctl with
62
61
63
62
Commands:
@@ -209,6 +208,13 @@ while :; do
209
208
--nix)
210
209
nix=yes
211
210
;;
211
+ --nix=?* )
212
+ nix=yes
213
+ nix_bin=${1#* =}
214
+ ;;
215
+ --nix=)
216
+ die_non_empty ' --nix'
217
+ ;;
212
218
--upgrade-url)
213
219
if [[ ${2+x} ]]; then upgrade_url=$2 ; shift
214
220
else die_non_empty ' --upgrade-url' ; fi
@@ -480,7 +486,7 @@ bdc_nix() {
480
486
elif [[ ${flavor,,} == canary ]]; then
481
487
flavor=Canary
482
488
fi
483
- scandir=$( nix-store -r " $( which " Discord$flavor " ) " )
489
+ scandir=$( " $nix_bin " -r " $( which " Discord$flavor " ) " )
484
490
verbose 2 " VV: Scanning $scandir "
485
491
discord=" $scandir /opt/Discord$flavor "
486
492
if [[ -d $discord ]]; then
@@ -506,7 +512,7 @@ bdc_kill() {
506
512
declare process_name=Discord
507
513
[[ $flavor ]] && process_name+=" $flavor "
508
514
printf ' Killing %s processes...\n' " $process_name " >&2
509
- pkill -exi -KILL " discord-? $ flavor" || printf ' No active processes found.\n' >&2
515
+ pkill -exi -KILL " discord${ flavor: 0 : 8} " || printf ' No active processes found.\n' >&2
510
516
}
511
517
512
518
bd_injector () {
0 commit comments