nix-config/home/desktop-xmonad/autorandr.nix

53 lines
1.9 KiB
Nix
Raw Normal View History

2022-01-18 09:32:55 +01:00
{ config, pkgs, ... }:
let
lvds_fingerprint = {
"LVDS-1" = "00ffffffffffff0030e4d8020000000000160103801c1078ea8855995b558f261d505400000001010101010101010101010101010101601d56d85000183030404700159c1000001b000000000000000000000000000000000000000000fe004c4720446973706c61790a2020000000fe004c503132355748322d534c42330059";
};
hdmi_fingerprint = {
"HDMI-2" = "00ffffffffffff0009d1e67845540000261d0103803c22782e4825a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c450056502100001e000000ff004c394b30303333313031510a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323738300a200117020322f14f901f04130312021101140607151605230907078301000065030c001000023a801871382d40582c450056502100001f011d8018711c1620582c250056502100009f011d007251d01e206e28550056502100001e8c0ad08a20e02d10103e960056502100001800000000000000000000000000000000000000000047";
};
lvds_config = {
"LVDS-1" = {
enable = true;
crtc = 0;
mode = "1366x768";
position = "1920x0";
rate = "60.00";
};
};
hdmi_config = {
"HDMI-2" = {
enable = true;
primary = true;
crtc = 0;
mode = "1920x1080";
position = "0x0";
rate = "60.00";
};
};
in
{
programs.autorandr = {
enable = true;
hooks.postswitch = {
"change-background" = "/run/current-system/sw/bin/systemctl --user restart random-background.service";
"restart-xmonad" = "${pkgs.xmonad-with-packages}/bin/xmonad --restart";
};
profiles = {
"default" = {
fingerprint = lvds_fingerprint;
config = lvds_config;
};
"docked-open" = {
fingerprint = pkgs.lib.mkMerge [ hdmi_fingerprint lvds_fingerprint ];
config = pkgs.lib.mkMerge [ hdmi_config lvds_config ];
};
"docked-closed" = {
fingerprint = hdmi_fingerprint;
config = hdmi_config;
};
};
};
}