Skip to content

Commit

Permalink
Apply GNOME shell styling to GDM ✨
Browse files Browse the repository at this point in the history
This has some other benefits too:
- No messing around with extensions and DConf settings
- The custom theme is compiled into a gresource file for efficiency

However it does cause the GNOME shell package to be compiled from scratch.
  • Loading branch information
danth committed Jan 6, 2023
1 parent d753694 commit 43a0330
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 35 deletions.
37 changes: 20 additions & 17 deletions modules/gnome/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,29 @@ let
};

theme = pkgs.stdenv.mkDerivation {
name = "stylix-gnome-shell.css";
name = "stylix-gnome-shell";

src = pkgs.fetchurl {
url = "mirror://gnome/sources/gnome-shell/43/gnome-shell-43.2.tar.xz";
sha256 = "52/UvpNCQQ7p+9zday2Bxv8GDnyMxaDxyuanq6JdGGA=";
};
sourceRoot = "gnome-shell-43.2/data/theme";

patches = [ ./shell.patch ];
postPatch = ''
rm gnome-shell-sass/{_colors.scss,_palette.scss}
cp ${colors} gnome-shell-sass/_colors.scss
rm data/theme/gnome-shell-sass/{_colors.scss,_palette.scss}
cp ${colors} data/theme/gnome-shell-sass/_colors.scss
'';

nativeBuildInputs = with pkgs; [ sass ];
nativeBuildInputs = with pkgs; [ sass glib.dev ];
buildPhase = ''
sass gnome-shell.scss >$out
sass data/theme/gnome-shell.scss >data/theme/gnome-shell.css
# cp data/theme/gnome-shell.css data/theme/gnome-shell-high-contrast.css
glib-compile-resources --sourcedir=data/theme data/gnome-shell-theme.gresource.xml
'';

installPhase = "true";
installPhase = ''
mv data/gnome-shell-theme.gresource $out
'';
};

in {
Expand All @@ -49,16 +52,6 @@ in {
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 = theme;
onChange = ''
gnome-extensions disable [email protected]
gnome-extensions enable [email protected]
'';
};
})];

Expand All @@ -68,5 +61,15 @@ in {
# "${pkgs.gnome.gnome-backgrounds}/path/to/your/preferred/background"
# which will then download the pack regardless of its exclusion below.
environment.gnome.excludePackages = [ pkgs.gnome.gnome-backgrounds ];

nixpkgs.overlays = [(self: super: {
gnome = super.gnome.overrideScope' (gnomeSelf: gnomeSuper: {
gnome-shell = gnomeSuper.gnome-shell.overrideAttrs (oldAttrs: {
postFixup = ''
cp ${theme} $out/share/gnome-shell/gnome-shell-theme.gresource
'';
});
});
})];
};
}
36 changes: 18 additions & 18 deletions modules/gnome/shell.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/gnome-shell-sass/_drawing.scss b/gnome-shell-sass/_drawing.scss
diff --git a/data/theme/gnome-shell-sass/_drawing.scss b/data/theme/gnome-shell-sass/_drawing.scss
index 7c8959e2c..6066def91 100644
--- a/gnome-shell-sass/_drawing.scss
+++ b/gnome-shell-sass/_drawing.scss
--- a/data/theme/gnome-shell-sass/_drawing.scss
+++ b/data/theme/gnome-shell-sass/_drawing.scss
@@ -248,7 +248,7 @@
&:insensitive {
@include button(insensitive);
Expand All @@ -11,10 +11,10 @@ index 7c8959e2c..6066def91 100644
}
}
}
diff --git a/gnome-shell-sass/widgets/_dash.scss b/gnome-shell-sass/widgets/_dash.scss
diff --git a/data/theme/gnome-shell-sass/widgets/_dash.scss b/data/theme/gnome-shell-sass/widgets/_dash.scss
index 8f5d5f939..f3a7e1029 100644
--- a/gnome-shell-sass/widgets/_dash.scss
+++ b/gnome-shell-sass/widgets/_dash.scss
--- a/data/theme/gnome-shell-sass/widgets/_dash.scss
+++ b/data/theme/gnome-shell-sass/widgets/_dash.scss
@@ -1,6 +1,6 @@
/* Dash */

Expand All @@ -23,10 +23,10 @@ index 8f5d5f939..f3a7e1029 100644
$dash_placeholder_size: 32px;
$dash_padding: $base_padding*2; // 12px
$dash_border_radius: $modal_radius + $dash_padding;
diff --git a/gnome-shell-sass/widgets/_message-list.scss b/gnome-shell-sass/widgets/_message-list.scss
diff --git a/data/theme/gnome-shell-sass/widgets/_message-list.scss b/data/theme/gnome-shell-sass/widgets/_message-list.scss
index 5196661c1..663e754bd 100644
--- a/gnome-shell-sass/widgets/_message-list.scss
+++ b/gnome-shell-sass/widgets/_message-list.scss
--- a/data/theme/gnome-shell-sass/widgets/_message-list.scss
+++ b/data/theme/gnome-shell-sass/widgets/_message-list.scss
@@ -128,7 +128,7 @@
}

Expand Down Expand Up @@ -67,10 +67,10 @@ index 5196661c1..663e754bd 100644
border: 1px solid transparent;
border-radius: $base_border_radius;
icon-size: $large_icon_size !important; // 32px
diff --git a/gnome-shell-sass/widgets/_panel.scss b/gnome-shell-sass/widgets/_panel.scss
diff --git a/data/theme/gnome-shell-sass/widgets/_panel.scss b/data/theme/gnome-shell-sass/widgets/_panel.scss
index fd3e7d2da..051eefbfe 100644
--- a/gnome-shell-sass/widgets/_panel.scss
+++ b/gnome-shell-sass/widgets/_panel.scss
--- a/data/theme/gnome-shell-sass/widgets/_panel.scss
+++ b/data/theme/gnome-shell-sass/widgets/_panel.scss
@@ -1,7 +1,7 @@
/* Top Bar */
// a.k.a. the panel
Expand All @@ -80,10 +80,10 @@ index fd3e7d2da..051eefbfe 100644
$panel_fg_color: if($variant == 'light', lighten($bg_color, 10%), darken($fg_color, 5%));
$panel_height: 2.2em;
$panel_transition_duration: 250ms; // same as the overview transition duration
diff --git a/gnome-shell-sass/widgets/_popovers.scss b/gnome-shell-sass/widgets/_popovers.scss
diff --git a/data/theme/gnome-shell-sass/widgets/_popovers.scss b/data/theme/gnome-shell-sass/widgets/_popovers.scss
index 138a4fc0f..ccd020a0f 100644
--- a/gnome-shell-sass/widgets/_popovers.scss
+++ b/gnome-shell-sass/widgets/_popovers.scss
--- a/data/theme/gnome-shell-sass/widgets/_popovers.scss
+++ b/data/theme/gnome-shell-sass/widgets/_popovers.scss
@@ -37,22 +37,22 @@
&:rtl {padding-right: $base_padding;}

Expand Down Expand Up @@ -140,10 +140,10 @@ index 138a4fc0f..ccd020a0f 100644
}

.popup-menu-section {
diff --git a/gnome-shell-sass/widgets/_quick-settings.scss b/gnome-shell-sass/widgets/_quick-settings.scss
diff --git a/data/theme/gnome-shell-sass/widgets/_quick-settings.scss b/data/theme/gnome-shell-sass/widgets/_quick-settings.scss
index b429a2dc5..858f286a2 100644
--- a/gnome-shell-sass/widgets/_quick-settings.scss
+++ b/gnome-shell-sass/widgets/_quick-settings.scss
--- a/data/theme/gnome-shell-sass/widgets/_quick-settings.scss
+++ b/data/theme/gnome-shell-sass/widgets/_quick-settings.scss
@@ -81,9 +81,12 @@
icon-size: $base_icon_size*1.5; // a non-standard symbolic size but ok
border-radius: 999px;
Expand Down

0 comments on commit 43a0330

Please sign in to comment.