dotfiles/home/fhauser/applications/kanshi.nix
2024-10-13 17:07:14 +03:00

65 lines
1.8 KiB
Nix

{
pkgs,
lib,
config,
...
}:
{
# systemd.user.services.kanshi.Install.WantedBy = "home-manager-fhauser.service"; # TODO: Upstream array type of systemdTarget
services.kanshi = {
enable = true;
settings =
let
mkScreen = display: position: {
inherit (display.output) criteria;
inherit position;
};
mkProfile = name: outputs: {
profile = {
inherit name outputs;
exec = backgroundCommand;
};
};
# Can be applied by profile.exec
backgroundPicturePath = "~/shares/cloud.qo.is/pictures/backgrounds";
backgroundCommand = ''
swaymsg "output * bg `find ${backgroundPicturePath} -type f | shuf -n 1` fill"
'';
screens = {
x1-screen.output = {
criteria = "California Institute of Technology 0x1404 Unknown";
scale = null;
};
chur-4k.output = {
criteria = "HP Inc. HP Z27 CN482201RP";
scale = 1.2;
};
chur-dell.output = {
criteria = "Dell Inc. DELL P2720DC 22JPK53";
scale = null;
};
chur-small.output = {
criteria = "Eizo Nanao Corporation EV2450 92395086";
scale = null;
};
estonia-thinkvision = {
criteria = "Lenovo Group Limited LEN P24h-20 V307DA61";
scale = null;
};
};
in
with lib;
(attrValues screens)
++ (with screens; [
(mkProfile "home-dock" [
(mkScreen x1-screen "0,120")
(mkScreen chur-4k "1920,0")
])
(mkProfile "saba-desk" [
(mkScreen estonia-thinkvision "0,0")
(mkScreen x1-screen "2560,0")
])
]);
};
}