Files
custum-hyprpanel/scss/options_trackers.ts
Jas Singh f5b75edbed Implemented Wallpaper Selector and Matugen's Wallpaper based auto-theming. (#73)
* Implement matugen - WIP

* Added matugen

* Add types and cleanup code

* Matugen implementation updates and added more options such as scheme and contrast.

* Code cleanup and matugen settings renamed for clarity.

* Makon maroon a primary matugen color.

* Updates to handle variations of matugen colors

* Finalizing matugen and wrapping up variations.

* Minor styling updates of the settings dialog.

* Do a swww dependency check.

* Dependency logic update

* Switch shouldn't double trigger notifications now when checking dependency.

* Logic was inverted

* Add matugen to dependency checker.

* Fixed dependency checking conditional

* Update dependency list in readme and check for matugen before doing matugen operations

* Styling fixes

* OSD Fix

* Remove unused code from wallpaper service.

* Color fixes for matugen.

* Nix updates for new dependencies

* Change default wallpaper to empty.

* Added custom notification service for startup, cleaned up code and updated readme.
2024-08-07 21:43:31 -07:00

47 lines
1.3 KiB
TypeScript

import icons from "lib/icons";
import { Notify, isAnImage } from "lib/utils";
import options from "options";
import Wallpaper from "services/Wallpaper";
const { matugen } = options.theme;
const { mode, scheme_type, contrast } = options.theme.matugen_settings;
const ensureMatugenWallpaper = (): void => {
const wallpaperPath = options.wallpaper.image.value;
if (matugen.value && (!options.wallpaper.image.value.length || !isAnImage(wallpaperPath))) {
Notify({
summary: "Matugen Failed",
body: "Please select a wallpaper in 'Theming > General' first.",
iconName: icons.ui.warning,
timeout: 7000
})
matugen.value = false;
}
}
export const initializeTrackers = (resetCssFunc: Function) => {
matugen.connect("changed", () => {
ensureMatugenWallpaper();
options.resetTheme();
})
mode.connect("changed", () => {
options.resetTheme();
})
scheme_type.connect("changed", () => {
options.resetTheme();
})
contrast.connect("changed", () => {
options.resetTheme();
})
Wallpaper.connect("changed", () => {
if (options.theme.matugen.value) {
options.resetTheme();
resetCssFunc();
}
})
}