|
1 | 1 | import { generalSettings } from "src/renderer/managers/settings"; |
2 | 2 | import type { PlaintextPatch } from "src/types"; |
3 | 3 |
|
4 | | -export default (generalSettings.get("titleBar") |
5 | | - ? [ |
6 | | - // Patch the title bar to hide the buttons |
| 4 | +export default [ |
| 5 | + ...(generalSettings.get("titleBar") |
| 6 | + ? [ |
| 7 | + // Patch the title bar to hide the buttons |
| 8 | + { |
| 9 | + find: /{leading:\i,title:\i/, |
| 10 | + replacements: [ |
| 11 | + { |
| 12 | + match: /\(0,.{1,3}\.getPlatform\)\(\)/g, |
| 13 | + replace: `"WEB"`, |
| 14 | + }, |
| 15 | + ], |
| 16 | + }, |
| 17 | + // Hide the title bar in popout windows |
| 18 | + { |
| 19 | + find: "Missing guestWindow reference", |
| 20 | + replacements: [ |
| 21 | + { |
| 22 | + match: /(\i\({withTitleBar:)\i/, |
| 23 | + replace: "$1!1", |
| 24 | + }, |
| 25 | + ], |
| 26 | + }, |
| 27 | + // Change the platform class name to 'platform-web' to not apply title bar styles |
| 28 | + { |
| 29 | + find: "platform-web", |
| 30 | + replacements: [ |
| 31 | + { |
| 32 | + match: /(platform-overlay`:)\i/, |
| 33 | + replace: '$1"platform-web"', |
| 34 | + }, |
| 35 | + ], |
| 36 | + }, |
| 37 | + ] |
| 38 | + : []), |
| 39 | + // Toggle the 'frame' option for popout windows |
| 40 | + // ? This also fixes an issue on Linux where the title bar would always be visible in popout windows |
| 41 | + { |
| 42 | + find: "menubar:!1,toolbar:!1", |
| 43 | + replacements: [ |
7 | 44 | { |
8 | | - find: /{leading:\i,title:\i/, |
9 | | - replacements: [ |
10 | | - { |
11 | | - match: /\(0,.{1,3}\.getPlatform\)\(\)/g, |
12 | | - replace: `"WEB"`, |
13 | | - }, |
14 | | - ], |
| 45 | + match: "menubar:", |
| 46 | + replace: `frame:${generalSettings.get("titleBar")},$&`, |
15 | 47 | }, |
16 | | - // Enable the 'frame' option for popout windows |
17 | | - { |
18 | | - find: "menubar:!1,toolbar:!1", |
19 | | - replacements: [ |
20 | | - { |
21 | | - match: "menubar:", |
22 | | - replace: "frame:!0,$&", |
23 | | - }, |
24 | | - ], |
25 | | - }, |
26 | | - // Hide the title bar in popout windows |
27 | | - { |
28 | | - find: "Missing guestWindow reference", |
29 | | - replacements: [ |
30 | | - { |
31 | | - match: /(\i\({withTitleBar:)\i/, |
32 | | - replace: "$1!1", |
33 | | - }, |
34 | | - ], |
35 | | - }, |
36 | | - // Change the platform class name to 'platform-web' to not apply title bar styles |
37 | | - { |
38 | | - find: "platform-web", |
39 | | - replacements: [ |
40 | | - { |
41 | | - match: /(platform-overlay`:)\i/, |
42 | | - replace: '$1"platform-web"', |
43 | | - }, |
44 | | - ], |
45 | | - }, |
46 | | - ] |
47 | | - : []) as PlaintextPatch[]; |
| 48 | + ], |
| 49 | + }, |
| 50 | +] as PlaintextPatch[]; |
0 commit comments