mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 07:25:10 +00:00
feat: set background material on select menu change (remove restart requirement)
feat: set background material on select menu change (remove restart r…
This commit is contained in:
commit
4b4de7ea45
4 changed files with 15 additions and 2 deletions
|
@ -50,6 +50,7 @@ export default {
|
|||
get: () => sendSync<Settings>(IpcEvents.GET_SETTINGS),
|
||||
set: (settings: Settings, pathToNotify?: string) => invoke<void>(IpcEvents.SET_SETTINGS, settings, pathToNotify),
|
||||
getSettingsDir: () => invoke<string>(IpcEvents.GET_SETTINGS_DIR),
|
||||
setBackgroundMaterial: (backgroundMaterial: Settings["winBackgroundMaterial"]) => invoke<void>(IpcEvents.SET_BACKGROUND_MATERIAL, backgroundMaterial)
|
||||
},
|
||||
|
||||
quickCss: {
|
||||
|
|
|
@ -246,7 +246,7 @@ function VencordSettings() {
|
|||
</>}
|
||||
|
||||
{needsBackgroundMaterial && <>
|
||||
<Forms.FormTitle tag="h5">Window Background Material (requires restart)</Forms.FormTitle>
|
||||
<Forms.FormTitle tag="h5">Window Background Material</Forms.FormTitle>
|
||||
<Select
|
||||
className={Margins.bottom20}
|
||||
placeholder="Window Background Material"
|
||||
|
@ -277,7 +277,13 @@ function VencordSettings() {
|
|||
value: "acrylic"
|
||||
},
|
||||
]}
|
||||
select={v => settings.winBackgroundMaterial = v}
|
||||
select={
|
||||
v => {
|
||||
settings.winBackgroundMaterial = v;
|
||||
// IPC call to set background material in real time
|
||||
VencordNative.settings.setBackgroundMaterial(v);
|
||||
}
|
||||
}
|
||||
isSelected={v => settings.winBackgroundMaterial === v}
|
||||
serialize={identity} />
|
||||
</>}
|
||||
|
|
|
@ -99,6 +99,11 @@ ipcMain.handle(IpcEvents.GET_THEME_SYSTEM_VALUES, () => ({
|
|||
|
||||
|
||||
export function initIpc(mainWindow: BrowserWindow) {
|
||||
// we need this handler in scope of mainWindow so we can call setBackgroundMaterial
|
||||
ipcMain.handle(IpcEvents.SET_BACKGROUND_MATERIAL, (_, backgroundMaterial) => {
|
||||
mainWindow.setBackgroundMaterial(backgroundMaterial);
|
||||
});
|
||||
|
||||
let quickCssWatcher: FSWatcher | undefined;
|
||||
|
||||
open(QUICKCSS_PATH, "a+").then(fd => {
|
||||
|
|
|
@ -30,6 +30,7 @@ export const enum IpcEvents {
|
|||
GET_SETTINGS_DIR = "VencordGetSettingsDir",
|
||||
GET_SETTINGS = "VencordGetSettings",
|
||||
SET_SETTINGS = "VencordSetSettings",
|
||||
SET_BACKGROUND_MATERIAL = "setBackgroundMaterial",
|
||||
OPEN_EXTERNAL = "VencordOpenExternal",
|
||||
OPEN_QUICKCSS = "VencordOpenQuickCss",
|
||||
GET_UPDATES = "VencordGetUpdates",
|
||||
|
|
Loading…
Add table
Reference in a new issue