mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Add force quit and AC theme manifest additions
This commit is contained in:
parent
11686f1244
commit
610931d75b
5 changed files with 43 additions and 2 deletions
|
@ -31,7 +31,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
div#themes:after,
|
div#themes:after,
|
||||||
div#armcord:after {
|
div#armcord:after,
|
||||||
|
div#forceQuit:after {
|
||||||
content: url("https://raw.githubusercontent.com/ArmCord/BrandingStuff/main/ac_white_plug16x.png");
|
content: url("https://raw.githubusercontent.com/ArmCord/BrandingStuff/main/ac_white_plug16x.png");
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,12 +100,17 @@ setInterval(() => {
|
||||||
}
|
}
|
||||||
const acSettings = advanced.cloneNode(true) as HTMLElement;
|
const acSettings = advanced.cloneNode(true) as HTMLElement;
|
||||||
const tManager = advanced.cloneNode(true) as HTMLElement;
|
const tManager = advanced.cloneNode(true) as HTMLElement;
|
||||||
|
const fQuit = advanced.cloneNode(true) as HTMLElement;
|
||||||
acSettings.textContent = "ArmCord";
|
acSettings.textContent = "ArmCord";
|
||||||
acSettings.id = "armcord";
|
acSettings.id = "armcord";
|
||||||
acSettings.onclick = () => ipcRenderer.send("openSettingsWindow");
|
acSettings.onclick = () => ipcRenderer.send("openSettingsWindow");
|
||||||
tManager.textContent = "Themes";
|
tManager.textContent = "Themes";
|
||||||
tManager.id = "themes";
|
tManager.id = "themes";
|
||||||
tManager.onclick = () => ipcRenderer.send("openManagerWindow");
|
tManager.onclick = () => ipcRenderer.send("openManagerWindow");
|
||||||
|
fQuit.textContent = "Force Quit";
|
||||||
|
fQuit.id = "forceQuit";
|
||||||
|
fQuit.onclick = () => ipcRenderer.send("win-quit");
|
||||||
advanced.insertAdjacentElement("afterend", acSettings);
|
advanced.insertAdjacentElement("afterend", acSettings);
|
||||||
advanced.insertAdjacentElement("afterend", tManager);
|
advanced.insertAdjacentElement("afterend", tManager);
|
||||||
|
advanced.insertAdjacentElement("afterend", fQuit);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
|
@ -18,6 +18,8 @@ interface ThemeManifest {
|
||||||
patreon?: string;
|
patreon?: string;
|
||||||
website?: string;
|
website?: string;
|
||||||
source?: string;
|
source?: string;
|
||||||
|
updateSrc?: string;
|
||||||
|
supportsArmCordTitlebar?: boolean;
|
||||||
}
|
}
|
||||||
function parseBDManifest(content: string) {
|
function parseBDManifest(content: string) {
|
||||||
const metaReg = /@([^ ]*) (.*)/g;
|
const metaReg = /@([^ ]*) (.*)/g;
|
||||||
|
@ -161,6 +163,9 @@ export function createTManagerWindow(): void {
|
||||||
fs.mkdirSync(themePath);
|
fs.mkdirSync(themePath);
|
||||||
console.log(`Created ${manifest.name} folder`);
|
console.log(`Created ${manifest.name} folder`);
|
||||||
}
|
}
|
||||||
|
manifest.updateSrc = link;
|
||||||
|
if (code.includes(".titlebar")) manifest.supportsArmCordTitlebar = true;
|
||||||
|
else manifest.supportsArmCordTitlebar = false;
|
||||||
fs.writeFileSync(path.join(themePath, "manifest.json"), JSON.stringify(manifest));
|
fs.writeFileSync(path.join(themePath, "manifest.json"), JSON.stringify(manifest));
|
||||||
fs.writeFileSync(path.join(themePath, "src.css"), code);
|
fs.writeFileSync(path.join(themePath, "src.css"), code);
|
||||||
dialog.showMessageBoxSync({
|
dialog.showMessageBoxSync({
|
||||||
|
|
|
@ -280,6 +280,11 @@
|
||||||
.button {
|
.button {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
img.themeInfoIcon {
|
||||||
|
height: 30px;
|
||||||
|
position: relative;
|
||||||
|
top: 5px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ ipcRenderer.on("themeManifest", (_event, json) => {
|
||||||
<label class="tgl-btn left" for="${id}"></label>
|
<label class="tgl-btn left" for="${id}"></label>
|
||||||
</div>
|
</div>
|
||||||
<p>${manifest.description}</p>
|
<p>${manifest.description}</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
@ -24,6 +23,32 @@ ipcRenderer.on("themeManifest", (_event, json) => {
|
||||||
document.getElementById("themeInfoModal")!.style.display = "block";
|
document.getElementById("themeInfoModal")!.style.display = "block";
|
||||||
document.getElementById("themeInfoName")!.textContent = `${manifest.name} by ${manifest.author}`;
|
document.getElementById("themeInfoName")!.textContent = `${manifest.name} by ${manifest.author}`;
|
||||||
document.getElementById("themeInfoDesc")!.textContent = `${manifest.description}\n\n${manifest.version}`;
|
document.getElementById("themeInfoDesc")!.textContent = `${manifest.description}\n\n${manifest.version}`;
|
||||||
|
if (manifest.supportsArmCordTitlebar !== undefined) {
|
||||||
|
document.getElementById(
|
||||||
|
"themeInfoButtons"
|
||||||
|
)!.innerHTML += `<img class="themeInfoIcon" id="removeTheme" alt="Remove the theme" src="https://raw.githubusercontent.com/ArmCord/BrandingStuff/main/Trash.png"></img>
|
||||||
|
<img class="themeInfoIcon" id="updateTheme" alt="Update your theme" src="https://raw.githubusercontent.com/ArmCord/BrandingStuff/main/UpgradeArrow.png"></img>
|
||||||
|
<img class="themeInfoIcon" id="compatibility" alt="Supports ArmCord Titlebar" src=""></img>`;
|
||||||
|
console.log("e");
|
||||||
|
if (manifest.supportsArmCordTitlebar == true) {
|
||||||
|
(document.getElementById(`compatibility`) as HTMLImageElement).src =
|
||||||
|
"https://raw.githubusercontent.com/ArmCord/BrandingStuff/main/Window.png";
|
||||||
|
} else {
|
||||||
|
(document.getElementById(`compatibility`) as HTMLImageElement).src =
|
||||||
|
"https://raw.githubusercontent.com/ArmCord/BrandingStuff/main/WindowUnsupported.png";
|
||||||
|
}
|
||||||
|
document.getElementById("removeTheme")!.addEventListener("click", () => {
|
||||||
|
ipcRenderer.send("", id + "-BD");
|
||||||
|
document.getElementById("themeInfoModal")!.style.display = "none";
|
||||||
|
document.getElementById("themeInfoButtons")!.innerHTML = "";
|
||||||
|
});
|
||||||
|
document.getElementById(`updateTheme`)!.addEventListener("click", () => {
|
||||||
|
console.log("Updating " + manifest.name);
|
||||||
|
ipcRenderer.send("installBDTheme", manifest.updateSrc);
|
||||||
|
document.getElementById("themeInfoModal")!.style.display = "none";
|
||||||
|
document.getElementById("themeInfoButtons")!.innerHTML = "";
|
||||||
|
});
|
||||||
|
}
|
||||||
if (manifest.source != undefined)
|
if (manifest.source != undefined)
|
||||||
document.getElementById(
|
document.getElementById(
|
||||||
"themeInfoButtons"
|
"themeInfoButtons"
|
||||||
|
|
Loading…
Reference in a new issue