# problem: # fucking xorg changes my output names randomly !!! # solution: # 1. i use the `rebuild` command to rebuild my nixos system (see misc/nix.nix) # 2. that command updates the file files/autorandr.txt BEFORE running nixos-rebuild # 3. i extract the corrected monitor names and set them to `left` and `right` in this attrset { pkgs, lib, ... }: let # thanks to poz for the base of this run function thing inherit (pkgs) runCommand; inherit (lib) fileContents; run = script: fileContents (runCommand "run" { AUTORANDR_TXT = fileContents ../files/autorandr.txt; } '' bash -c '${script}' > $out ''); printf = "${pkgs.coreutils-full}/bin/printf"; # echo removes the newlines or some shit rg = "${pkgs.ripgrep}/bin/rg"; rev = "${pkgs.util-linux}/bin/rev"; cut = "${pkgs.coreutils-full}/bin/cut"; in { # this parses "main: renaming display Left to DisplayPort-2" # and i am interested in "DisplayPort-2" left = run "${printf} \"$AUTORANDR_TXT\" | ${rg} Left | ${rev} | ${cut} -d\" \" -f1 | ${rev}"; right = run "${printf} \"$AUTORANDR_TXT\" | ${rg} Right | ${rev} | ${cut} -d\" \" -f1 | ${rev}"; }