-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-discord-tray
executable file
·58 lines (46 loc) · 1.88 KB
/
update-discord-tray
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
# A script to update Discord's tray icon using the Papirus icon theme.
# Copyright (C) 2018 Julien Machiels
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
declare -a arr=("tray"
"tray-connected"
"tray-deafened"
"tray-muted"
"tray-speaking"
"tray-unread"
)
distribution=$(grep "^NAME=" /etc/os-release |cut -d "=" -f 2 | sed -e 's/^"//' -e 's/"$//')
echo "Extracting core.asar..."
# Potentially this could support multiple distributions at some point.
if [ "$distribution" == "Fedora" ]; then
cd /usr/lib64/discord/resources/bootstrap/
else
echo "Distribution not currently supported."
exit 1
unzip -j discord_desktop_core.zip core.asar -d /tmp/
asar e /tmp/core.asar /tmp/core
fi
# Process the icons
for icon in "${arr[@]}"
do
# This location is for Fedora
echo "Creating $icon..."
rsvg-convert -w 22 -h 22 -f png -a /usr/share/icons/Papirus/22x22/panel/discord-$icon.svg > /tmp/core/app/images/systemtray/linux/$icon.png
done
echo "Repacking core.asar..."
asar p /tmp/core /tmp/core.asar
echo "Updating discord_desktop_core.zip..."
sudo zip -jur discord_desktop_core.zip /tmp/core.asar
echo "Cleaning up..."
rm -rf /tmp/core.asar
rm -rfd /tmp/core/