Skip to content

Commit

Permalink
gnome-text-editor: init module
Browse files Browse the repository at this point in the history
Add styling for the GNOME Text Editor application. Use the Gedit
module's theme and override the HM and NixOS package to include it.
Use Home Manager's dconf to make the theme the default.
  • Loading branch information
brckd committed Jan 5, 2025
1 parent 7dfcdb4 commit 94babbd
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
29 changes: 29 additions & 0 deletions modules/gnome-text-editor/gnome-text-editor.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ config, lib, ... }:

let
style = config.lib.stylix.colors {
template = ../gedit/template.mustache;
extension = "xml";
};
in
{
options.stylix.targets.gnome-text-editor.enable =
config.lib.stylix.mkEnableTarget "GNOME Text Editor" true;

config =
lib.mkIf
(config.stylix.enable && config.stylix.targets.gnome-text-editor.enable)
{
nixpkgs.overlays = [
(_: prev: {
gnome-text-editor = prev.gnome-text-editor.overrideAttrs (oldAttrs: {
postFixup =
(oldAttrs.postFixup or "")
+ ''
cp ${style} $out/share/gnome-text-editor/styles/stylix.xml
'';
});
})
];
};
}
12 changes: 12 additions & 0 deletions modules/gnome-text-editor/hm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ config, lib, ... }:

{
imports = [ ./gnome-text-editor.nix ];

config =
lib.mkIf
(config.stylix.enable && config.stylix.targets.gnome-text-editor.enable)
{
dconf.settings."org/gnome/TextEditor".style-scheme = "stylix";
};
}
1 change: 1 addition & 0 deletions modules/gnome-text-editor/nixos.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import ./gnome-text-editor.nix
15 changes: 15 additions & 0 deletions modules/gnome-text-editor/testbed.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ pkgs, ... }:

let
package = pkgs.gnome-text-editor;

in
{
stylix.testbed.application = {
enable = true;
name = "org.gnome.TextEditor";
inherit package;
};

environment.systemPackages = [ package ];
}

0 comments on commit 94babbd

Please sign in to comment.