mirror of
https://git.sr.ht/~rouven/nixos-config
synced 2024-11-15 13:23:11 +01:00
79 lines
2.1 KiB
Nix
79 lines
2.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.services.shikane;
|
|
tomlFormat = pkgs.formats.toml { };
|
|
in
|
|
{
|
|
meta.maintainers = [ hm.maintainers.therealr5 ];
|
|
options.services.shikane = {
|
|
enable = mkEnableOption "shikane, A dynamic output configuration tool that automatically detects and configures connected outputs based on a set of profiles.";
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = pkgs.shikane;
|
|
defaultText = literalExpression "pkgs.shikane";
|
|
description = "The package to use for shikane.";
|
|
};
|
|
settings = mkOption {
|
|
type = tomlFormat.type;
|
|
default = { };
|
|
example = literalExpression ''
|
|
{
|
|
profile = [
|
|
{
|
|
name = "external-monitor-default";
|
|
output = [
|
|
{
|
|
match = "eDP-1";
|
|
enable = true;
|
|
}
|
|
{
|
|
match = "HDMI-A-1";
|
|
enable = true;
|
|
position = {
|
|
x = 1920;
|
|
y = 0;
|
|
};
|
|
}
|
|
];
|
|
}
|
|
{
|
|
name = "builtin-monitor-only";
|
|
output = [
|
|
{
|
|
match = "eDP-1";
|
|
enable = true;
|
|
}
|
|
];
|
|
}
|
|
];
|
|
}
|
|
'';
|
|
description = ''
|
|
Configuration written to
|
|
<filename>$XDG_CONFIG_HOME/shikane/config.toml</filename>.
|
|
</para><para>
|
|
See <link xlink:href="https://gitlab.com/w0lff/shikane/-/blob/master/docs/shikane.5.man.md" />
|
|
for more information.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.user.services.shikane = {
|
|
Unit = {
|
|
Description = "Dynamic output configuration tool";
|
|
Documentation = "man:shikane(1)";
|
|
PartOf = [ "graphical-session.target" ];
|
|
};
|
|
|
|
Service = {
|
|
ExecStart = "${cfg.package}/bin/shikane -c ${tomlFormat.generate "shikane-config" cfg.settings}";
|
|
};
|
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
|
};
|
|
};
|
|
}
|
|
|