shell: update fixdisplay command
- add new `position` and `primary` options for fixdisplay - make command completely lowercase - initialize global zshrc
This commit is contained in:
parent
b02fb0734b
commit
8de5dd5f23
@ -152,17 +152,17 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
shellAliases.fixDisplay = let
|
||||
shellAliases.fixdisplay = let
|
||||
inherit (config.machineVars) screens headless fixDisplayCommand;
|
||||
|
||||
screenToArgs = screen: with screen;
|
||||
"--output ${name} --mode ${resolution}"
|
||||
+ (lib.optionalString (frequency != null) " --rate ${frequency}");
|
||||
screenToArgs = name: screen: with screen;
|
||||
"--output ${name} --mode ${resolution} --rate ${toString frequency} --pos ${position}"
|
||||
+ (lib.optionalString primary " --primary");
|
||||
|
||||
screenArgs = lib.concatStringsSep " " (lib.mapAttrsToList screenToArgs screens);
|
||||
|
||||
in lib.mkIf (!headless)
|
||||
(if screenArgs == null
|
||||
(if screenArgs != null
|
||||
then "xrandr ${screenArgs}"
|
||||
else (lib.mkIf (fixDisplayCommand != null) fixDisplayCommand));
|
||||
};
|
||||
@ -305,6 +305,7 @@ in {
|
||||
light.enable = !config.machineVars.headless;
|
||||
npm.enable = true;
|
||||
tmux.enable = true;
|
||||
zsh.enable = true;
|
||||
|
||||
gnupg.agent = {
|
||||
enable = true;
|
||||
|
@ -20,11 +20,7 @@ in {
|
||||
headless = false;
|
||||
laptop = true;
|
||||
|
||||
screens = {
|
||||
"eDP-1" = {
|
||||
resolution = "1920x1080";
|
||||
};
|
||||
};
|
||||
screens."eDP-1".primary = true;
|
||||
};
|
||||
|
||||
systemd.targets = {
|
||||
|
@ -25,12 +25,15 @@
|
||||
default = main;
|
||||
};
|
||||
|
||||
fixDisplayCommand = "xrandr --output DP-4 --mode 1920x1080 --pos 0x0 -r 144 --output HDMI-0 --primary --mode 1920x1080 --pos 1920x0 -r 60";
|
||||
|
||||
# screens = {
|
||||
# "DP-1" = {};
|
||||
# "HDMI-1" = {};
|
||||
# };
|
||||
screens = {
|
||||
DP-4 = {
|
||||
primary = true;
|
||||
frequency = 144;
|
||||
};
|
||||
HDMI-0 = {
|
||||
position = "1920x0";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.targets = {
|
||||
|
@ -9,12 +9,6 @@ in {
|
||||
screens = mkOption {
|
||||
type = types.attrsOf (types.submodule ( { name, ...}: {
|
||||
options = {
|
||||
resolution = mkOption {
|
||||
type = types.str;
|
||||
example = "1920x1080";
|
||||
description = "The resolution of the screen";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = name;
|
||||
@ -22,11 +16,28 @@ in {
|
||||
description = "The name of the screen";
|
||||
};
|
||||
|
||||
freq = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
example = "60.00";
|
||||
primary = mkEnableOption "Whether this screen should be the primary one. There can only be one primary screen";
|
||||
|
||||
resolution = mkOption {
|
||||
type = types.str;
|
||||
example = "3840x2160";
|
||||
default = "1920x1080";
|
||||
description = "The resolution of the screen";
|
||||
};
|
||||
|
||||
frequency = mkOption {
|
||||
type = types.ints.positive;
|
||||
example = 144;
|
||||
default = 60;
|
||||
description = "The update frequency of the screen, defined in Hz";
|
||||
};
|
||||
|
||||
position = mkOption {
|
||||
type = types.str;
|
||||
example = "1920x0";
|
||||
default = "0x0";
|
||||
description = "The position of the screen, compared to the other screens";
|
||||
};
|
||||
};
|
||||
}));
|
||||
default = { };
|
||||
@ -102,6 +113,11 @@ t tools preinstalled.";
|
||||
assertion = cfg.battery != null -> cfg.laptop;
|
||||
message = "A battery shouldn't exist on a non laptop machine";
|
||||
}
|
||||
# FIXME:
|
||||
# {
|
||||
# assertion = map () (cfg.screens)
|
||||
# message = "There can only be one primary screen.";
|
||||
# }
|
||||
];
|
||||
|
||||
warnings = lib.optionals (0 < (lib.length (builtins.attrNames cfg.screens)) && (cfg.fixDisplayCommand != null)) [
|
||||
|
Loading…
Reference in New Issue
Block a user