apognu / tuigreet

Graphical console greeter for greetd
GNU General Public License v3.0
986 stars 45 forks source link

config file #156

Open mock1328 opened 2 months ago

mock1328 commented 2 months ago

IMO, would be great if we had a /etc/greetd/tuigreet.toml config file alongside running with args. Options line gets too long and ugly very quickly, managing config file could be easier

apognu commented 2 months ago

Thanks for the issue. I was actually thinking about doing something like it, since this also bothers me.

I'll categorize this as a feature request and I'll probably work on it for 0.11.

apognu commented 1 month ago

This is being worked on and, on the relevant branch, it is at a stage where it can be tested and polished. I'll still ask that, if someone wanted to give it a go, they be careful, it is still very much a work in progress.

I plan on having this ready for 0.11 (so not the next version).

Hugo-Heagren commented 2 weeks ago

I have used tuigreet from NixOS before, and have just set it up again (thus finding my way here, finding to my great delight this had already been handled :smiley:). It would be really good if there was a structured way of setting configs from the configuration.nix -- more structured than just writing a string. Has that been thought of? Should I open a new issue?

I'm imaging that something like this would write the config file in the relevant way (perhaps overwriting everything previously, perhaps only setting the keys which are explicit set herein):

services.greetd = {
  enable = true;
  settings = {
    default_session = {
      command = "${lib.makeBinPath [pkgs.greetd.tuigreet] }/tuigreet";
      user = "greeter";
    }; 
    vt = 1;
  };
 # Not sure where the best place for this would be. Perhaps not inside greetd? IDK.
  tuigreet.config = {
    time = true;
    asterisks = true;
    command = "bash";
    # Note structured theme, I think this would be handy for applying
    # system-wide colour schemes
    theme = {
      border = magenta;
      text = cyan;
      prompt = green;
      time = red;
      action = blue;
      button = yellow;
      container = black;
      input = red;
    };
  };
};

ETA: I've just seen that the implementation uses a TOML file. The decision was made not to include a write-to-TOML function in the nix builtins, though there is a toTOML function function in nix-std.

apognu commented 2 weeks ago

@Hugo-Heagren Yes, this is ongoing (albeit taking a bit more time than I anticipated) and will use TOML indeed.

As far as custom Nix derivations for tuigreet config, I am not really sure what I can do here since I do not maintain the packaging for various distributions.