nixos/modules/home/sway/kanshi.nix

169 lines
5.4 KiB
Nix
Raw Normal View History

{
lib,
config,
pkgs,
...
}: let
cfg = config.myConfig.sway.kanshi;
in {
options.myConfig.sway.kanshi = {
enable = lib.mkEnableOption "kanshi, a dynamic display recognizer";
laptop = lib.mkEnableOption "laptop workspaces";
};
config = lib.mkIf cfg.enable {
services.kanshi = {
enable = true;
profiles = lib.mkIf cfg.laptop {
laptop.outputs = [
{
criteria = "eDP-1";
position = "0,0";
}
];
dock_luhbots = {
outputs = [
{
criteria = "eDP-1";
position = "0,1080";
}
{
criteria = "Dell Inc. DELL U2422HE GRCPH83";
position = "0,0";
}
{
criteria = "NEC Corporation E243WMi 7X313185NB";
transform = "90";
position = "1920,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-4"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-5"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-4"
];
};
dock_luhbots2 = {
outputs = [
{
criteria = "eDP-1";
position = "1080,1080";
}
{
criteria = "Dell Inc. DELL U2422HE 8YCPH83";
position = "1080,0";
}
{
criteria = "NEC Corporation E243WMi 59118576NB";
transform = "90";
position = "0,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-4"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-5"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-4"
];
};
dock_luhbots3 = {
outputs = [
{
criteria = "eDP-1";
position = "0,1080";
}
{
criteria = "Dell Inc. DELL U2422HE 53DCH83";
position = "0,0";
}
{
criteria = "Dell Inc. DELL U2412M 0FFXD46I4U5S";
transform = "90";
position = "1920,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-6"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-7"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-6"
];
};
dock_luhbots4 = {
outputs = [
{
criteria = "eDP-1";
position = "1080,1080";
}
{
criteria = "Dell Inc. DELL P2422HE 4BXL9M3";
position = "1080,0";
}
{
criteria = "NEC Corporation E243WMi 75309334NB";
transform = "90";
position = "0,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-3"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-4"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-3"
];
};
dock_luhbots5 = {
outputs = [
{
criteria = "eDP-1";
position = "0,1080";
}
{
criteria = "Dell Inc. DELL U2422HE 53DCH83";
position = "0,0";
}
{
criteria = "Dell Inc. DELL U2412M 0FFXD46I4U5S";
transform = "90";
position = "1080,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-6"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-7"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-6"
];
};
laptop_hannspree = {
outputs = [
{
criteria = "eDP-1";
position = "320,1440";
}
{
criteria = "HannStar Display Corp HC281UPB ";
position = "0,0";
mode = "3840x2160@60";
scale = 1.5;
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to HDMI-A-1"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to HDMI-A-1"
];
};
};
};
};
}