diff options
Diffstat (limited to '.local/share')
-rw-r--r-- | .local/share/applications/discord.desktop | 9 | ||||
-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 |
5 files changed, 44 insertions, 1 deletions
diff --git a/.local/share/applications/discord.desktop b/.local/share/applications/discord.desktop new file mode 100644 index 0000000..676b330 --- /dev/null +++ b/.local/share/applications/discord.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Discord +StartupWMClass=discord +Comment=All-in-one voice and text chat for gamers that's free, secure, and works on both your desktop and phone. +GenericName=Internet Messenger +Exec=discord +Icon=discord +Type=Application +Categories=Network;InstantMessaging; 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) |