NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.31k stars 13.55k forks source link

Key-Value pairs in the Yabar configuration #59883

Open BKer opened 5 years ago

BKer commented 5 years ago

Issue description

The nixpkgs/nixos/modules/programs/yabar.nix file allows for adding extra parameters using the .extra parameter. The extra parameters are a key-value pair. This is perfect, however it turns the values into strings and for example the background-color-rgb does not take a String value type. There are several more non String options, see: https://github.com/geommer/yabar/wiki/Bar-specific-options

Steps to reproduce

Edit configuration.nix and add:

programs.yabar.enable = true;
programs.yabar.bars.topbar.extra: { background-color-rgb = "0x0000ff";};

Of course also run a rebuild Effect, the bar does not change to the desired color.

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the results.

PS. This is all to the best of my current knowledge, as I'm pretty new to NixOS.

c0bw3b commented 5 years ago

cc @Ma27

Ma27 commented 5 years ago

Hmm yeah, I vaguely remember that there were some kind of issues like this, unfortunately I don't use yabar anymore on my laptop.

My suggestion is to allow multiple types (e.g. types.either types.str types.int) for the extra values and add the quotes if the type is a string. The only thing I'm not so sure about is how to deal with the hex codes for colors as Nix doesn't support hex numbers on a language-level, but we can probably try to use builtins.match to detect a hex number.

Do you want to give this a try? The relevant file is in ./nixos/modules/programs/yabar.nix and you could use nixos-build-vms to test the change. Feel free to ping me if you need further assistance. If you encounter some unexpected issues then, I can also give this a try next week :)

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.