2024-05-18 14:33:22 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-05-20 21:15:16 +02:00
|
|
|
cfg = config.myConfig.sway.kanshi;
|
2024-05-18 14:33:22 +02:00
|
|
|
in {
|
2024-05-20 21:15:16 +02:00
|
|
|
options.myConfig.sway.kanshi = {
|
|
|
|
enable = lib.mkEnableOption "kanshi, a dynamic display recognizer";
|
|
|
|
laptop = lib.mkEnableOption "laptop workspaces";
|
2024-05-18 14:33:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
services.kanshi = {
|
|
|
|
enable = true;
|
2024-06-12 11:56:33 +02:00
|
|
|
settings = lib.mkIf cfg.laptop [
|
|
|
|
{
|
|
|
|
profile.name = "laptop";
|
|
|
|
profile.outputs = [
|
2024-05-18 14:33:22 +02:00
|
|
|
{
|
|
|
|
criteria = "eDP-1";
|
2024-06-12 11:56:33 +02:00
|
|
|
position = "0,0";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
profile.outputs = [
|
|
|
|
{
|
|
|
|
criteria = "eDP-1";
|
2024-06-12 12:01:14 +02:00
|
|
|
position = "0,1080";
|
2024-05-18 14:33:22 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
criteria = "Dell Inc. DELL U2422HE GRCPH83";
|
|
|
|
position = "0,0";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
criteria = "NEC Corporation E243WMi 7X313185NB";
|
|
|
|
transform = "90";
|
|
|
|
position = "1920,0";
|
|
|
|
}
|
|
|
|
];
|
2024-06-12 11:56:33 +02:00
|
|
|
profile.exec = [
|
2024-05-18 14:33:22 +02:00
|
|
|
"${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"
|
|
|
|
];
|
2024-06-12 11:56:33 +02:00
|
|
|
}
|
|
|
|
{
|
2024-06-12 11:58:18 +02:00
|
|
|
profile.outputs = [
|
2024-05-18 14:33:22 +02:00
|
|
|
{
|
|
|
|
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";
|
|
|
|
}
|
|
|
|
];
|
2024-06-12 11:56:33 +02:00
|
|
|
profile.exec = [
|
2024-05-18 14:33:22 +02:00
|
|
|
"${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"
|
|
|
|
];
|
2024-06-12 11:56:33 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
profile.outputs = [
|
2024-05-18 14:33:22 +02:00
|
|
|
{
|
|
|
|
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";
|
|
|
|
}
|
|
|
|
];
|
2024-06-12 11:56:33 +02:00
|
|
|
profile.exec = [
|
2024-05-18 14:33:22 +02:00
|
|
|
"${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"
|
|
|
|
];
|
2024-06-12 11:56:33 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
profile.outputs = [
|
2024-05-18 14:33:22 +02:00
|
|
|
{
|
|
|
|
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";
|
|
|
|
}
|
|
|
|
];
|
2024-06-12 11:56:33 +02:00
|
|
|
profile.exec = [
|
2024-05-18 14:33:22 +02:00
|
|
|
"${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"
|
2024-09-04 10:35:26 +02:00
|
|
|
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
|
|
|
|
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-3"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
profile.outputs = [
|
|
|
|
{
|
|
|
|
criteria = "eDP-1";
|
|
|
|
position = "0,1080";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
criteria = "Dell Inc. DELL P2422HE 7VWL9M3";
|
|
|
|
position = "0,0";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
criteria = "ViewSonic Corporation VG2448 V5E201960167";
|
|
|
|
transform = "90";
|
2024-09-04 10:37:11 +02:00
|
|
|
position = "1920,0";
|
2024-09-04 10:35:26 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
profile.exec = [
|
2024-09-04 14:13:39 +02:00
|
|
|
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to \"Dell Inc. DELL P2422HE 7VWL9M3\""
|
|
|
|
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to \"ViewSonic Corporation VG2448 V5E201960167\""
|
2024-09-04 10:35:26 +02:00
|
|
|
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
|
2024-05-18 14:33:22 +02:00
|
|
|
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
|
2024-09-04 14:13:39 +02:00
|
|
|
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to \"Dell Inc. DELL P2422HE 7VWL9M3\""
|
2024-05-18 14:33:22 +02:00
|
|
|
];
|
2024-06-12 11:56:33 +02:00
|
|
|
}
|
|
|
|
{
|
2024-06-12 12:02:40 +02:00
|
|
|
profile.name = "docked-4k";
|
2024-06-12 11:56:33 +02:00
|
|
|
profile.outputs = [
|
2024-05-18 14:33:22 +02:00
|
|
|
{
|
|
|
|
criteria = "eDP-1";
|
|
|
|
position = "320,1440";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
criteria = "HannStar Display Corp HC281UPB ";
|
|
|
|
position = "0,0";
|
|
|
|
mode = "3840x2160@60";
|
|
|
|
scale = 1.5;
|
|
|
|
}
|
|
|
|
];
|
2024-06-12 11:56:33 +02:00
|
|
|
profile.exec = [
|
2024-05-18 14:33:22 +02:00
|
|
|
"${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"
|
|
|
|
];
|
2024-06-12 11:56:33 +02:00
|
|
|
}
|
|
|
|
];
|
2024-05-18 14:33:22 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|