2023-06-15 21:01:17 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2023-06-19 10:37:17 +02:00
|
|
|
|
2023-06-15 21:01:17 +02:00
|
|
|
with lib;
|
2023-06-19 10:37:17 +02:00
|
|
|
|
2023-06-15 21:01:17 +02:00
|
|
|
let
|
|
|
|
cfg = config.services.shikane;
|
|
|
|
tomlFormat = pkgs.formats.toml { };
|
|
|
|
in
|
|
|
|
{
|
2023-06-19 13:22:15 +02:00
|
|
|
meta.maintainers = [ maintainers.therealr5 ];
|
2023-06-15 21:01:17 +02:00
|
|
|
options.services.shikane = {
|
2023-06-19 13:22:15 +02:00
|
|
|
|
2023-06-19 10:37:17 +02:00
|
|
|
enable = mkEnableOption
|
|
|
|
"shikane, A dynamic output configuration tool that automatically detects and configures connected outputs based on a set of profiles.";
|
2023-06-19 13:22:15 +02:00
|
|
|
|
|
|
|
package = mkPackageOption pkgs "shikane" { };
|
|
|
|
|
2023-06-15 21:01:17 +02:00
|
|
|
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 {
|
2023-06-19 13:22:15 +02:00
|
|
|
xdg.configFile."shikane/config.toml".source =
|
|
|
|
tomlFormat.generate "shikane-config" cfg.settings;
|
2023-06-15 21:01:17 +02:00
|
|
|
systemd.user.services.shikane = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Dynamic output configuration tool";
|
|
|
|
Documentation = "man:shikane(1)";
|
2023-06-19 13:22:15 +02:00
|
|
|
After = [ "graphical-session-pre.target" ];
|
2023-06-15 21:01:17 +02:00
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
2023-08-03 13:30:40 +02:00
|
|
|
Service = { ExecStart = "${cfg.package}/bin/shikane"; };
|
2023-06-15 21:01:17 +02:00
|
|
|
|
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|