forked from Shinonome/omarchy-nix
Add custom theme support with wallpaper-based color extraction (#6)
* Add custom theme support with wallpaper-based color extraction
- Extended theme option to accept "custom" value
- Added customTheme configuration with wallpaperPath and variant options
- Integrated nix-colors colorSchemeFromPicture for dynamic color generation
- Updated wallpaper selection to handle custom paths
- Added VSCode theme fallback for custom color schemes
- Fixed nix-colors contrib function call (requires pkgs argument)
- Maintains full backward compatibility with existing themes
Users can now generate themes from their own wallpapers:
omarchy = {
theme = "custom";
customTheme = {
wallpaperPath = ./wallpapers/my-image.png;
variant = "dark"; # or "light"
};
};
* Fix: Screen sharing broken due to Qt library version mismatch
File changed: modules/nixos/hyprland.nix
Problem:
The omarchy-nix configuration was using xdg-desktop-portal-hyprland from the hyprland flake input, which had a Qt library version mismatch (6.9.1 vs 6.9.0). This caused the
hyprland-share-picker to crash with "Cannot mix incompatible Qt library" errors, preventing screen sharing from working.
Solution:
Changed the portalPackage from the hyprland flake version to the stable nixpkgs version:
- 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
Why this works:
- The stable nixpkgs version of xdg-desktop-portal-hyprland has consistent Qt library versions
- This matches the working configuration used on other NixOS Hyprland setups
- Maintains all screen sharing functionality while avoiding the Qt version conflict
This commit is contained in:
@@ -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.
|
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
|
## License
|
||||||
|
|
||||||
|
|||||||
+20
-2
@@ -9,7 +9,7 @@ lib: {
|
|||||||
description = "Main user's email address";
|
description = "Main user's email address";
|
||||||
};
|
};
|
||||||
theme = lib.mkOption {
|
theme = lib.mkOption {
|
||||||
type = lib.types.enum [
|
type = lib.types.either (lib.types.enum [
|
||||||
"tokyo-night"
|
"tokyo-night"
|
||||||
"kanagawa"
|
"kanagawa"
|
||||||
"everforest"
|
"everforest"
|
||||||
@@ -17,10 +17,28 @@ lib: {
|
|||||||
"nord"
|
"nord"
|
||||||
"gruvbox"
|
"gruvbox"
|
||||||
"gruvbox-light"
|
"gruvbox-light"
|
||||||
];
|
"custom"
|
||||||
|
]) lib.types.str;
|
||||||
default = "tokyo-night";
|
default = "tokyo-night";
|
||||||
description = "Theme to use for Omarchy configuration";
|
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 {
|
primary_font = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "Liberation Sans 11";
|
default = "Liberation Sans 11";
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
@@ -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 {
|
in {
|
||||||
wallpaper_path = "~/Pictures/Wallpapers/${selected_wallpaper}";
|
inherit wallpaper_path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,19 @@ inputs: {
|
|||||||
packages = import ../packages.nix {inherit pkgs lib; exclude_packages = config.omarchy.exclude_packages;};
|
packages = import ../packages.nix {inherit pkgs lib; exclude_packages = config.omarchy.exclude_packages;};
|
||||||
|
|
||||||
themes = import ../themes.nix;
|
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 {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(import ./hyprland.nix inputs)
|
(import ./hyprland.nix inputs)
|
||||||
@@ -35,7 +47,9 @@ in {
|
|||||||
};
|
};
|
||||||
home.packages = packages.homePackages;
|
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 = {
|
gtk = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ inputs: {
|
|||||||
enable = true;
|
enable = true;
|
||||||
# package = inputs.hyprland.packages.${pkgs.system}.hyprland;
|
# package = inputs.hyprland.packages.${pkgs.system}.hyprland;
|
||||||
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.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
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,5 +29,11 @@
|
|||||||
base16-theme = "gruvbox-light-medium";
|
base16-theme = "gruvbox-light-medium";
|
||||||
vscode-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
|
# Add more themes here
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user