mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-21 01:39:39 +01:00
way-displays: support stateful configuration file (#7138)
This is good for when displays are not considered part of the home configuration and are instead considered ephemeral. Great for laptops but I use it for my desktop as well.
This commit is contained in:
parent
dceefa87dc
commit
04672588c6
1 changed files with 23 additions and 10 deletions
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
|
|
@ -21,7 +22,10 @@ let
|
|||
yaml = pkgs.formats.yaml { };
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.jolars ];
|
||||
meta.maintainers = [
|
||||
maintainers.jolars
|
||||
maintainers.mightyiam
|
||||
];
|
||||
|
||||
options.services.way-displays = {
|
||||
enable = mkEnableOption "way-displays";
|
||||
|
|
@ -29,7 +33,7 @@ in
|
|||
package = lib.mkPackageOption pkgs "way-displays" { };
|
||||
|
||||
settings = mkOption {
|
||||
type = yaml.type;
|
||||
type = types.nullOr yaml.type;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
|
|
@ -61,6 +65,9 @@ in
|
|||
{file}`$XDG_CONFIG_HOME/way-displays/cfg.yml`. See
|
||||
<https://github.com/alex-courtis/way-displays/wiki/Configuration> for a
|
||||
description of available options.
|
||||
|
||||
When `null` a configuration file is not generated,
|
||||
which allows way-displays to write its own configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -79,14 +86,20 @@ in
|
|||
(lib.hm.assertions.assertPlatform "services.way-displays" pkgs lib.platforms.linux)
|
||||
];
|
||||
|
||||
xdg.configFile."way-displays/cfg.yaml".source =
|
||||
yaml.generate "way-displays-config.yaml"
|
||||
(mergeSets [
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
wayland.windowManager = lib.mapAttrs (name: _: {
|
||||
systemd.variables = [ "XDG_VTNR" ];
|
||||
}) options.wayland.windowManager;
|
||||
|
||||
xdg.configFile."way-displays/cfg.yaml" = mkIf (cfg.settings != null) {
|
||||
source = yaml.generate "way-displays-config.yaml" (mergeSets [
|
||||
{
|
||||
CALLBACK_CMD = "${pkgs.libnotify}/bin/notify-send \"way-displays \${CALLBACK_LEVEL}\" \"\${CALLBACK_MSG}\"";
|
||||
}
|
||||
cfg.settings
|
||||
]);
|
||||
};
|
||||
|
||||
systemd.user.services.way-displays = {
|
||||
Unit = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue