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 | |
parent | dce8fe36eb7f550f648cb83ab890ce638ca819d0 (diff) |
more update (auto install betterdiscord)
-rwxr-xr-x | .config/mode/switch.d/chromium (renamed from .config/mode/switch.d/chrome) | 25 | ||||
-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 | ||||
-rw-r--r-- | .profile | 4 |
7 files changed, 61 insertions, 13 deletions
diff --git a/.config/mode/switch.d/chrome b/.config/mode/switch.d/chromium index 4c596c3..532510a 100755 --- a/.config/mode/switch.d/chrome +++ b/.config/mode/switch.d/chromium @@ -1,15 +1,17 @@ #!/bin/sh -( - cd ~/.cache/wal/chromium - rm -f 'Cached Theme.pak' 'bg.png' 'manifest.json' - convert -size 100x100 "xc:$bg" bg.png - bg_alt=$(mix_rgb $color7 $bg 0.20) - fg_alt=$(mix_rgb $color15 $fg 0.60) - bg="$(hex_to_rgb_array "$bg")" - fg="$(hex_to_rgb_array "$fg")" - bg_alt="$(hex_to_rgb_array "$bg_alt")" - fg_alt="$(hex_to_rgb_array "$fg_alt")" - cat << EOF > manifest.json +PREFIX="$XDG_DATA_HOME/mode/chromium" + +mkdir -p "$PREFIX" +rm -f "$PREFIX/Cached Theme.pak" + +convert -size 100x100 "xc:$bg" "$PREFIX/bg.png" +bg_alt=$(mix_rgb $color7 $bg 0.20) +fg_alt=$(mix_rgb $color15 $fg 0.60) +bg="$(hex_to_rgb_array "$bg")" +fg="$(hex_to_rgb_array "$fg")" +bg_alt="$(hex_to_rgb_array "$bg_alt")" +fg_alt="$(hex_to_rgb_array "$fg_alt")" +cat << EOF > "$PREFIX/manifest.json" { "description": "colorscheme generated by mode", "manifest_version": 2, @@ -40,5 +42,4 @@ "version": "2" } EOF -) 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) @@ -16,6 +16,8 @@ alias mk="make" alias sl="sl -w" alias vv="neovide" alias today="khal list today today" +alias bctl="bluetoothctl" +alias sctl="systemctl --user" # one letters alias r="ranger" @@ -26,6 +28,8 @@ alias n="ncmpcpp" alias c="khal" alias f="fork" alias p="pass" +alias b="bluetoothctl" +alias s="systemctl --user" # "functions" alias reload="sudo systemctl restart lightdm" |