Skip to content

Commit

Permalink
stylix: add steam and firefox gtk targets
Browse files Browse the repository at this point in the history
  • Loading branch information
brckd committed Dec 17, 2024
1 parent a9f0b89 commit 9c02cbd
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 15 deletions.
6 changes: 3 additions & 3 deletions configs/nixos/desktop/disko.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
mountOptions = ["umask=0077"];
};
};
luks = {
Expand All @@ -27,11 +27,11 @@
subvolumes = {
"/" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
mountOptions = ["compress=zstd" "noatime"];
};
"/home" = {
mountpoint = "/home";
mountOptions = [ "compress=zstd" "noatime" ];
mountOptions = ["compress=zstd" "noatime"];
};
};
};
Expand Down
12 changes: 0 additions & 12 deletions modules/home/librewolf/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
lib,
nur,
pkgs,
firefox-gnome-theme,
...
}:
with lib; let
Expand Down Expand Up @@ -123,15 +122,6 @@ in {
"gnomeTheme.dragWindowHeaderbarButtons" = true;
"gnomeTheme.symbolicTabIcons" = true;
};

userChrome = builtins.readFile (config.lib.stylix.colors {
template = ./userChrome.mustache;
extension = "css";
});

userContent = ''
@import "firefox-gnome-theme/userContent.css";
'';
};
};
policies = {
Expand Down Expand Up @@ -168,7 +158,5 @@ in {
];
};
};

