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

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