diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-03-09 00:04:46 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-03-09 00:04:46 +0100 |
commit | 2dc5ec7085e1c1bbc406f2089dddf8f6e1d9d206 (patch) | |
tree | 922afe93d8c8fb5bcf1d46cd3d6a732f3ce60f4a /.local/share/bin | |
parent | dce8fe36eb7f550f648cb83ab890ce638ca819d0 (diff) |
more update (auto install betterdiscord)
Diffstat (limited to '.local/share/bin')
-rwxr-xr-x | .local/share/bin/decsync2plain | 2 | ||||
-rwxr-xr-x | .local/share/bin/discord | 3 | ||||
-rwxr-xr-x | .local/share/bin/installbd | 28 | ||||
-rwxr-xr-x | .local/share/bin/nodisconnect | 3 |
4 files changed, 35 insertions, 1 deletions
diff --git a/.local/share/bin/decsync2plain b/.local/share/bin/decsync2plain index 2bb9be2..5cb7eec 100755 --- a/.local/share/bin/decsync2plain +++ b/.local/share/bin/decsync2plain @@ -33,7 +33,7 @@ fi # auto detect extension if not explicitly provided if [ -z "$EXTENSION" ] ; then - EXTENSION="$(realpath "$PWD" | tr '/' '\n' | sort -r | while read -r folder ; do + EXTENSION="$(realpath "$PWD" | tr '/' '\n' | tac | while read -r folder ; do case "$folder" in calendars|tasks) echo ics ; break ;; contacts) echo vcf ; break ;; diff --git a/.local/share/bin/discord b/.local/share/bin/discord new file mode 100755 index 0000000..d2f894b --- /dev/null +++ b/.local/share/bin/discord @@ -0,0 +1,3 @@ +#!/bin/sh +installbd +exec /usr/bin/discord "$@" diff --git a/.local/share/bin/installbd b/.local/share/bin/installbd new file mode 100755 index 0000000..eefe92a --- /dev/null +++ b/.local/share/bin/installbd @@ -0,0 +1,28 @@ +#!/bin/sh +discord_path="$(dirname "$(find "$XDG_CONFIG_HOME/discord" -name core.asar)")" +discord_version="$(echo "$discord_path" | tr '/' '\n' | tac | sed -n '/^[0-9.]\+$/p' | head -n1)" +betterdiscord_path="$XDG_CONFIG_HOME/BetterDiscord/data/betterdiscord.asar" +cache_file="$XDG_CACHE_HOME/bdversion" + +# download betterdiscord.asar by default +download=1 +# do not do download if discord hasn't been updated since the last time this +# script was run +[ -e "$cache_file" ] && [ "$discord_version" = "$(cat "$cache_file")" ] && download=0 +# always download if betterdiscord.asar does not exist +[ ! -e "$betterdiscord_path" ] && download=1 + +if [ $download -eq 1 ] ; then + echo "download betterdiscord.asar" + curl -sLo - 'https://betterdiscord.app/Download/betterdiscord.asar' > "$betterdiscord_path" +fi +if ! grep "$(basename "$betterdiscord_path")" "$discord_path/index.js" > /dev/null ; then + echo "patch discord desktop core index.js" + printf 'require("%s");\n%s' "$betterdiscord_path" "$(cat "$discord_path/index.js")" > "$discord_path/index.js" +fi + +# store discord version used for this install +mkdir -p "$(dirname "$cache_file")" +echo "$discord_version" > "$cache_file" + +echo "done!" diff --git a/.local/share/bin/nodisconnect b/.local/share/bin/nodisconnect index 0c65d13..b4fb2c3 100755 --- a/.local/share/bin/nodisconnect +++ b/.local/share/bin/nodisconnect @@ -1,6 +1,9 @@ #!/bin/sh # use sox to play very quiet noise for keeping bluetooth headphones connected +# kill any previously running processes +killall -u "$LOGNAME" play + # arguments used: # -q quiet mode (don't output progress bar) # -n null input filename (because synth is used as input) |