Skip to content

Commit

Permalink
firefox: add gnome-theme testbed (#879)
Browse files Browse the repository at this point in the history
Add a gnome-theme testbed and extract the profile name in the default
testbed.

Link: #879

Co-authored-by: Daniel Thwaites <[email protected]>
Co-authored-by: NAHO <[email protected]>
Reviewed-by: Daniel Thwaites <[email protected]>
Reviewed-by: NAHO <[email protected]>
  • Loading branch information
3 people authored Feb 28, 2025
1 parent c74352a commit de4ee58
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 19 deletions.
30 changes: 13 additions & 17 deletions modules/firefox/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
}:

let
inherit (config.lib.stylix.templates) firefox-gnome-theme;
targets = [
{
path = "firefox";
Expand Down Expand Up @@ -91,15 +92,20 @@ in
"svg.context-properties.content.enabled" = true;
};

userChrome = builtins.readFile (
config.lib.stylix.colors {
template = ./userChrome.mustache;
extension = "css";
}
);
userChrome =
let
template = config.lib.stylix.colors {
template = ./userChrome.mustache;
extension = "css";
};
in
''
@import "${firefox-gnome-theme}/userChrome.css";
@import "${template}";
'';

userContent = ''
import "firefox-gnome-theme/userContent.css";
@import "${firefox-gnome-theme}/userContent.css";
'';
})
(lib.mkIf cfg.colorTheme.enable {
Expand Down Expand Up @@ -154,14 +160,4 @@ in
];
}) cfg.profileNames
);

config.home.file = eachTarget (
{ cfg, programCfg, ... }:
lib.mkIf cfg.firefoxGnomeTheme.enable (
eachConfig (profileName: {
"${programCfg.configPath}/${profileName}/chrome/firefox-gnome-theme".source =
config.lib.stylix.templates.firefox-gnome-theme;
}) cfg.profileNames
)
);
}
5 changes: 3 additions & 2 deletions modules/firefox/testbeds/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

let
package = pkgs.firefox;
profileName = "stylix";
in
{
stylix.testbed.application = {
Expand All @@ -14,9 +15,9 @@ in
programs.firefox = {
enable = true;
inherit package;
profiles.stylix.isDefault = true;
profiles.${profileName}.isDefault = true;
};

stylix.targets.firefox.profileNames = [ "stylix" ];
stylix.targets.firefox.profileNames = [ profileName ];
};
}
26 changes: 26 additions & 0 deletions modules/firefox/testbeds/gnome-theme.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ lib, pkgs, ... }:

let
package = pkgs.firefox;
profileName = "stylix";
in
{
stylix.testbed.application = {
enable = true;
name = "firefox";
inherit package;
};

home-manager.sharedModules = lib.singleton {
programs.firefox = {
enable = true;
inherit package;
profiles.${profileName}.isDefault = true;
};

stylix.targets.firefox = {
profileNames = [ profileName ];
firefoxGnomeTheme.enable = true;
};
};
}

0 comments on commit de4ee58

Please sign in to comment.