Adding icons

This commit is contained in:
metacryst
2026-05-12 06:44:56 -05:00
parent 6251855ba2
commit b0f4264ef5
17 changed files with 21 additions and 155 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ package-lock.json
master.forms master.forms
forms/app.log forms/app.log
.DS_Store .DS_Store
dist

BIN
_/icon.icns Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
_/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@@ -38,7 +38,7 @@
background: var(--main); background: var(--main);
} }
</style> </style>
<script>window.config = { UI: 'http://localhost:10002', SERVER: 'https://frm.so' }</script> <script>window.config = { UI: 'https://frm.so', SERVER: 'https://frm.so' }</script>
<script type="module"> <script type="module">
await import('./desktoputil.js') await import('./desktoputil.js')
@@ -71,7 +71,7 @@
try { try {
await appendStylesheet(`${config.UI}/_/code/shared.css`, { replaceExisting: true }); await appendStylesheet(`${config.UI}/_/code/shared.css`, { replaceExisting: true });
await appendScript(window.config.UI + '/_/code/quill.js') await appendScript(window.config.UI + '/_/code/quill.js')
await appendScript(window.config.UI + '/47382915/app.js', true) await appendScript(window.config.UI + '/47382915/app/index.js', true)
} catch (e) { } catch (e) {
document.body.innerHTML = ` document.body.innerHTML = `
<style> <style>

151
index.js
View File

@@ -1,151 +0,0 @@
import { app, BrowserWindow, globalShortcut, ipcMain, protocol, net } from 'electron';
import path from 'path'
import fs from 'fs'
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const WINDOW_SHORTCUTS = [
process.platform === "darwin" ? "Command+R" : "Control+R",
"\\"
];
class App {
devToolsOpened = false;
createWindow({onTop = false}) {
const win = new BrowserWindow({
width: 1200,
height: 800,
frame: false,
show: false,
titleBarStyle: "customButtonsOnHover",
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true,
nodeIntegration: false,
webviewTag: true,
}
});
if(onTop) {
win.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true }); // necessary for full screen
win.setAlwaysOnTop(true, 'screen-saver', 1); // necessary so it doesn't bring you back out of full screen when spawned
}
protocol.handle('app', (request) => {
const url = new URL(request.url);
let filePath = path.join(__dirname, url.pathname);
// if file doesn't exist, fall back to index.html
if(filePath.includes("desktoputil")) {
filePath = path.join(__dirname, 'desktoputil.js');
}
else if (!fs.existsSync(filePath) || fs.statSync(filePath).isDirectory()) {
filePath = path.join(__dirname, 'index.html');
}
return net.fetch(`file://${filePath}`);
});
win.loadURL('app://local/');
win.on("focus", () => {
win.setVibrancy("appearance-based"); // full colors
});
win.on("blur", () => {
win.setVibrancy("selection"); // dims colors
});
win.webContents.on('did-finish-load', () => {
win.show();
});
win.webContents.on('did-fail-load', (e, code, desc) => {
console.log('Webview failed:', desc);
});
win.on('closed', () => {
for (const key of WINDOW_SHORTCUTS) {
globalShortcut.unregister(key);
}
});
}
toggleDevTools(win) {
if (this.devToolsOpened) {
win.closeDevTools();
} else {
win.openDevTools();
}
this.devToolsOpened = !this.devToolsOpened;
}
registerShortcuts() {
globalShortcut.register('CommandOrControl+Shift+Space', function CreateWindow() {
this.createWindow({onTop: true});
});
app.on("browser-window-focus", function RegisterWindowOnFocus() {
const focused = BrowserWindow.getFocusedWindow();
if (!focused) return;
let WINDOW_SHORTCUTS = [
process.platform === "darwin" ? "Command+R" : "Control+R",
"\\"
];
// Reload
globalShortcut.register(WINDOW_SHORTCUTS[0], () => {
focused.reload();
});
// Devtools
globalShortcut.register(WINDOW_SHORTCUTS[1], () => {
toggleDevTools(focused);
});
});
app.on("browser-window-blur", function UnregisterWindowOnUnfocus() {
for (const key of WINDOW_SHORTCUTS) {
globalShortcut.unregister(key);
}
});
}
constructor() {
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
this.createWindow({onTop: false});
}
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});
app.on("ready", async () => {
this.createWindow({onTop: false});
this.registerShortcuts()
});
ipcMain.on('focus-window', () => {
const win = BrowserWindow.getAllWindows()[0];
win?.show();
win?.focus();
});
ipcMain.on('set-badge', (e, count) => {
app.setBadgeCount(count);
});
protocol.registerSchemesAsPrivileged([
{ scheme: 'app', privileges: { standard: true, secure: true, supportFetchAPI: true, corsEnabled: true } }
]);
}
}
new App()

View File

@@ -4,9 +4,12 @@
"type": "module", "type": "module",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "electron ." "start": "electron .",
"package": "electron-packager . Forum --platform=darwin --arch=arm64 --icon=./icon.icns --out=dist --overwrite",
"copyApp": "cp -R dist/Forum-darwin-arm64/Forum.app /Applications/"
}, },
"devDependencies": { "devDependencies": {
"@electron/packager": "^20.0.0",
"electron": "^30.0.0" "electron": "^30.0.0"
}, },
"dependencies": { "dependencies": {

13
readme.md Normal file
View File

@@ -0,0 +1,13 @@
# Generate all the required sizes from your source PNG
sips -z 16 16 _/icon.png --out icon.iconset/icon_16x16.png
sips -z 32 32 _/icon.png --out icon.iconset/icon_16x16@2x.png
sips -z 32 32 _/icon.png --out icon.iconset/icon_32x32.png
sips -z 64 64 _/icon.png --out icon.iconset/icon_32x32@2x.png
sips -z 128 128 _/icon.png --out icon.iconset/icon_128x128.png
sips -z 256 256 _/icon.png --out icon.iconset/icon_128x128@2x.png
sips -z 256 256 _/icon.png --out icon.iconset/icon_256x256.png
sips -z 512 512 _/icon.png --out icon.iconset/icon_256x256@2x.png
sips -z 512 512 _/icon.png --out icon.iconset/icon_512x512.png
cp _/icon.png icon.iconset/icon_512x512@2x.png
iconutil -c icns icon.iconset