home.file.".librewolf/default/chrome/firefox-gnome-theme".source = firefox-gnome-theme;
};
}
2 changes: 2 additions & 0 deletions modules/home/stylix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
with lib; let
cfg = config.stylix;
in {
imports = [./targets/steam ./targets/firefox];

config = mkIf cfg.enable {
stylix = {
image = wallpaper;
Expand Down
23 changes: 23 additions & 0 deletions modules/home/stylix/targets/firefox/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
config,
lib,
firefox-gnome-theme,
...
}: {
config = lib.mkMerge (map (target:
lib.mkIf (config.stylix.enable && config.stylix.targets.${target}.enable && config.programs.${target}.enable) (
lib.mkMerge (map (profile: {
home.file."${config.programs.${target}.configPath}/${profile}/chrome/firefox-gnome-theme".source = firefox-gnome-theme;
programs.${target}.profiles.${profile} = {
userChrome = builtins.readFile (config.lib.stylix.colors {
template = ./userChrome.mustache;
extension = "css";
});

userContent = ''
@import "firefox-gnome-theme/userContent.css";
'';
};
}) ["default"])
)) ["firefox" "librewolf"]);
}
File renamed without changes.
80 changes: 80 additions & 0 deletions modules/home/stylix/targets/steam/custom.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
:root {
/* The main accent color and the matching text value */
--adw-accent-bg-rbg: #{{base0D-rgb-r}}, #{{base0D-rgb-g}}, #{{base0D-rgb-b}};
--adw-accent-fg-rbg: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-accent-rgb: #{{base0D-rgb-r}}, #{{base0D-rgb-g}}, #{{base0D-rgb-b}};

/* destructive-action buttons */
--adw-destructive-bg-rgb: #{{base08-rgb-r}}, #{{base08-rgb-g}}, #{{base08-rgb-b}};
--adw-destructive-fg-rgb: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-destructive-rgb: #{{base08-rgb-r}}, #{{base08-rgb-g}}, #{{base08-rgb-b}};

/* Levelbars, entries, labels and infobars. These don't need text colors */
--adw-success-bg-rgb: #{{base0B-rgb-r}}, #{{base0B-rgb-g}}, #{{base0B-rgb-b}};
--adw-success-fg-rgb: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-success-rgb: #{{base0B-rgb-r}}, #{{base0B-rgb-g}}, #{{base0B-rgb-b}};

--adw-warning-bg-rgb: #{{base0E-rgb-r}}, #{{base0E-rgb-g}}, #{{base0E-rgb-b}};
--adw-warning-fg-rgb: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-warning-fg-a: 0.8;
--adw-warning-rgb: #{{base0E-rgb-r}}, #{{base0E-rgb-g}}, #{{base0E-rgb-b}};

--adw-error-bg-rgb: #{{base08-rgb-r}}, #{{base08-rgb-g}}, #{{base08-rgb-b}};
--adw-error-fg-rgb: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-error-rgb: #{{base08-rgb-r}}, #{{base08-rgb-g}}, #{{base08-rgb-b}};

/* Window */
--adw-window-bg-rgb: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-window-fg-rgb: #{{base05-rgb-r}}, #{{base05-rgb-g}}, #{{base05-rgb-b}};

/* Views - e.g. text view or tree view */
--adw-view-bg-rgb: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-view-fg-rgb: #{{base05-rgb-r}}, #{{base05-rgb-g}}, #{{base05-rgb-b}};

/* Header bar, search bar, tab bar */
--adw-headerbar-bg-rgb: #{{base01-rgb-r}}, #{{base01-rgb-g}}, #{{base01-rgb-b}};
--adw-headerbar-fg-rgb: #{{base05-rgb-r}}, #{{base05-rgb-g}}, #{{base05-rgb-b}};
--adw-headerbar-border-rgb: #{{base01-rgb-r}}, #{{base01-rgb-g}}, #{{base01-rgb-b}};
--adw-headerbar-backdrop-rgb: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-headerbar-shade-rgb: 0, 0, 0;
--adw-headerbar-shade-a: 0.9;

/* Split pane views */
--adw-sidebar-bg-rgb: #{{base01-rgb-r}}, #{{base01-rgb-g}}, #{{base01-rgb-b}};
--adw-sidebar-fg-rgb: #{{base05-rgb-r}}, #{{base05-rgb-g}}, #{{base05-rgb-b}};
--adw-sidebar-backdrop-rgb: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-sidebar-shade-rgb: 0, 0, 0;
--adw-sidebar-shade-a: 0.36;

--adw-secondary-sidebar-bg-rgb: #{{base01-rgb-r}}, #{{base01-rgb-g}}, #{{base01-rgb-b}};
--adw-secondary-sidebar-fg-rgb: #{{base05-rgb-r}}, #{{base05-rgb-g}}, #{{base05-rgb-b}};
--adw-secondary-sidebar-backdrop-rgb: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-secondary-sidebar-shade-rgb: 0, 0, 0;
--adw-secondary-sidebar-shade-a: 0.36;

/* Cards, boxed lists */
--adw-card-bg-rgb: 0, 0, 0;
--adw-card-bg-a: 0.08;
--adw-card-fg-rgb: #{{base05-rgb-r}}, #{{base05-rgb-g}}, #{{base05-rgb-b}};
--adw-card-shade-rgb: 0, 0, 0;
--adw-card-shade-a: 0.36;

/* Dialogs */
--adw-dialog-bg-rgb: #{{base01-rgb-r}}, #{{base01-rgb-g}}, #{{base01-rgb-b}};
--adw-dialog-fg-rgb: #{{base05-rgb-r}}, #{{base05-rgb-g}}, #{{base05-rgb-b}};

/* Popovers */
--adw-popover-bg-rgb: #{{base01-rgb-r}}, #{{base01-rgb-g}}, #{{base01-rgb-b}};
--adw-popover-fg-rgb: #{{base05-rgb-r}}, #{{base05-rgb-g}}, #{{base05-rgb-b}};
--adw-popover-shade-rgb: #{{base01-rgb-r}}, #{{base01-rgb-g}}, #{{base01-rgb-b}};
--adw-popover-shade-a: 0.36;

/* Thumbnails */
--adw-thumbnail-bg-rgb: #{{base00-rgb-r}}, #{{base00-rgb-g}}, #{{base00-rgb-b}};
--adw-thumbnail-fg-rgb: #{{base05-rgb-r}}, #{{base05-rgb-g}}, #{{base05-rgb-b}};

/* Miscellaneous */
--adw-shade-rgb: 0, 0, 0;
--adw-shade-a: 0.36;
}

30 changes: 30 additions & 0 deletions modules/home/stylix/targets/steam/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
config,
lib,
pkgs,
...
}: {
options.stylix.targets.steam.enable = config.lib.stylix.mkEnableTarget "Steam" true;

config = lib.mkIf (config.stylix.enable && config.stylix.targets.steam.enable) {
home.packages = with pkgs; [adwsteamgtk];

home.activation.applyAdwaitaForSteam = let
shellScript = pkgs.writeShellScript "aplyAdwaitaForSteam" ''
rm -f "$HOME/.cache/AdwSteamInstaller/extracted/custom/custom.css"
${lib.getExe pkgs.adwsteamgtk} -i
'';
in
config.lib.dag.entryAfter ["writeBoundary" "dconfSettings"] ''
run ${shellScript}
'';

xdg.configFile."AdwSteamGtk/custom.css".source = config.lib.stylix.colors {
template = ./custom.mustache;
extension = "css";
};

# Use custom.css
dconf.settings."io/github/Foldex/AdwSteamGtk".prefs-install-custom-css = true;
};
}

0 comments on commit 9c02cbd

Please sign in to comment.