agony
This commit is contained in:
parent
fa2bff4aca
commit
def13f7226
1 changed files with 19 additions and 7 deletions
|
@ -1,20 +1,32 @@
|
|||
# fixme: when rebuiling the commands are ran as some nixos builder user probably and autorandr does not use my config
|
||||
# fixme: main issue here is that xrandr can't open a display as the nixbld user
|
||||
{ pkgs, ... }: let
|
||||
autorandr = "${pkgs.autorandr}/bin/autorandr";
|
||||
rg = "${pkgs.ripgrep}/bin/rg";
|
||||
rev = "${pkgs.util-linux}/bin/rev";
|
||||
cut = "${pkgs.coreutils-full}/bin/cut";
|
||||
xrandr = "${pkgs.xorg.xrandr}/bin/xrandr";
|
||||
# epically stolen from https://git.jacekpoz.pl/jacekpoz/nte/src/branch/master/stdlib.nix
|
||||
# but i changed lib.strings.readFile to lib.fileContents
|
||||
inherit (pkgs) lib runCommand;
|
||||
inherit (lib) fileContents;
|
||||
run = script: builtins.toString (runCommand "run" {} ''
|
||||
echo $(${script}) > $out
|
||||
# and modified
|
||||
inherit (pkgs) lib runCommandLocal;
|
||||
inherit (lib.strings) readFile;
|
||||
run = script: readFile (runCommandLocal "run" {} ''
|
||||
bash -c '${script}' &> $out || true
|
||||
'');
|
||||
in {
|
||||
# this parses "main: renaming display Left to DisplayPort-2"
|
||||
# and i am interested in "DisplayPort-2"
|
||||
# and also it's printed to stderr so 2>&1
|
||||
left = run "${autorandr} --match-edid 2>&1 | ${rg} Left | ${rev} | ${cut} -d' ' -f1 | ${rev}";
|
||||
right = run "${autorandr} --match-edid 2>&1 | ${rg} Right | ${rev} | ${cut} -d' ' -f1 | ${rev}";
|
||||
# left = run "XDG_CONFIG_HOME=/home/krizej/.config/; ${autorandr} --match-edid 2>&1 | ${rg} Left | ${rev} | ${cut} -d\" \" -f1 | ${rev}";
|
||||
# right = run "${autorandr} --match-edid 2>&1 | ${rg} Right | ${rev} | ${cut} -d' ' -f1 | ${rev}";
|
||||
|
||||
right = run ''
|
||||
mkdir autorandr
|
||||
mkdir autorandr/main
|
||||
touch autorandr/main/config
|
||||
touch autorandr/main/status
|
||||
PATH=$PATH:${pkgs.xorg.xrandr}/bin; ${autorandr} --list
|
||||
'';
|
||||
|
||||
left = "";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue