Updated some theming
This commit is contained in:
		
							parent
							
								
									2a8fcf627b
								
							
						
					
					
						commit
						e10079e578
					
				| @ -11,26 +11,30 @@ let | |||||||
| in | in | ||||||
| { | { | ||||||
|   options.desktop.theming.background = { |   options.desktop.theming.background = { | ||||||
|     path = mkOption { |     image = { | ||||||
|       type = types.str; |       url = mkOption { | ||||||
|       default = "minimal/a_flower_on_a_dark_background.png"; |         type = types.str; | ||||||
|       description = "Path to the background image."; |         default = "https://raw.githubusercontent.com/dharmx/walls/refs/heads/main/digital/a_drawing_of_a_spider_on_a_white_surface.png"; | ||||||
|     }; |         description = "URL to the background image."; | ||||||
|     themed = mkEnableOption "themed background"; |       }; | ||||||
|     invert = mkEnableOption "invert background"; |       hash = mkOption { | ||||||
|     src = mkOption { |         type = types.str; | ||||||
|       default = pkgs.fetchFromGitHub { |         default = "sha256-eCEjM7R9yeHNhZZtvHjrgkfwT25JA7FeMoVwnQ887CQ="; | ||||||
|         owner = "dharmx"; |         description = "SHA256 hash of the background image."; | ||||||
|         repo = "walls"; |  | ||||||
|         rev = "6bf4d733ebf2b484a37c17d742eb47e5139e6a14"; |  | ||||||
|         sha256 = "sha256-M96jJy3L0a+VkJ+DcbtrRAquwDWaIG9hAUxenr/TcQU="; |  | ||||||
|       }; |       }; | ||||||
|     }; |     }; | ||||||
|  |     themed = mkEnableOption "themed background"; | ||||||
|  |     inverted = mkEnableOption "invert background"; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   config = |   config = | ||||||
|     with pkgs; |     with pkgs; | ||||||
|     let |     let | ||||||
|  |       src = pkgs.fetchurl { | ||||||
|  |         url = cfg.image.url; | ||||||
|  |         hash = cfg.image.hash; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|       theme = writeTextFile { |       theme = writeTextFile { | ||||||
|         name = "gowall-theme"; |         name = "gowall-theme"; | ||||||
|         text = builtins.toJSON { |         text = builtins.toJSON { | ||||||
| @ -61,45 +65,56 @@ in | |||||||
|         executable = true; |         executable = true; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|  |       fileExtension = | ||||||
|  |         name: | ||||||
|  |         let | ||||||
|  |           parts = splitString "." name; | ||||||
|  |         in | ||||||
|  |         if length parts > 1 then lists.last parts else ""; | ||||||
|  | 
 | ||||||
|  |       fileName = | ||||||
|  |         name: | ||||||
|  |         let | ||||||
|  |           parts = splitString "/" name; | ||||||
|  |         in | ||||||
|  |         if length parts > 1 then lists.last parts else name; | ||||||
|  | 
 | ||||||
|  |       image = fileName cfg.image.url; | ||||||
|  | 
 | ||||||
|       background-themed = stdenv.mkDerivation { |       background-themed = stdenv.mkDerivation { | ||||||
|         name = "background-themed-1.0.0"; |         name = "background-themed-1.0.0"; | ||||||
|         src = cfg.src; |         src = src; | ||||||
| 
 | 
 | ||||||
|         buildInputs = [ |         buildInputs = [ | ||||||
|           gowall |           gowall | ||||||
|           imagemagick |           imagemagick | ||||||
|           (writeShellScriptBin "xdg-open" "") |           (writeShellScriptBin "xdg-open" "") | ||||||
|  |           tree | ||||||
|         ]; |         ]; | ||||||
| 
 | 
 | ||||||
|         buildPhase = |         unpackPhase = '' | ||||||
|           if cfg.themed then |           cp ${src} ./${image} | ||||||
|             if cfg.invert then |           chmod u+w ./${image} | ||||||
|               '' |         ''; | ||||||
|                 cp ${theme} ./theme.json |  | ||||||
| 
 | 
 | ||||||
|                 export HOME=$PWD |         buildPhase = '' | ||||||
|                 convert ./${cfg.path} -channel RGB -negate ./${cfg.path} |           ${optionalString cfg.inverted '' | ||||||
|  |             convert ./${image} -channel RGB -negate ./${image} | ||||||
|  |           ''} | ||||||
|  |           ${optionalString cfg.themed '' | ||||||
|  |             cp ${theme} ./theme.json | ||||||
| 
 | 
 | ||||||
|                 gowall convert ./${cfg.path} -o themed -t ./theme.json |             export HOME=$PWD | ||||||
|                 mv Pictures/gowall/themed.* ./ |  | ||||||
|                 mogrify -format png themed.* |  | ||||||
|               '' |  | ||||||
|             else |  | ||||||
|               '' |  | ||||||
|                 cp ${theme} ./theme.json |  | ||||||
| 
 | 
 | ||||||
|                 export HOME=$PWD |             gowall convert ./${image} --output themed -t ./theme.json | ||||||
| 
 |             tree | ||||||
|                 gowall convert ./${cfg.path} -o themed -t ./theme.json |             mv ./themed/*.* ./ | ||||||
|                 mv Pictures/gowall/themed.* ./ |           ''} | ||||||
|                 mogrify -format png themed.* |           mv ./${image} themed.${fileExtension image} | ||||||
|               '' |           ${optionalString (fileExtension image != "png") '' | ||||||
|           else |             mogrify -format png themed.* | ||||||
|             '' |           ''} | ||||||
|               cp ${cfg.path} ./themed |         ''; | ||||||
| 
 |  | ||||||
|               mogrify -format png themed |  | ||||||
|             ''; |  | ||||||
| 
 | 
 | ||||||
|         installPhase = '' |         installPhase = '' | ||||||
|           install -Dm644 -t $out themed.png |           install -Dm644 -t $out themed.png | ||||||
|  | |||||||
| @ -110,8 +110,11 @@ in | |||||||
|     # Configure qt theme |     # Configure qt theme | ||||||
|     qt = mkIf config.desktop.enable { |     qt = mkIf config.desktop.enable { | ||||||
|       enable = true; |       enable = true; | ||||||
|       platformTheme.name = "adwaita"; |       platformTheme.name = "gtk"; | ||||||
|       style.name = if cfg.darkMode then "adwaita-dark" else "adwaita-light"; |       style = { | ||||||
|  |         name = if cfg.darkMode then "adwaita-dark" else "adwaita-light"; | ||||||
|  |         package = pkgs.adwaita-qt; | ||||||
|  |       }; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     # Configure gtk theme |     # Configure gtk theme | ||||||
|  | |||||||
| @ -35,6 +35,8 @@ let | |||||||
| 
 | 
 | ||||||
|   fontModules = [ |   fontModules = [ | ||||||
|     # Import all fonts |     # Import all fonts | ||||||
|  |     ./fonts/adwaita-mono.nix | ||||||
|  |     ./fonts/adwaita-sans.nix | ||||||
|     ./fonts/cozette-vector.nix |     ./fonts/cozette-vector.nix | ||||||
|     ./fonts/cozette.nix |     ./fonts/cozette.nix | ||||||
|     ./fonts/dejavu-sans.nix |     ./fonts/dejavu-sans.nix | ||||||
| @ -190,8 +192,8 @@ in | |||||||
|       { |       { | ||||||
|         enable = true; |         enable = true; | ||||||
|         # TODO: Toggles |         # TODO: Toggles | ||||||
|         gtk3.extraCss = disableCSD; |         gtk3.extraCss = mkIf config.modules.river.enable disableCSD; | ||||||
|         gtk4.extraCss = disableCSD; |         gtk4.extraCss = mkIf config.modules.river.enable disableCSD; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|     # TODO: Make cursors configurable using modules. |     # TODO: Make cursors configurable using modules. | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								user-modules/desktop/theming/fonts/adwaita-mono.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								user-modules/desktop/theming/fonts/adwaita-mono.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | { pkgs, ... }: | ||||||
|  | 
 | ||||||
|  | { | ||||||
|  |   name = "Adwaita Mono"; | ||||||
|  |   package = pkgs.adwaita-fonts; | ||||||
|  |   recommendedSize = 12; | ||||||
|  |   fallbackFonts = [ ]; | ||||||
|  | } | ||||||
							
								
								
									
										8
									
								
								user-modules/desktop/theming/fonts/adwaita-sans.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								user-modules/desktop/theming/fonts/adwaita-sans.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | { pkgs, ... }: | ||||||
|  | 
 | ||||||
|  | { | ||||||
|  |   name = "Adwaita Sans"; | ||||||
|  |   package = pkgs.adwaita-fonts; | ||||||
|  |   recommendedSize = 12; | ||||||
|  |   fallbackFonts = [ ]; | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jan-Bulthuis
						Jan-Bulthuis