mirror of
https://github.com/danth/stylix
synced 2024-11-22 20:23:15 +00:00
Support per user themes for GNOME shell ✨
This commit is contained in:
parent
02f0297038
commit
ba324393e9
3 changed files with 52 additions and 10 deletions
|
@ -22,6 +22,18 @@ with lib;
|
|||
if config.stylix.polarity == "dark"
|
||||
then "prefer-dark"
|
||||
else "default";
|
||||
|
||||
"org/gnome/shell/extensions/user-theme".name = "Stylix";
|
||||
};
|
||||
|
||||
xdg.dataFile."themes/Stylix/gnome-shell/gnome-shell.css" = {
|
||||
source =
|
||||
let theme = import ./theme.nix { inherit pkgs config; };
|
||||
in "${theme}/share/gnome-shell/gnome-shell.css";
|
||||
onChange = ''
|
||||
gnome-extensions disable user-theme@gnome-shell-extensions.gcampax.github.com
|
||||
gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,17 +17,13 @@ with lib;
|
|||
nixpkgs.overlays = [(self: super: {
|
||||
gnome = super.gnome.overrideScope' (gnomeSelf: gnomeSuper: {
|
||||
gnome-shell = gnomeSuper.gnome-shell.overrideAttrs (oldAttrs: {
|
||||
postPatch = let
|
||||
colors = config.lib.stylix.colors {
|
||||
template = builtins.readFile ./colors.mustache;
|
||||
extension = "scss";
|
||||
};
|
||||
in (oldAttrs.postPatch or "") + ''
|
||||
rm data/theme/gnome-shell-sass/{_colors.scss,_palette.scss}
|
||||
cp ${colors} data/theme/gnome-shell-sass/_colors.scss
|
||||
'';
|
||||
postFixup =
|
||||
let theme = import ./theme.nix { inherit pkgs config; };
|
||||
in ''
|
||||
cp ${theme}/share/gnome-shell/gnome-shell-theme.gresource \
|
||||
$out/share/gnome-shell/gnome-shell-theme.gresource
|
||||
'';
|
||||
patches = (oldAttrs.patches or []) ++ [
|
||||
./shell_colors.patch
|
||||
./shell_remove_dark_mode.patch
|
||||
];
|
||||
});
|
||||
|
|
34
modules/gnome/theme.nix
Normal file
34
modules/gnome/theme.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ pkgs, config }:
|
||||
|
||||
let
|
||||
colors = config.lib.stylix.colors {
|
||||
template = builtins.readFile ./colors.mustache;
|
||||
extension = "scss";
|
||||
};
|
||||
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
name = "stylix-gnome-shell-theme";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://gnome/sources/gnome-shell/43/gnome-shell-43.2.tar.xz";
|
||||
sha256 = "52/UvpNCQQ7p+9zday2Bxv8GDnyMxaDxyuanq6JdGGA=";
|
||||
};
|
||||
|
||||
patches = [ ./shell_colors.patch ];
|
||||
postPatch = ''
|
||||
rm data/theme/gnome-shell-sass/{_colors.scss,_palette.scss}
|
||||
cp ${colors} data/theme/gnome-shell-sass/_colors.scss
|
||||
'';
|
||||
|
||||
nativeBuildInputs = with pkgs; [ sass glib.dev ];
|
||||
buildPhase = ''
|
||||
sass data/theme/gnome-shell.scss >data/theme/gnome-shell.css
|
||||
glib-compile-resources --sourcedir=data/theme data/gnome-shell-theme.gresource.xml
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/gnome-shell
|
||||
mv data/theme/gnome-shell.css $out/share/gnome-shell/gnome-shell.css
|
||||
mv data/gnome-shell-theme.gresource $out/share/gnome-shell/gnome-shell-theme.gresource
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue