Jump to content

GNOME: Difference between revisions

m
removed blank line
m (Small changes)
m (removed blank line)
 
(3 intermediate revisions by the same user not shown)
Line 38: Line 38:
== Configuration ==
== Configuration ==


=== Managing Extensions ===
=== Managing extensions ===


GNOME extensions are managed and configured by the program "Extensions" that comes with GNOME.
GNOME extensions are managed and configured by the program "Extensions" that comes with GNOME. Some of them can be installed with Nix, however they aren't enabled by default. To enable them the "Extensions" program can be used.
 
Extensions can be installed with Nix, however they aren't enabled by default. To enable them the "Extensions" program can be used.


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
Line 54: Line 52:
</nowiki>}}
</nowiki>}}


Extension can be enabled and configured in your system configuration. Look at the following example.
Installed extensions can be enabled and configured in Extension app that comes preinstalled with GNOME. If you want to do that declaratively in your configuration, you can use [[Home Manager]] <code>dconf</code> module by adding following lines.
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  programs.dconf = {
    enable = true;
    profiles.user.databases = [
      {
        lockAll = true; # prevents overriding
        settings = {
          "org/gnome/shell" = {
            disable-user-extensions = false; # enables user extensions (disabled by default)
            enabled-extensions = [
              # Put UUIDs of extensions that you want to enable here.
              # If the extension you want to enable is packaged in nixpkgs,
              # you can easily get its UUID by accessing its extensionUuid
              # field (look at the following example).
              pkgs.gnomeExtensions.blur-my-shell.extensionUuid 
              # Alternatively, you can manually pass UUID as a string. 
              "blur-my-shell@aunetx"
              # ...
            ];
          };
 
          # Configure individual extensions
          "org/gnome/shell/extensions/blur-my-shell" = {
            brightness = 0.75;
            noise-amount = 0;
          };
        };
      }
    ];
  };
}
</nowiki>}}
 
Same result can be achieved for specific user only by using [[Home Manager]] module.


{{file|~/.config/home-manager/home.nix|nix|<nowiki>
{{file|~/.config/home-manager/home.nix|nix|<nowiki>
Line 98: Line 60:
     settings = {
     settings = {
       "org/gnome/shell" = {
       "org/gnome/shell" = {
         disable-user-extensions = false;
         disable-user-extensions = false; # enables user extensions
         enabled-extensions = [
         enabled-extensions = [
           pkgs.gnomeExtensions.blur-my-shell.extensionUuid   
          # Put UUIDs of extensions that you want to enable here.
          # If the extension you want to enable is packaged in nixpkgs,
          # you can easily get its UUID by accessing its extensionUuid
          # field (look at the following example).
           pkgs.gnomeExtensions.gsconnect.extensionUuid
         
          # Alternatively, you can manually pass UUID as a string.  
           "blur-my-shell@aunetx"
           "blur-my-shell@aunetx"
           # ...
           # ...
Line 106: Line 74:
       };
       };


      # Configure individual extensions
       "org/gnome/shell/extensions/blur-my-shell" = {
       "org/gnome/shell/extensions/blur-my-shell" = {
         brightness = 0.75;
         brightness = 0.75;
Line 115: Line 84:
</nowiki>}}
</nowiki>}}


To learn about settings that can be configured with dconf either look into "dconf-editor" program (provided by <code>gnome.dconf-editor</code> package) or type <code>dconf watch /</code> in the terminal and change settings from the GUI and see which options are responsible for that component/element.
=== dconf settings ===
 
Most of the GNOME settings are stored in [https://en.wikipedia.org/wiki/Dconf dconf] database. Settings are stored as keys placed in folders.
 
To learn about settings that can be configured with dconf either look into <code>dconf-editor</code> program (provided by <code>gnome.dconf-editor</code> package) or type <code>dconf watch /</code> in the terminal and change settings from the GUI and see which options are responsible for that component/element.
 
These settings can be changed by NixOS via <code>programs.dconf</code> module or by [[Home Manager]] via <code>dconf</code> module. To so in Home Manager, you need to change <code>dconf.settings</code> attribute set. This attribute set contains absolute folder paths (without leading slash) as attributes' names which value is another attribute set with keys (settings).
 
For example, to change the value of <code>clock-show-weekday</code> key that is located in <code>/org/gnome/desktop/interface</code>, you need to the following:
 
{{file|~/.config/home-manager/home.nix|nix|<nowiki>
{
  dconf.settings = {
    enable = true;
 
    # You need quotes to escape '/'
    "org/gnome/desktop/interface" = {
      clock-show-weekday = true;
    };
  };
}
</nowiki>}}
 
Same can be achieved by using system configuration.
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  programs.dconf = {
    enable = true;
    profiles.user.databases = [
      {
        lockAll = true; # prevents overriding
        settings = {
          "org/gnome/desktop/interface" = {
            clock-show-weekday = true;
          };
        };
      }
    ];
  };
}
</nowiki>}}
 
{{Note|Since dconf have more data types than Nix language (for example, tuples), in some cases you'll need to convert Nix value to a GVariant value. You can achieve that by using function defined in <code>lib.gvariant</code>, they're documented [https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-gvariant here].}}


=== Dark mode ===
=== Dark mode ===