Feat: Custom modules can now be created through a JSON file. (#887)

* Feat: Custom modules can now be created through a JSON file.

* Added the ability to consume labels and icons.

* Add all properties but styling.

* Wrap up implementation.

* Rename custom modules to basic modules to make way for new actually custom modules.
This commit is contained in:
Jas Singh
2025-04-07 01:52:39 -07:00
committed by GitHub
parent 483facfa56
commit 93235f0fb1
31 changed files with 820 additions and 377 deletions

View File

@@ -16,7 +16,7 @@ export const themePages = [
'System Tray',
'Volume Menu',
'Power Menu',
'Custom Modules',
'Basic Modules',
] as const;
export const configPages = [
@@ -28,7 +28,7 @@ export const configPages = [
'Volume',
'Clock Menu',
'Dashboard Menu',
'Custom Modules',
'Basic Modules',
'Power Menu',
] as const;

View File

@@ -30,7 +30,7 @@ export const BarGeneral = (): JSX.Element => {
title="Config"
subtitle="WARNING: Importing a configuration will replace your current configuration settings."
type="config_import"
exportData={{ filePath: CONFIG, themeOnly: false }}
exportData={{ filePath: CONFIG_FILE, themeOnly: false }}
/>
<Option
opt={options.hyprpanel.restartAgs}

View File

@@ -22,7 +22,7 @@ export const MenuTheme = (): JSX.Element => {
title="Theme"
subtitle="WARNING: Importing a theme will replace your current theme color settings."
type="config_import"
exportData={{ filePath: CONFIG, themeOnly: true }}
exportData={{ filePath: CONFIG_FILE, themeOnly: true }}
/>
<Option
opt={options.theme.bar.menus.monochrome}

View File

@@ -272,7 +272,7 @@ export const importFiles = (themeOnly: boolean = false): void => {
iconName: icons.ui.info,
});
const optionsConfigFile = Gio.File.new_for_path(CONFIG);
const optionsConfigFile = Gio.File.new_for_path(CONFIG_FILE);
const [optionsSuccess, optionsContent] = optionsConfigFile.load_contents(null);
@@ -289,7 +289,7 @@ export const importFiles = (themeOnly: boolean = false): void => {
: filterConfigForNonTheme(importedConfig);
optionsConfig = { ...optionsConfig, ...filteredConfig };
saveConfigToFile(optionsConfig, CONFIG);
saveConfigToFile(optionsConfig, CONFIG_FILE);
}
dialog.destroy();
bash(restartCommand.get());