Elaborate set up for work

This commit is contained in:
Natsu Kagami 2023-09-01 10:38:24 +02:00
parent 8860ed52da
commit a6e46307b0
Signed by: nki
GPG key ID: 55A032EB38B49ADB
2 changed files with 9 additions and 7 deletions

View file

@ -8,12 +8,12 @@ let
"work" = { "work" = {
name = "LG Electronics LG ULTRAFINE 301MAXSGHD10"; name = "LG Electronics LG ULTRAFINE 301MAXSGHD10";
mode = "3840x2160@60Hz"; mode = "3840x2160@60Hz";
scale = "1.25"; scale = 1.25;
}; };
"home_4k" = { "home_4k" = {
name = "AOC U28G2G6B PPYP2JA000013"; name = "AOC U28G2G6B PPYP2JA000013";
mode = "3840x2160@60Hz"; mode = "3840x2160@60Hz";
scale = mkDefault "1.5"; scale = 1.5;
adaptive_sync = "on"; adaptive_sync = "on";
# render_bit_depth = "10"; # render_bit_depth = "10";
}; };
@ -33,7 +33,9 @@ let
eachMonitor = _name: monitor: { eachMonitor = _name: monitor: {
name = monitor.name; name = monitor.name;
value = builtins.removeAttrs monitor [ "name" ]; value = builtins.removeAttrs monitor [ "scale" "name" ] // (if monitor ? scale then {
scale = toString monitor.scale;
} else { });
}; };
in in
{ {
@ -44,7 +46,7 @@ in
config.common.monitors = monitors; config.common.monitors = monitors;
config.home.packages = mkIf config.wayland.windowManager.sway.enable (with pkgs; [ kanshi ]); config.home.packages = mkIf config.wayland.windowManager.sway.enable (with pkgs; [ kanshi ]);
config.wayland.windowManager.sway.config.output = mkIf config.wayland.windowManager.sway.enable ( config.wayland.windowManager.sway.config.output = mkIf config.wayland.windowManager.sway.enable (
mapAttrs' eachMonitor monitors mapAttrs' eachMonitor config.common.monitors
); );
} }

View file

@ -82,12 +82,12 @@
}; };
# Multiple screen setup # Multiple screen setup
services.kanshi = { services.kanshi = with config.common.monitors; {
enable = true; enable = true;
profiles.undocked.outputs = [{ criteria = "LVDS-1"; }]; profiles.undocked.outputs = [{ criteria = "LVDS-1"; }];
profiles.work-both.outputs = [ profiles.work-both.outputs = [
{ criteria = "eDP-1"; position = "0,0"; status = "enable"; } { criteria = "eDP-1"; position = "0,${toString (builtins.floor ((2160 / work.scale - 1200) + 1200 / 3))}"; status = "enable"; }
{ criteria = config.common.monitors.work.name; position = "1920,0"; } { criteria = work.name; position = "1920,0"; }
]; ];
profiles.work-one.outputs = [ profiles.work-one.outputs = [
{ criteria = "eDP-1"; status = "disable"; } { criteria = "eDP-1"; status = "disable"; }