Apply GNOME shell styling to GDM

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.
This commit is contained in:
Daniel Thwaites 2023-01-06 23:28:40 +00:00
parent d7536947a7
commit 43a0330a31
No known key found for this signature in database
GPG key ID: D8AFC4BF05670F9D
2 changed files with 38 additions and 35 deletions

View file

@ -9,26 +9,29 @@ let
}; };
theme = pkgs.stdenv.mkDerivation { theme = pkgs.stdenv.mkDerivation {
name = "stylix-gnome-shell.css"; name = "stylix-gnome-shell";
src = pkgs.fetchurl { src = pkgs.fetchurl {
url = "mirror://gnome/sources/gnome-shell/43/gnome-shell-43.2.tar.xz"; url = "mirror://gnome/sources/gnome-shell/43/gnome-shell-43.2.tar.xz";
sha256 = "52/UvpNCQQ7p+9zday2Bxv8GDnyMxaDxyuanq6JdGGA="; sha256 = "52/UvpNCQQ7p+9zday2Bxv8GDnyMxaDxyuanq6JdGGA=";
}; };
sourceRoot = "gnome-shell-43.2/data/theme";
patches = [ ./shell.patch ]; patches = [ ./shell.patch ];
postPatch = '' postPatch = ''
rm gnome-shell-sass/{_colors.scss,_palette.scss} rm data/theme/gnome-shell-sass/{_colors.scss,_palette.scss}
cp ${colors} gnome-shell-sass/_colors.scss cp ${colors} data/theme/gnome-shell-sass/_colors.scss
''; '';
nativeBuildInputs = with pkgs; [ sass ]; nativeBuildInputs = with pkgs; [ sass glib.dev ];
buildPhase = '' 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 { in {
@ -49,16 +52,6 @@ in {
if config.stylix.polarity == "dark" if config.stylix.polarity == "dark"
then "prefer-dark" then "prefer-dark"
else "default"; 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 user-theme@gnome-shell-extensions.gcampax.github.com
gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
'';
}; };
})]; })];
@ -68,5 +61,15 @@ in {
# "${pkgs.gnome.gnome-backgrounds}/path/to/your/preferred/background" # "${pkgs.gnome.gnome-backgrounds}/path/to/your/preferred/background"
# which will then download the pack regardless of its exclusion below. # which will then download the pack regardless of its exclusion below.
environment.gnome.excludePackages = [ pkgs.gnome.gnome-backgrounds ]; 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
'';
});
});
})];
}; };
} }

View file

@ -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 index 7c8959e2c..6066def91 100644
--- a/gnome-shell-sass/_drawing.scss --- a/data/theme/gnome-shell-sass/_drawing.scss
+++ b/gnome-shell-sass/_drawing.scss +++ b/data/theme/gnome-shell-sass/_drawing.scss
@@ -248,7 +248,7 @@ @@ -248,7 +248,7 @@
&:insensitive { &:insensitive {
@include button(insensitive); @include button(insensitive);
@ -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 index 8f5d5f939..f3a7e1029 100644
--- a/gnome-shell-sass/widgets/_dash.scss --- a/data/theme/gnome-shell-sass/widgets/_dash.scss
+++ b/gnome-shell-sass/widgets/_dash.scss +++ b/data/theme/gnome-shell-sass/widgets/_dash.scss
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* Dash */ /* Dash */
@ -23,10 +23,10 @@ index 8f5d5f939..f3a7e1029 100644
$dash_placeholder_size: 32px; $dash_placeholder_size: 32px;
$dash_padding: $base_padding*2; // 12px $dash_padding: $base_padding*2; // 12px
$dash_border_radius: $modal_radius + $dash_padding; $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 index 5196661c1..663e754bd 100644
--- a/gnome-shell-sass/widgets/_message-list.scss --- a/data/theme/gnome-shell-sass/widgets/_message-list.scss
+++ b/gnome-shell-sass/widgets/_message-list.scss +++ b/data/theme/gnome-shell-sass/widgets/_message-list.scss
@@ -128,7 +128,7 @@ @@ -128,7 +128,7 @@
} }
@ -67,10 +67,10 @@ index 5196661c1..663e754bd 100644
border: 1px solid transparent; border: 1px solid transparent;
border-radius: $base_border_radius; border-radius: $base_border_radius;
icon-size: $large_icon_size !important; // 32px 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 index fd3e7d2da..051eefbfe 100644
--- a/gnome-shell-sass/widgets/_panel.scss --- a/data/theme/gnome-shell-sass/widgets/_panel.scss
+++ b/gnome-shell-sass/widgets/_panel.scss +++ b/data/theme/gnome-shell-sass/widgets/_panel.scss
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
/* Top Bar */ /* Top Bar */
// a.k.a. the panel // a.k.a. the panel
@ -80,10 +80,10 @@ index fd3e7d2da..051eefbfe 100644
$panel_fg_color: if($variant == 'light', lighten($bg_color, 10%), darken($fg_color, 5%)); $panel_fg_color: if($variant == 'light', lighten($bg_color, 10%), darken($fg_color, 5%));
$panel_height: 2.2em; $panel_height: 2.2em;
$panel_transition_duration: 250ms; // same as the overview transition duration $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 index 138a4fc0f..ccd020a0f 100644
--- a/gnome-shell-sass/widgets/_popovers.scss --- a/data/theme/gnome-shell-sass/widgets/_popovers.scss
+++ b/gnome-shell-sass/widgets/_popovers.scss +++ b/data/theme/gnome-shell-sass/widgets/_popovers.scss
@@ -37,22 +37,22 @@ @@ -37,22 +37,22 @@
&:rtl {padding-right: $base_padding;} &:rtl {padding-right: $base_padding;}
@ -140,10 +140,10 @@ index 138a4fc0f..ccd020a0f 100644
} }
.popup-menu-section { .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 index b429a2dc5..858f286a2 100644
--- a/gnome-shell-sass/widgets/_quick-settings.scss --- a/data/theme/gnome-shell-sass/widgets/_quick-settings.scss
+++ b/gnome-shell-sass/widgets/_quick-settings.scss +++ b/data/theme/gnome-shell-sass/widgets/_quick-settings.scss
@@ -81,9 +81,12 @@ @@ -81,9 +81,12 @@
icon-size: $base_icon_size*1.5; // a non-standard symbolic size but ok icon-size: $base_icon_size*1.5; // a non-standard symbolic size but ok
border-radius: 999px; border-radius: 999px;