mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-20 03:47:01 -04:00
make Open Themes/Settings folder properly open the folder
This commit is contained in:
parent
2a398985cf
commit
78d3330ccf
6 changed files with 18 additions and 10 deletions
|
@ -48,6 +48,8 @@ window.VencordNative = {
|
||||||
),
|
),
|
||||||
getThemeData: (fileName: string) => DataStore.get(fileName, themeStore),
|
getThemeData: (fileName: string) => DataStore.get(fileName, themeStore),
|
||||||
getSystemValues: async () => ({}),
|
getSystemValues: async () => ({}),
|
||||||
|
|
||||||
|
openFolder: async () => Promise.reject("themes:openFolder is not supported on web"),
|
||||||
},
|
},
|
||||||
|
|
||||||
native: {
|
native: {
|
||||||
|
@ -111,7 +113,8 @@ window.VencordNative = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
set: async (s: Settings) => localStorage.setItem("VencordSettings", JSON.stringify(s)),
|
set: async (s: Settings) => localStorage.setItem("VencordSettings", JSON.stringify(s)),
|
||||||
getSettingsDir: async () => "LocalStorage"
|
getSettingsDir: async () => "LocalStorage",
|
||||||
|
openFolder: async () => Promise.reject("settings:openFolder is not supported on web"),
|
||||||
},
|
},
|
||||||
|
|
||||||
pluginHelpers: {} as any,
|
pluginHelpers: {} as any,
|
||||||
|
|
|
@ -38,6 +38,8 @@ export default {
|
||||||
getThemesList: () => invoke<Array<UserThemeHeader>>(IpcEvents.GET_THEMES_LIST),
|
getThemesList: () => invoke<Array<UserThemeHeader>>(IpcEvents.GET_THEMES_LIST),
|
||||||
getThemeData: (fileName: string) => invoke<string | undefined>(IpcEvents.GET_THEME_DATA, fileName),
|
getThemeData: (fileName: string) => invoke<string | undefined>(IpcEvents.GET_THEME_DATA, fileName),
|
||||||
getSystemValues: () => invoke<Record<string, string>>(IpcEvents.GET_THEME_SYSTEM_VALUES),
|
getSystemValues: () => invoke<Record<string, string>>(IpcEvents.GET_THEME_SYSTEM_VALUES),
|
||||||
|
|
||||||
|
openFolder: () => invoke<void>(IpcEvents.OPEN_THEMES_FOLDER),
|
||||||
},
|
},
|
||||||
|
|
||||||
updater: {
|
updater: {
|
||||||
|
@ -51,6 +53,8 @@ export default {
|
||||||
get: () => sendSync<Settings>(IpcEvents.GET_SETTINGS),
|
get: () => sendSync<Settings>(IpcEvents.GET_SETTINGS),
|
||||||
set: (settings: Settings, pathToNotify?: string) => invoke<void>(IpcEvents.SET_SETTINGS, settings, pathToNotify),
|
set: (settings: Settings, pathToNotify?: string) => invoke<void>(IpcEvents.SET_SETTINGS, settings, pathToNotify),
|
||||||
getSettingsDir: () => invoke<string>(IpcEvents.GET_SETTINGS_DIR),
|
getSettingsDir: () => invoke<string>(IpcEvents.GET_SETTINGS_DIR),
|
||||||
|
|
||||||
|
openFolder: () => invoke<void>(IpcEvents.OPEN_SETTINGS_FOLDER),
|
||||||
},
|
},
|
||||||
|
|
||||||
quickCss: {
|
quickCss: {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import { CspBlockedUrls, useCspErrors } from "@utils/cspViolations";
|
||||||
import { openInviteModal } from "@utils/discord";
|
import { openInviteModal } from "@utils/discord";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { classes } from "@utils/misc";
|
import { classes } from "@utils/misc";
|
||||||
import { relaunch, showItemInFolder } from "@utils/native";
|
import { relaunch } from "@utils/native";
|
||||||
import { useAwaiter, useForceUpdater } from "@utils/react";
|
import { useAwaiter, useForceUpdater } from "@utils/react";
|
||||||
import { getStylusWebStoreUrl } from "@utils/web";
|
import { getStylusWebStoreUrl } from "@utils/web";
|
||||||
import { findLazy } from "@webpack";
|
import { findLazy } from "@webpack";
|
||||||
|
@ -251,7 +251,7 @@ function ThemesTab() {
|
||||||
) : (
|
) : (
|
||||||
<QuickAction
|
<QuickAction
|
||||||
text="Open Themes Folder"
|
text="Open Themes Folder"
|
||||||
action={() => showItemInFolder(themeDir!)}
|
action={() => VencordNative.themes.openFolder()}
|
||||||
disabled={themeDirPending}
|
disabled={themeDirPending}
|
||||||
Icon={FolderIcon}
|
Icon={FolderIcon}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -26,8 +26,7 @@ import { gitRemote } from "@shared/vencordUserAgent";
|
||||||
import { DONOR_ROLE_ID, VENCORD_GUILD_ID } from "@utils/constants";
|
import { DONOR_ROLE_ID, VENCORD_GUILD_ID } from "@utils/constants";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { identity, isPluginDev } from "@utils/misc";
|
import { identity, isPluginDev } from "@utils/misc";
|
||||||
import { relaunch, showItemInFolder } from "@utils/native";
|
import { relaunch } from "@utils/native";
|
||||||
import { useAwaiter } from "@utils/react";
|
|
||||||
import { Button, Forms, GuildMemberStore, React, Select, Switch, UserStore } from "@webpack/common";
|
import { Button, Forms, GuildMemberStore, React, Select, Switch, UserStore } from "@webpack/common";
|
||||||
|
|
||||||
import BadgeAPI from "../../plugins/_api/badges";
|
import BadgeAPI from "../../plugins/_api/badges";
|
||||||
|
@ -53,9 +52,6 @@ type KeysOfType<Object, Type> = {
|
||||||
}[keyof Object];
|
}[keyof Object];
|
||||||
|
|
||||||
function VencordSettings() {
|
function VencordSettings() {
|
||||||
const [settingsDir, , settingsDirPending] = useAwaiter(VencordNative.settings.getSettingsDir, {
|
|
||||||
fallbackValue: "Loading..."
|
|
||||||
});
|
|
||||||
const settings = useSettings();
|
const settings = useSettings();
|
||||||
|
|
||||||
const donateImage = React.useMemo(() => Math.random() > 0.5 ? DEFAULT_DONATE_IMAGE : SHIGGY_DONATE_IMAGE, []);
|
const donateImage = React.useMemo(() => Math.random() > 0.5 ? DEFAULT_DONATE_IMAGE : SHIGGY_DONATE_IMAGE, []);
|
||||||
|
@ -171,7 +167,7 @@ function VencordSettings() {
|
||||||
<QuickAction
|
<QuickAction
|
||||||
Icon={FolderIcon}
|
Icon={FolderIcon}
|
||||||
text="Open Settings Folder"
|
text="Open Settings Folder"
|
||||||
action={() => showItemInFolder(settingsDir)}
|
action={() => VencordNative.settings.openFolder()}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<QuickAction
|
<QuickAction
|
||||||
|
|
|
@ -30,7 +30,7 @@ import { join, normalize } from "path";
|
||||||
|
|
||||||
import { registerCspIpcHandlers } from "./csp/manager";
|
import { registerCspIpcHandlers } from "./csp/manager";
|
||||||
import { getThemeInfo, stripBOM, UserThemeHeader } from "./themes";
|
import { getThemeInfo, stripBOM, UserThemeHeader } from "./themes";
|
||||||
import { ALLOWED_PROTOCOLS, QUICKCSS_PATH, THEMES_DIR } from "./utils/constants";
|
import { ALLOWED_PROTOCOLS, QUICKCSS_PATH, SETTINGS_DIR, THEMES_DIR } from "./utils/constants";
|
||||||
import { makeLinksOpenExternally } from "./utils/externalLinks";
|
import { makeLinksOpenExternally } from "./utils/externalLinks";
|
||||||
|
|
||||||
mkdirSync(THEMES_DIR, { recursive: true });
|
mkdirSync(THEMES_DIR, { recursive: true });
|
||||||
|
@ -100,6 +100,8 @@ ipcMain.handle(IpcEvents.GET_THEME_SYSTEM_VALUES, () => ({
|
||||||
"os-accent-color": `#${systemPreferences.getAccentColor?.() || ""}`
|
"os-accent-color": `#${systemPreferences.getAccentColor?.() || ""}`
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
ipcMain.handle(IpcEvents.OPEN_THEMES_FOLDER, () => shell.openPath(THEMES_DIR));
|
||||||
|
ipcMain.handle(IpcEvents.OPEN_SETTINGS_FOLDER, () => shell.openPath(SETTINGS_DIR));
|
||||||
|
|
||||||
export function initIpc(mainWindow: BrowserWindow) {
|
export function initIpc(mainWindow: BrowserWindow) {
|
||||||
let quickCssWatcher: FSWatcher | undefined;
|
let quickCssWatcher: FSWatcher | undefined;
|
||||||
|
|
|
@ -46,4 +46,7 @@ export const enum IpcEvents {
|
||||||
CSP_IS_DOMAIN_ALLOWED = "VencordCspIsDomainAllowed",
|
CSP_IS_DOMAIN_ALLOWED = "VencordCspIsDomainAllowed",
|
||||||
CSP_REMOVE_OVERRIDE = "VencordCspRemoveOverride",
|
CSP_REMOVE_OVERRIDE = "VencordCspRemoveOverride",
|
||||||
CSP_REQUEST_ADD_OVERRIDE = "VencordCspRequestAddOverride",
|
CSP_REQUEST_ADD_OVERRIDE = "VencordCspRequestAddOverride",
|
||||||
|
|
||||||
|
OPEN_THEMES_FOLDER = "VencordOpenThemesFolder",
|
||||||
|
OPEN_SETTINGS_FOLDER = "VencordOpenSettingsFolder",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue