fix displays

This commit is contained in:
tristan 2023-05-15 11:38:08 +01:00
parent 954c85f23b
commit 9ce692cb5f
5 changed files with 24 additions and 25 deletions

View file

@ -8,13 +8,20 @@
name = "DP-1"; name = "DP-1";
description = "HP Inc. HP 24x 1CR9500W9Q"; description = "HP Inc. HP 24x 1CR9500W9Q";
resolution = { x = 1920; y = 1080; freq = 144; }; resolution = { x = 1920; y = 1080; freq = 144; };
position = "0x0"; position.x = 0;
position.y = 0;
wallpaper = "/home/tristan/Pictures/backgrounds/demonslayer.jpg";
}
{
name = "HDMI-A-1";
resolution = {x=1920;y=1080;freq=60;};
wallpaper = "/home/tristan/Pictures/backgrounds/nier.jpg";
} }
{ {
name = "eDP-1"; name = "eDP-1";
description = "BOE 0x07D8"; description = "BOE 0x07D8";
scaling = 1.2; scaling = 1.2;
position = "0x1080"; position.y = 1080;
wallpaper = "/home/tristan/Pictures/backgrounds/nix-wallpaper-watersplash.png"; wallpaper = "/home/tristan/Pictures/backgrounds/nix-wallpaper-watersplash.png";
} }
]; ];

View file

@ -7,6 +7,7 @@
imports = imports =
[ [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
./displays.nix
]; ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
@ -67,22 +68,6 @@
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
displays = {
enable = true;
displays = [
{
name = "DP-1";
resolution = {x=1920;y=1080;freq=144;};
wallpaper = "~/Pictures/backgrounds/demonslayer.jpg";
}
{
name = "HDMI-A-1";
resolution = {x=1920;y=1080;freq=60;};
wallpaper = "~/Pictures/backgrounds/nier.jpg";
}
];
};
hardware.keyboard.zsa.enable = true; hardware.keyboard.zsa.enable = true;
services.tlp = { services.tlp = {

View file

@ -36,7 +36,7 @@ let
else "desc:" + display.description; else "desc:" + display.description;
positionToHyprlandString = { x, y }: positionToHyprlandString = { x, y }:
if (x == "" || y == "") then "auto" else x + "x" + y; if (x == -1 || y == -1) then "auto" else toString x + "x" + toString y;
renderDisplaysForSway = displays: renderDisplaysForSway = displays:
listToAttrs (map displaySwaySetting displays); listToAttrs (map displaySwaySetting displays);
@ -45,7 +45,7 @@ let
name = display.name; name = display.name;
value = let res = display.resolution; in value = let res = display.resolution; in
{ {
mode = mkIf (resIsSet res) mode = mkIf (!resUnset res)
"${toString res.x}x${toString res.y}@${toString res.freq}Hz"; "${toString res.x}x${toString res.y}@${toString res.freq}Hz";
bg = display.wallpaper + " fill"; bg = display.wallpaper + " fill";
scale = toString display.scaling; scale = toString display.scaling;
@ -92,10 +92,12 @@ let
default = { }; default = { };
}; };
position.x = mkOption { position.x = mkOption {
default = ""; default = -1;
type = types.int;
}; };
position.y = mkOption { position.y = mkOption {
default = ""; default = -1;
type = types.int;
}; };
wallpaper = mkOption { wallpaper = mkOption {
description = "path to wallpaper"; description = "path to wallpaper";
@ -104,11 +106,11 @@ let
}; };
}); });
resIsSet = res: resUnset = res:
!(res.x == 0 || res.y == 0 || res.freq == 0); (res.x == 0 || res.y == 0 || res.freq == 0);
resToString = res: resToString = res:
if resIsSet res if resUnset res
then "preferred" then "preferred"
else "${toString res.x}x${toString res.y}@${toString res.freq}"; else "${toString res.x}x${toString res.y}@${toString res.freq}";

View file

@ -27,6 +27,7 @@ with lib;
handbrake handbrake
monero-gui monero-gui
xmrig xmrig
transmission-remote-gtk
krita krita
]; ];
}]; }];

View file

@ -377,6 +377,10 @@ in
user = "git"; user = "git";
port = 2222; port = 2222;
}; };
"alpine" = {
hostname = "100.116.82.65";
user = "tristan";
};
}; };
programs.neovim.defaultEditor = true; programs.neovim.defaultEditor = true;