mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Add transparency option
This commit is contained in:
parent
97589220f4
commit
f523f92367
9 changed files with 2338 additions and 46 deletions
21
.github/workflows/dev.yml
vendored
21
.github/workflows/dev.yml
vendored
|
@ -19,11 +19,14 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
run: npm i -g pnpm
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
run: npm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: Install Electron-Builder
|
- name: Install Electron-Builder
|
||||||
run: npm install -g electron-builder
|
run: pnpm install -g electron-builder
|
||||||
|
|
||||||
- name: Replace the version number
|
- name: Replace the version number
|
||||||
run: cat src/utils.ts | sed -e 's/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/DEV/g' | tee src/utils.ts > /dev/null
|
run: cat src/utils.ts | sed -e 's/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/DEV/g' | tee src/utils.ts > /dev/null
|
||||||
|
@ -53,11 +56,14 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
run: npm i -g pnpm
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
run: npm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: Install Electron-Builder
|
- name: Install Electron-Builder
|
||||||
run: npm install -g electron-builder
|
run: pnpm install -g electron-builder
|
||||||
|
|
||||||
- name: Replace the version number
|
- name: Replace the version number
|
||||||
run: cat src/utils.ts | sed -e 's/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/DEV/g' | tee src/utils.ts > /dev/null
|
run: cat src/utils.ts | sed -e 's/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/DEV/g' | tee src/utils.ts > /dev/null
|
||||||
|
@ -84,11 +90,14 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
run: npm i -g pnpm
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
run: npm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: Install Electron-Builder
|
- name: Install Electron-Builder
|
||||||
run: npm install -g electron-builder
|
run: pnpm install -g electron-builder
|
||||||
|
|
||||||
- name: Replace the version number
|
- name: Replace the version number
|
||||||
run: (Get-Content src/utils.ts) -replace "\d\.\d\.\d", "DEV" | Out-File src/utils.ts
|
run: (Get-Content src/utils.ts) -replace "\d\.\d\.\d", "DEV" | Out-File src/utils.ts
|
||||||
|
|
21
.github/workflows/stable.yml
vendored
21
.github/workflows/stable.yml
vendored
|
@ -19,11 +19,14 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
run: npm i -g pnpm
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
run: npm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: Install Electron-Builder
|
- name: Install Electron-Builder
|
||||||
run: npm install -g electron-builder
|
run: pnpm install -g electron-builder
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build && electron-builder --linux && electron-builder --arm64 --linux && electron-builder --armv7l --linux
|
run: npm run build && electron-builder --linux && electron-builder --arm64 --linux && electron-builder --armv7l --linux
|
||||||
|
@ -51,11 +54,14 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
run: npm i -g pnpm
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
run: npm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: Install Electron-Builder
|
- name: Install Electron-Builder
|
||||||
run: npm install -g electron-builder
|
run: pnpm install -g electron-builder
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build && electron-builder --macos
|
run: npm run build && electron-builder --macos
|
||||||
|
@ -83,11 +89,14 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
run: npm i -g pnpm
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
run: npm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: Install Electron-Builder
|
- name: Install Electron-Builder
|
||||||
run: npm install -g electron-builder
|
run: pnpm install -g electron-builder
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build && electron-builder --windows
|
run: npm run build && electron-builder --windows
|
||||||
|
|
|
@ -64,9 +64,9 @@ ArmCord is also available in [Pi-Apps](https://github.com/Botspot/pi-apps).
|
||||||
|
|
||||||
|
|
||||||
### Compiling:
|
### Compiling:
|
||||||
Alternatively you can run ArmCord from source (NodeJS and npm required):
|
Alternatively you can run ArmCord from source (NodeJS and pnpm required):
|
||||||
1. Clone ArmCord repo: `git clone https://github.com/ArmCord/ArmCord.git`
|
1. Clone ArmCord repo: `git clone https://github.com/ArmCord/ArmCord.git`
|
||||||
2. Run `npm install` to install dependencies
|
2. Run `pnpm install` to install dependencies
|
||||||
3. Build with `npm run build`
|
3. Build with `npm run build`
|
||||||
4. Compile/Package with `npm run package`
|
4. Compile/Package with `npm run package`
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
"typescript": "^4.7.3"
|
"typescript": "^4.7.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@pyke/vibe": "^0.3.0",
|
||||||
"electron-context-menu": "github:ArmCord/electron-context-menu",
|
"electron-context-menu": "github:ArmCord/electron-context-menu",
|
||||||
"os-locale": "^6.0.2",
|
"os-locale": "^6.0.2",
|
||||||
"v8-compile-cache": "^2.3.0",
|
"v8-compile-cache": "^2.3.0",
|
||||||
|
|
2226
pnpm-lock.yaml
Normal file
2226
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load diff
|
@ -5,7 +5,7 @@ import {getConfig, checkIfConfigExists, injectElectronFlags} from "./utils";
|
||||||
import "./extensions/mods";
|
import "./extensions/mods";
|
||||||
import "./extensions/plugin";
|
import "./extensions/plugin";
|
||||||
import "./tray";
|
import "./tray";
|
||||||
import {createCustomWindow, createNativeWindow} from "./window";
|
import {createCustomWindow, createNativeWindow, createTransparentWindow} from "./window";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
export var iconPath: string;
|
export var iconPath: string;
|
||||||
export var settings: any;
|
export var settings: any;
|
||||||
|
@ -40,6 +40,9 @@ app.whenReady().then(async () => {
|
||||||
case "native":
|
case "native":
|
||||||
createNativeWindow();
|
createNativeWindow();
|
||||||
break;
|
break;
|
||||||
|
case "transparent":
|
||||||
|
createTransparentWindow();
|
||||||
|
break;
|
||||||
case "basic":
|
case "basic":
|
||||||
createNativeWindow();
|
createNativeWindow();
|
||||||
break;
|
break;
|
||||||
|
|
30
src/tray.ts
30
src/tray.ts
|
@ -20,8 +20,7 @@ app.whenReady().then(async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (process.platform == "darwin" && trayPath.getSize().height > 22)
|
if (process.platform == "darwin" && trayPath.getSize().height > 22) trayPath = trayPath.resize({height: 22});
|
||||||
trayPath = trayPath.resize({height: 22});
|
|
||||||
|
|
||||||
if ((await getConfig("windowStyle")) == "basic") {
|
if ((await getConfig("windowStyle")) == "basic") {
|
||||||
var clientName = (await getConfig("clientName")) ?? "ArmCord";
|
var clientName = (await getConfig("clientName")) ?? "ArmCord";
|
||||||
|
@ -32,12 +31,12 @@ app.whenReady().then(async () => {
|
||||||
{
|
{
|
||||||
label: `Finish the setup first!`,
|
label: `Finish the setup first!`,
|
||||||
enabled: false
|
enabled: false
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: `Quit ${clientName}`,
|
label: `Quit ${clientName}`,
|
||||||
click: async function () {
|
click: async function () {
|
||||||
fs.unlink(await getConfigLocation(), (err) => {
|
fs.unlink(await getConfigLocation(), (err) => {
|
||||||
if (err)
|
if (err) throw err;
|
||||||
throw err;
|
|
||||||
|
|
||||||
console.log('Closed during setup. "settings.json" was deleted');
|
console.log('Closed during setup. "settings.json" was deleted');
|
||||||
app.quit();
|
app.quit();
|
||||||
|
@ -52,7 +51,8 @@ app.whenReady().then(async () => {
|
||||||
click: function () {
|
click: function () {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: `Quit ${clientName}`,
|
label: `Quit ${clientName}`,
|
||||||
click: function () {
|
click: function () {
|
||||||
let [width, height] = mainWindow.getSize();
|
let [width, height] = mainWindow.getSize();
|
||||||
|
@ -74,12 +74,12 @@ app.whenReady().then(async () => {
|
||||||
{
|
{
|
||||||
label: `Finish the setup first!`,
|
label: `Finish the setup first!`,
|
||||||
enabled: false
|
enabled: false
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: `Quit ${clientName}`,
|
label: `Quit ${clientName}`,
|
||||||
click: async function () {
|
click: async function () {
|
||||||
fs.unlink(await getConfigLocation(), (err) => {
|
fs.unlink(await getConfigLocation(), (err) => {
|
||||||
if (err)
|
if (err) throw err;
|
||||||
throw err;
|
|
||||||
|
|
||||||
console.log('Closed during setup. "settings.json" was deleted');
|
console.log('Closed during setup. "settings.json" was deleted');
|
||||||
app.quit();
|
app.quit();
|
||||||
|
@ -109,15 +109,18 @@ app.whenReady().then(async () => {
|
||||||
click: function () {
|
click: function () {
|
||||||
createSettingsWindow();
|
createSettingsWindow();
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: "Support Discord Server",
|
label: "Support Discord Server",
|
||||||
click: function () {
|
click: function () {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
mainWindow.loadURL("https://discord.gg/TnhxcqynZ2");
|
mainWindow.loadURL("https://discord.gg/TnhxcqynZ2");
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
type: "separator"
|
type: "separator"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: `Quit ${clientName}`,
|
label: `Quit ${clientName}`,
|
||||||
click: function () {
|
click: function () {
|
||||||
app.quit();
|
app.quit();
|
||||||
|
@ -126,7 +129,8 @@ app.whenReady().then(async () => {
|
||||||
]);
|
]);
|
||||||
tray.setContextMenu(contextMenu);
|
tray.setContextMenu(contextMenu);
|
||||||
}
|
}
|
||||||
} tray.setToolTip(clientName);
|
}
|
||||||
|
tray.setToolTip(clientName);
|
||||||
tray.on("click", function () {
|
tray.on("click", function () {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {app, dialog} from "electron";
|
import {app, dialog} from "electron";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import vibe from "@pyke/vibe";
|
||||||
export var firstRun: boolean;
|
export var firstRun: boolean;
|
||||||
export var contentPath: string;
|
export var contentPath: string;
|
||||||
|
export var transparency: boolean;
|
||||||
//utility functions that are used all over the codebase or just too obscure to be put in the file used in
|
//utility functions that are used all over the codebase or just too obscure to be put in the file used in
|
||||||
export function addStyle(styleString: string) {
|
export function addStyle(styleString: string) {
|
||||||
const style = document.createElement("style");
|
const style = document.createElement("style");
|
||||||
|
@ -118,6 +120,11 @@ export async function injectElectronFlags() {
|
||||||
default:
|
default:
|
||||||
console.log("No performance modes set");
|
console.log("No performance modes set");
|
||||||
}
|
}
|
||||||
|
if ((await getConfig("windowStyle")) == "transparent") {
|
||||||
|
console.log("Transparent mode enabled");
|
||||||
|
vibe.setup(app);
|
||||||
|
transparency = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export async function setLang(language: string) {
|
export async function setLang(language: string) {
|
||||||
const langConfigFile = path.join(app.getPath("userData"), "/storage/") + "lang.json";
|
const langConfigFile = path.join(app.getPath("userData"), "/storage/") + "lang.json";
|
||||||
|
|
|
@ -4,7 +4,16 @@
|
||||||
// I'm sorry for this mess but I'm not sure how to fix it.
|
// I'm sorry for this mess but I'm not sure how to fix it.
|
||||||
import {BrowserWindow, shell, app, dialog, nativeImage} from "electron";
|
import {BrowserWindow, shell, app, dialog, nativeImage} from "electron";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, setConfig, setLang, setWindowState} from "./utils";
|
import {
|
||||||
|
checkIfConfigIsBroken,
|
||||||
|
firstRun,
|
||||||
|
getConfig,
|
||||||
|
contentPath,
|
||||||
|
setConfig,
|
||||||
|
setLang,
|
||||||
|
setWindowState,
|
||||||
|
transparency
|
||||||
|
} from "./utils";
|
||||||
import {registerIpc} from "./ipc";
|
import {registerIpc} from "./ipc";
|
||||||
import {setMenu} from "./menu";
|
import {setMenu} from "./menu";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
|
@ -12,6 +21,7 @@ import startServer from "./socket";
|
||||||
import contextMenu from "electron-context-menu";
|
import contextMenu from "electron-context-menu";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import {tray} from "./tray";
|
import {tray} from "./tray";
|
||||||
|
import vibe from "@pyke/vibe";
|
||||||
import {iconPath} from "./main";
|
import {iconPath} from "./main";
|
||||||
export let mainWindow: BrowserWindow;
|
export let mainWindow: BrowserWindow;
|
||||||
export let inviteWindow: BrowserWindow;
|
export let inviteWindow: BrowserWindow;
|
||||||
|
@ -41,6 +51,11 @@ contextMenu({
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
async function doAfterDefiningTheWindow() {
|
async function doAfterDefiningTheWindow() {
|
||||||
|
if (transparency) {
|
||||||
|
vibe.applyEffect(mainWindow, "acrylic");
|
||||||
|
vibe.setDarkMode(mainWindow);
|
||||||
|
mainWindow.show();
|
||||||
|
}
|
||||||
var ignoreProtocolWarning = await getConfig("ignoreProtocolWarning");
|
var ignoreProtocolWarning = await getConfig("ignoreProtocolWarning");
|
||||||
await checkIfConfigIsBroken();
|
await checkIfConfigIsBroken();
|
||||||
registerIpc();
|
registerIpc();
|
||||||
|
@ -54,18 +69,18 @@ async function doAfterDefiningTheWindow() {
|
||||||
}
|
}
|
||||||
mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36`; //fake useragent for screenshare to work
|
mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36`; //fake useragent for screenshare to work
|
||||||
}
|
}
|
||||||
const gotTheLock = app.requestSingleInstanceLock()
|
const gotTheLock = app.requestSingleInstanceLock();
|
||||||
|
|
||||||
if (!gotTheLock) {
|
if (!gotTheLock) {
|
||||||
app.quit()
|
app.quit();
|
||||||
} else {
|
} else {
|
||||||
app.on('second-instance', (event, commandLine, workingDirectory) => {
|
app.on("second-instance", (event, commandLine, workingDirectory) => {
|
||||||
// i love stack overflow
|
// i love stack overflow
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
mainWindow.restore()
|
mainWindow.restore();
|
||||||
mainWindow.focus()
|
mainWindow.focus();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
mainWindow.webContents.setWindowOpenHandler(({url}) => {
|
mainWindow.webContents.setWindowOpenHandler(({url}) => {
|
||||||
if (url.startsWith("https:" || url.startsWith("http:") || url.startsWith("mailto:"))) {
|
if (url.startsWith("https:" || url.startsWith("http:") || url.startsWith("mailto:"))) {
|
||||||
|
@ -252,7 +267,25 @@ export function createNativeWindow() {
|
||||||
});
|
});
|
||||||
doAfterDefiningTheWindow();
|
doAfterDefiningTheWindow();
|
||||||
}
|
}
|
||||||
|
export function createTransparentWindow() {
|
||||||
|
mainWindow = new BrowserWindow({
|
||||||
|
width: 300,
|
||||||
|
height: 350,
|
||||||
|
title: "ArmCord",
|
||||||
|
darkTheme: true,
|
||||||
|
icon: iconPath,
|
||||||
|
frame: true,
|
||||||
|
backgroundColor: "#00000000",
|
||||||
|
show: false,
|
||||||
|
autoHideMenuBar: true,
|
||||||
|
webPreferences: {
|
||||||
|
sandbox: false,
|
||||||
|
preload: path.join(__dirname, "preload/preload.js"),
|
||||||
|
spellcheck: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
doAfterDefiningTheWindow();
|
||||||
|
}
|
||||||
export function createInviteWindow() {
|
export function createInviteWindow() {
|
||||||
inviteWindow = new BrowserWindow({
|
inviteWindow = new BrowserWindow({
|
||||||
width: 800,
|
width: 800,
|
||||||
|
|
Loading…
Reference in a new issue