signal-styler 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/index.js +16 -3
- package/package.json +1 -1
- package/utils.js +52 -6
package/README.md
CHANGED
|
@@ -57,6 +57,62 @@ signal-styler [options] custom.css
|
|
|
57
57
|
By default, the tool will try to locate it automatically.
|
|
58
58
|
Useful if Signal is installed via **Flatpak**.
|
|
59
59
|
|
|
60
|
+
- `-t, --tray-icons <path>`
|
|
61
|
+
Path to the custom tray icons folder.
|
|
62
|
+
Useful if you want to override the default tray icons with your own.
|
|
63
|
+
|
|
64
|
+
The tray icons folder should have the following structure:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
tray-icons
|
|
68
|
+
├── alert
|
|
69
|
+
│ ├── signal-tray-icon-16x16-alert-1.png
|
|
70
|
+
│ ├── signal-tray-icon-16x16-alert-2.png
|
|
71
|
+
│ ├── signal-tray-icon-16x16-alert-3.png
|
|
72
|
+
│ ├── signal-tray-icon-16x16-alert-4.png
|
|
73
|
+
│ ├── signal-tray-icon-16x16-alert-5.png
|
|
74
|
+
│ ├── signal-tray-icon-16x16-alert-6.png
|
|
75
|
+
│ ├── signal-tray-icon-16x16-alert-7.png
|
|
76
|
+
│ ├── signal-tray-icon-16x16-alert-8.png
|
|
77
|
+
│ ├── signal-tray-icon-16x16-alert-9.png
|
|
78
|
+
│ ├── signal-tray-icon-16x16-alert-9+.png
|
|
79
|
+
│ ├── signal-tray-icon-256x256-alert-1.png
|
|
80
|
+
│ ├── signal-tray-icon-256x256-alert-2.png
|
|
81
|
+
│ ├── signal-tray-icon-256x256-alert-3.png
|
|
82
|
+
│ ├── signal-tray-icon-256x256-alert-4.png
|
|
83
|
+
│ ├── signal-tray-icon-256x256-alert-5.png
|
|
84
|
+
│ ├── signal-tray-icon-256x256-alert-6.png
|
|
85
|
+
│ ├── signal-tray-icon-256x256-alert-7.png
|
|
86
|
+
│ ├── signal-tray-icon-256x256-alert-8.png
|
|
87
|
+
│ ├── signal-tray-icon-256x256-alert-9.png
|
|
88
|
+
│ ├── signal-tray-icon-256x256-alert-9+.png
|
|
89
|
+
│ ├── signal-tray-icon-32x32-alert-1.png
|
|
90
|
+
│ ├── signal-tray-icon-32x32-alert-2.png
|
|
91
|
+
│ ├── signal-tray-icon-32x32-alert-3.png
|
|
92
|
+
│ ├── signal-tray-icon-32x32-alert-4.png
|
|
93
|
+
│ ├── signal-tray-icon-32x32-alert-5.png
|
|
94
|
+
│ ├── signal-tray-icon-32x32-alert-6.png
|
|
95
|
+
│ ├── signal-tray-icon-32x32-alert-7.png
|
|
96
|
+
│ ├── signal-tray-icon-32x32-alert-8.png
|
|
97
|
+
│ ├── signal-tray-icon-32x32-alert-9.png
|
|
98
|
+
│ ├── signal-tray-icon-32x32-alert-9+.png
|
|
99
|
+
│ ├── signal-tray-icon-48x48-alert-1.png
|
|
100
|
+
│ ├── signal-tray-icon-48x48-alert-2.png
|
|
101
|
+
│ ├── signal-tray-icon-48x48-alert-3.png
|
|
102
|
+
│ ├── signal-tray-icon-48x48-alert-4.png
|
|
103
|
+
│ ├── signal-tray-icon-48x48-alert-5.png
|
|
104
|
+
│ ├── signal-tray-icon-48x48-alert-6.png
|
|
105
|
+
│ ├── signal-tray-icon-48x48-alert-7.png
|
|
106
|
+
│ ├── signal-tray-icon-48x48-alert-8.png
|
|
107
|
+
│ ├── signal-tray-icon-48x48-alert-9.png
|
|
108
|
+
│ └── signal-tray-icon-48x48-alert-9+.png
|
|
109
|
+
└── base
|
|
110
|
+
├── signal-tray-icon-16x16-base.png
|
|
111
|
+
├── signal-tray-icon-256x256-base.png
|
|
112
|
+
├── signal-tray-icon-32x32-base.png
|
|
113
|
+
└── signal-tray-icon-48x48-base.png
|
|
114
|
+
```
|
|
115
|
+
|
|
60
116
|
- `-v, --version`
|
|
61
117
|
Show the version number.
|
|
62
118
|
|
package/index.js
CHANGED
|
@@ -22,6 +22,11 @@ parser.add_argument("-a", "--asar", {
|
|
|
22
22
|
help: "path to Signal Desktop asar to patch",
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
parser.add_argument("-t", "--tray-icons", {
|
|
26
|
+
type: String,
|
|
27
|
+
help: "path to custom tray icons folder",
|
|
28
|
+
});
|
|
29
|
+
|
|
25
30
|
parser.add_argument("custom.css", {
|
|
26
31
|
type: String,
|
|
27
32
|
help: "path to custom stylesheet",
|
|
@@ -76,13 +81,22 @@ if (!utils.isManifestModified(manifest)) {
|
|
|
76
81
|
|
|
77
82
|
utils.patchManifest(manifest);
|
|
78
83
|
} else
|
|
79
|
-
console.log(
|
|
84
|
+
console.log(
|
|
85
|
+
"\n2. Signal-Styler already \x1b[32menabled\x1b[0m, continue ..."
|
|
86
|
+
);
|
|
80
87
|
|
|
81
|
-
console.log(
|
|
88
|
+
console.log(
|
|
89
|
+
"\n3. Installing custom CSS " +
|
|
90
|
+
(args["tray-icons"] ? " and tray icons " : "") +
|
|
91
|
+
"..."
|
|
92
|
+
);
|
|
82
93
|
|
|
83
94
|
// copy custom.css to patchDir
|
|
84
95
|
utils.setStylesheet(args["custom.css"]);
|
|
85
96
|
|
|
97
|
+
if (args["tray-icons"])
|
|
98
|
+
utils.setTrayIcons(args["tray-icons"]);
|
|
99
|
+
|
|
86
100
|
console.log("\n4. Building Signal Desktop asar ...");
|
|
87
101
|
|
|
88
102
|
utils.build().then(() => {
|
|
@@ -96,4 +110,3 @@ utils.build().then(() => {
|
|
|
96
110
|
`\n\x1b[32mDone\x1b[0m! Restart Signal to see your beautiful new styles. \x1b[33m\u{1F3A8}\x1b[0m\x1b[33m\u{2728}\x1b[0m`
|
|
97
111
|
);
|
|
98
112
|
});
|
|
99
|
-
|
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -121,14 +121,60 @@ class Utils {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
|
-
* Copies the given
|
|
125
|
-
* @param {string} cssPath - Path to the custom stylesheet
|
|
124
|
+
* Copies the given custom stylesheet to the correct location inside the `patchDir`.
|
|
125
|
+
* @param {string} cssPath - Path to the custom stylesheet.
|
|
126
|
+
* @throws {Error} If `cssPath` is null or undefined, or if the copy operation fails.
|
|
126
127
|
*/
|
|
127
128
|
setStylesheet(cssPath) {
|
|
128
|
-
|
|
129
|
-
cssPath
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
if (cssPath === null || cssPath === undefined) {
|
|
130
|
+
throw new Error("cssPath cannot be null or undefined");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (!fs.existsSync(cssPath)) {
|
|
134
|
+
throw new Error(`cssPath ${cssPath} does not exist`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
fs.copyFileSync(
|
|
139
|
+
cssPath,
|
|
140
|
+
path.join(this.patchDir, "stylesheets/custom.css")
|
|
141
|
+
);
|
|
142
|
+
} catch (err) {
|
|
143
|
+
throw new Error(`Failed to copy stylesheet: ${err}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Deletes the old tray icons directory if it exists, and then copies the
|
|
149
|
+
* contents of the given tray icon directory to the correct location inside
|
|
150
|
+
* `patchDir`.
|
|
151
|
+
* @param {string} iconsPath - Path to the tray icon directory.
|
|
152
|
+
* @throws {Error} If `iconsPath` is null or undefined, or if the delete or copy operation fails.
|
|
153
|
+
*/
|
|
154
|
+
setTrayIcons(iconsPath) {
|
|
155
|
+
if (iconsPath === null || iconsPath === undefined) {
|
|
156
|
+
throw new Error("iconsPath cannot be null or undefined");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (!fs.existsSync(iconsPath)) {
|
|
160
|
+
throw new Error(`iconsPath ${iconsPath} does not exist`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const oldIconsPath = path.join(this.patchDir, "images/tray-icons");
|
|
164
|
+
|
|
165
|
+
try {
|
|
166
|
+
if (fs.existsSync(oldIconsPath)) {
|
|
167
|
+
fs.rmSync(oldIconsPath, { recursive: true });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
fs.cpSync(
|
|
171
|
+
iconsPath,
|
|
172
|
+
oldIconsPath,
|
|
173
|
+
{ recursive: true }
|
|
174
|
+
);
|
|
175
|
+
} catch (err) {
|
|
176
|
+
throw new Error(`Failed to copy tray icons: ${err}`);
|
|
177
|
+
}
|
|
132
178
|
}
|
|
133
179
|
|
|
134
180
|
/**
|