mirror of
https://github.com/danth/stylix
synced 2024-11-10 06:34:15 +00:00
Add extraCss
option for GTK ✨
This commit is contained in:
parent
dd7fc590c3
commit
6d3a046d17
1 changed files with 32 additions and 8 deletions
|
@ -1,16 +1,40 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
css = config.lib.stylix.colors {
|
||||
cfg = config.stylix.targets.gtk;
|
||||
|
||||
baseCss = config.lib.stylix.colors {
|
||||
template = builtins.readFile ./gtk.mustache;
|
||||
extension = "css";
|
||||
};
|
||||
|
||||
in {
|
||||
options.stylix.targets.gtk.enable =
|
||||
config.lib.stylix.mkEnableTarget "all GTK3, GTK4 and Libadwaita apps" true;
|
||||
|
||||
config = lib.mkIf config.stylix.targets.gtk.enable {
|
||||
finalCss = pkgs.runCommandLocal "gtk.css" {} ''
|
||||
echo ${escapeShellArg cfg.extraCss} >>$out
|
||||
cat ${baseCss} >>$out
|
||||
'';
|
||||
|
||||
in {
|
||||
options.stylix.targets.gtk = {
|
||||
enable = config.lib.stylix.mkEnableTarget
|
||||
"all GTK3, GTK4 and Libadwaita apps" true;
|
||||
|
||||
extraCss = mkOption {
|
||||
description = ''
|
||||
Extra code added to <literal>gtk-3.0/gtk.css</literal>
|
||||
and <literal>gtk-4.0/gtk.css</literal>.
|
||||
'';
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
// Remove rounded corners
|
||||
window.background { border-radius: 0; }
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# programs.dconf.enable = true; required in system config
|
||||
gtk = {
|
||||
enable = true;
|
||||
|
@ -22,8 +46,8 @@ in {
|
|||
};
|
||||
|
||||
xdg.configFile = {
|
||||
"gtk-3.0/gtk.css".source = css;
|
||||
"gtk-4.0/gtk.css".source = css;
|
||||
"gtk-3.0/gtk.css".source = finalCss;
|
||||
"gtk-4.0/gtk.css".source = finalCss;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue