about summary refs log tree commit diff
path: root/configs/.config/nixpkgs/home.nix
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-03-16T13·59+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-03-16T13·59+0000
commit1487d0666061f2ced7a87152e3e7c3f36378962c (patch)
treea822279a3076b4689d615749710664aec2e3a4a5 /configs/.config/nixpkgs/home.nix
parentfbf66c423b37d7f86b5f7679cb09d8bc75c41ff6 (diff)
Support autorandr
Enable autorandr with Nix home-manager. I discovered autorandr when looking
through the home-manager source code. I was hoping it would automatically
enable/disable my external monitor when I connect/disconnect my HDMI cable, but
it doesn't.

With autorandr, I run...

```shell
> autorandr --load mobile
```

...to load my randr settings for just my laptop without the external monitor,
and I run...

```shell
> autorandr --load docked
```

...to load my randr settings for my external monitor.

I'm not sure if this brings much more value than my existing display.el module,
but I'm willing to try it for now.
Diffstat (limited to 'configs/.config/nixpkgs/home.nix')
-rw-r--r--configs/.config/nixpkgs/home.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/configs/.config/nixpkgs/home.nix b/configs/.config/nixpkgs/home.nix
index a344ca7b772e..15008bd412fd 100644
--- a/configs/.config/nixpkgs/home.nix
+++ b/configs/.config/nixpkgs/home.nix
@@ -134,6 +134,52 @@ in {
     enableFishIntegration = true;
   };
 
+  programs.autorandr = {
+    enable = true;
+    profiles = let
+      # To get these values, I ran `xrandr --props` and searched for
+      # 'EDID:'. While these are long and a bit unsightly, I cannot think of a
+      # desirable workaround, so I'm going to leave them for now.
+      laptop = "00ffffffffffff000daed71400000000151b0104a51f117802ee95a3544c99260f505400000001010101010101010101010101010101363680a0703820402e1e240035ad10000018000000fe004e3134304843452d474e320a20000000fe00434d4e0a202020202020202020000000fe004e3134304843452d474e320a2000e2";
+      hdmi4k = "00ffffffffffff001e6d085b6d4a0400061c0103803c2278ea3035a7554ea3260f50542108007140818081c0a9c0d1c081000101010108e80030f2705a80b0588a0058542100001e04740030f2705a80b0588a0058542100001a000000fd00383d1e873c000a202020202020000000fc004c4720556c7472612048440a200150020330714d902220050403020161605d5e5f230907076d030c001000b83c20006001020367d85dc401788003e30f0003023a801871382d40582c450058542100001a565e00a0a0a029503020350058542100001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad";
+    in {
+      mobile = {
+        fingerprint = {
+          eDP1 = laptop;
+          HDMI1 = hdmi4k;
+        };
+        config = {
+          eDP1 = {
+            enable = true;
+            primary = true;
+            mode = "1920x1080";
+            rate = "59.93";
+          };
+          HDMI1 = {
+            enable = false;
+          };
+        };
+      };
+      docked = {
+        fingerprint = {
+          eDP1 = laptop;
+          HDMI1 = hdmi4k;
+        };
+        config = {
+          eDP1 = {
+            enable = false;
+          };
+          HDMI1 = {
+            enable = true;
+            primary = true;
+            mode = "3840x2160";
+            rate = "30.00";
+          };
+        };
+      };
+    };
+  };
+
   ##############################################################################
   # Services
   ##############################################################################