From d14e0e34a34d6fba35e977c8737fd78c60285a32 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 31 May 2024 15:48:46 +0100 Subject: [PATCH] cinnamon-monitors --- .../desktop/cinnamon/cinnamon-monitors.nix | 29 +++++++++++++++++++ .../optional/desktop/cinnamon/default.nix | 7 ++++- home/sparky.nix | 20 ++++++++++--- hosts/common/users/media/default.nix | 1 - modules/home-manager/monitors.nix | 12 ++++++++ 5 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 home/common/optional/desktop/cinnamon/cinnamon-monitors.nix diff --git a/home/common/optional/desktop/cinnamon/cinnamon-monitors.nix b/home/common/optional/desktop/cinnamon/cinnamon-monitors.nix new file mode 100644 index 0000000..704faa9 --- /dev/null +++ b/home/common/optional/desktop/cinnamon/cinnamon-monitors.nix @@ -0,0 +1,29 @@ +{ pkgs, ... }: { + home.file.".config/cinnamon-monitors".text = '' + + + ${builtins.concatStringsSep "\n" (map (monitor: '' + + ${toString monitor.x} + ${toString monitor.y} + ${toString monitor.scale} + ${if monitor.primary then "yes" else ""} + + + ${toString monitor.name} + ${toString monitor.vendor} + ${toString monitor.product} + ${toString monitor.serial} + + + ${toString monitor.width} + ${toString monitor.height} + ${toString monitor.refreshRate} + + + + ''))} + + + ''; +} diff --git a/home/common/optional/desktop/cinnamon/default.nix b/home/common/optional/desktop/cinnamon/default.nix index 65b3071..624de3e 100644 --- a/home/common/optional/desktop/cinnamon/default.nix +++ b/home/common/optional/desktop/cinnamon/default.nix @@ -1 +1,6 @@ -{imports = [../common];} +{ + imports = [ + ../common + ./cinnamon-monitors.nix + ]; +} diff --git a/home/sparky.nix b/home/sparky.nix index ba0a262..f672fb0 100644 --- a/home/sparky.nix +++ b/home/sparky.nix @@ -18,14 +18,26 @@ ]; monitors = [ + { + name = "HDMI-0"; + width = 2560; + height = 1440; + vendor = "SAM"; + product = "SAMSUNG"; + serial = "0x01000e00"; + refreshRate = 60; + x = 0; + primary = true; + } { name = "HDMI-1"; width = 2560; height = 1440; - refreshRate = 59.95; - x = 0; - workspace = "1"; - primary = true; + vendor = "ACI"; + product = "ASUS PB277"; + serial = "0x0002507d"; + refreshRate = 75; + x = 2560; } ]; } diff --git a/hosts/common/users/media/default.nix b/hosts/common/users/media/default.nix index b03a540..8ed72dd 100644 --- a/hosts/common/users/media/default.nix +++ b/hosts/common/users/media/default.nix @@ -40,7 +40,6 @@ in ".local" ]; files = [ - ".config/cinnamon-monitors.xml" ]; }; }; diff --git a/modules/home-manager/monitors.nix b/modules/home-manager/monitors.nix index fb048b8..061897a 100644 --- a/modules/home-manager/monitors.nix +++ b/modules/home-manager/monitors.nix @@ -42,6 +42,18 @@ in { type = types.int; default = 1; }; + vendor = mkOption { + type = types.str; + default = ""; + }; + product = mkOption { + type = types.str; + default = ""; + }; + serial = mkOption { + type = types.str; + default = ""; + }; enabled = mkOption { type = types.bool; default = true;