diff options
Diffstat (limited to 'home/apps')
| -rw-r--r-- | home/apps/caelestia/settings.nix | 5 | ||||
| -rw-r--r-- | home/apps/default.nix | 1 | ||||
| -rw-r--r-- | home/apps/kanshi.nix | 53 |
3 files changed, 54 insertions, 5 deletions
diff --git a/home/apps/caelestia/settings.nix b/home/apps/caelestia/settings.nix index a529241..c116025 100644 --- a/home/apps/caelestia/settings.nix +++ b/home/apps/caelestia/settings.nix @@ -81,11 +81,6 @@ in { audio = ["pavucontrol"]; playback = ["mpv"]; }; - # disable lock screen - idle = { - lockBeforeSleep = false; - timeouts = []; - }; }; # Background diff --git a/home/apps/default.nix b/home/apps/default.nix index 1823b0d..baf9d82 100644 --- a/home/apps/default.nix +++ b/home/apps/default.nix @@ -7,6 +7,7 @@ _: { ./alacritty.nix ./astal.nix ./hyprlock.nix + ./kanshi.nix ./kitty.nix ./mako.nix ]; diff --git a/home/apps/kanshi.nix b/home/apps/kanshi.nix new file mode 100644 index 0000000..ed7622a --- /dev/null +++ b/home/apps/kanshi.nix @@ -0,0 +1,53 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkIf; + cfg = config.apps.kanshi; + + laptopMonitors = lib.lists.filter (mon: mon.laptop) config.monitors; + dockedMonitors = lib.lists.filter (mon: !mon.laptop) config.monitors; + + mkOutput = mon: status: + lib.mkMerge [ + { + criteria = + if mon.desc == "" + then mon.port + else mon.desc; + scale = mon.scale; + inherit status; + } + (lib.mkIf (mon.position.x != 0 || mon.position.y != 0) { + position = "${toString mon.position.x},${toString mon.position.y}"; + }) + (lib.mkIf (mon.size.x != 0 && mon.size.y != 0) { + mode = "${toString mon.size.x}x${toString mon.size.y}"; + }) + ]; + + mkEnabledOutput = mon: (mkOutput mon "enable"); + mkDisabledOutput = mon: (mkOutput mon "disable"); +in { + config = mkIf cfg.enable { + services.kanshi = { + enable = true; + + settings = [ + { + profile = { + name = "laptop"; + outputs = map mkEnabledOutput laptopMonitors; + }; + } + { + profile = { + name = "docked"; + outputs = (map mkEnabledOutput dockedMonitors) ++ (map mkDisabledOutput laptopMonitors); + }; + } + ]; + }; + }; +} |