diff --git a/README.md b/README.md index 008db79..a2b70ba 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,34 @@ Once ready, add this flake to your system configuration, you'll also need [home- I've specified some basic configuration options to help you get started with initial setup, as well as some simple overrides for common configuration settings I found I was modifying often. These are likely subject to change with future versions as I iron things out. -Refer to [the root configuration](https://github.com/henrysipp/omarchy-nix/blob/main/config.nix) file for more information on what options are available. +Refer to [the root configuration](https://github.com/henrysipp/omarchy-nix/blob/main/config.nix) file for more information on what options are available. + +### Themes + +Omarchy-nix includes several predefined themes: +- `tokyo-night` (default) +- `kanagawa` +- `everforest` +- `catppuccin` +- `nord` +- `gruvbox` +- `gruvbox-light` + +You can also generate a custom theme from any wallpaper image: + +```nix +{ + omarchy = { + theme = "custom"; + customTheme = { + wallpaperPath = ./path/to/your/wallpaper.png; + variant = "dark"; # or "light" for light themes + }; + }; +} +``` + +This will automatically extract colors from your wallpaper and generate a matching color scheme for all Omarchy applications (terminal, editor, launcher, etc.). ## License diff --git a/config.nix b/config.nix index 6c87c1d..7315e64 100644 --- a/config.nix +++ b/config.nix @@ -9,7 +9,7 @@ lib: { description = "Main user's email address"; }; theme = lib.mkOption { - type = lib.types.enum [ + type = lib.types.either (lib.types.enum [ "tokyo-night" "kanagawa" "everforest" @@ -17,10 +17,28 @@ lib: { "nord" "gruvbox" "gruvbox-light" - ]; + "custom" + ]) lib.types.str; default = "tokyo-night"; description = "Theme to use for Omarchy configuration"; }; + customTheme = lib.mkOption { + type = lib.types.submodule { + options = { + wallpaperPath = lib.mkOption { + type = lib.types.path; + description = "Path to the wallpaper image to extract colors from"; + }; + variant = lib.mkOption { + type = lib.types.enum [ "light" "dark" ]; + default = "dark"; + description = "Color scheme variant to extract (light or dark)"; + }; + }; + }; + default = {}; + description = "Custom theme configuration when theme is set to 'custom'"; + }; primary_font = lib.mkOption { type = lib.types.str; default = "Liberation Sans 11"; diff --git a/config/themes/wallpapers/missionctrl.png b/config/themes/wallpapers/missionctrl.png new file mode 100644 index 0000000..65604fe Binary files /dev/null and b/config/themes/wallpapers/missionctrl.png differ diff --git a/lib/selected-wallpaper.nix b/lib/selected-wallpaper.nix index de9ffbd..35c6135 100644 --- a/lib/selected-wallpaper.nix +++ b/lib/selected-wallpaper.nix @@ -21,7 +21,12 @@ config: let ]; }; - selected_wallpaper = builtins.elemAt (wallpapers.${cfg.theme}) 0; + # Handle custom wallpaper path + wallpaper_path = if cfg.theme == "custom" + then toString cfg.customTheme.wallpaperPath + else let + selected_wallpaper = builtins.elemAt (wallpapers.${cfg.theme}) 0; + in "~/Pictures/Wallpapers/${selected_wallpaper}"; in { - wallpaper_path = "~/Pictures/Wallpapers/${selected_wallpaper}"; + inherit wallpaper_path; } diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index c4e6a13..7630787 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -7,7 +7,19 @@ inputs: { packages = import ../packages.nix {inherit pkgs lib; exclude_packages = config.omarchy.exclude_packages;}; themes = import ../themes.nix; - selectedTheme = themes.${config.omarchy.theme}; + + # Handle theme selection - either predefined or custom + selectedTheme = if config.omarchy.theme == "custom" + then themes.custom + else themes.${config.omarchy.theme}; + + # Generate color scheme - either from predefined or from wallpaper + generatedColorScheme = if config.omarchy.theme == "custom" + then (inputs.nix-colors.lib.contrib { inherit pkgs; }).colorSchemeFromPicture { + path = config.omarchy.customTheme.wallpaperPath; + variant = config.omarchy.customTheme.variant; + } + else null; in { imports = [ (import ./hyprland.nix inputs) @@ -35,7 +47,9 @@ in { }; home.packages = packages.homePackages; - colorScheme = inputs.nix-colors.colorSchemes.${selectedTheme.base16-theme}; + colorScheme = if config.omarchy.theme == "custom" + then generatedColorScheme + else inputs.nix-colors.colorSchemes.${selectedTheme.base16-theme}; gtk = { enable = true; diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix index c1a1f34..55347f5 100644 --- a/modules/nixos/hyprland.nix +++ b/modules/nixos/hyprland.nix @@ -7,6 +7,6 @@ inputs: { enable = true; # package = inputs.hyprland.packages.${pkgs.system}.hyprland; package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; - portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; + portalPackage = pkgs.xdg-desktop-portal-hyprland; # Use stable nixpkgs version to fix Qt version mismatch }; } diff --git a/modules/themes.nix b/modules/themes.nix index e541bcd..acb797b 100644 --- a/modules/themes.nix +++ b/modules/themes.nix @@ -29,5 +29,11 @@ base16-theme = "gruvbox-light-medium"; vscode-theme = "Gruvbox Light Medium"; }; + + "custom" = { + # Custom themes don't have predefined base16 schemes (generated dynamically) + # VSCode theme fallback for custom color schemes + vscode-theme = "Tokyo Night"; # Default fallback theme + }; # Add more themes here }