monitors.nix: added monitor config via modules
This commit is contained in:
parent
59310fd227
commit
7b51187cb9
6 changed files with 102 additions and 72 deletions
|
@ -3,5 +3,6 @@ _: {
|
|||
./configuration.nix
|
||||
./programs.nix
|
||||
./hardware-configuration.nix
|
||||
./hardware
|
||||
];
|
||||
}
|
||||
|
|
1
hosts/vali/hermit/hardware/default.nix
Normal file
1
hosts/vali/hermit/hardware/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
_: {imports = [./monitors.nix];}
|
0
hosts/vali/hermit/hardware/fs.nix
Normal file
0
hosts/vali/hermit/hardware/fs.nix
Normal file
18
hosts/vali/hermit/hardware/monitors.nix
Normal file
18
hosts/vali/hermit/hardware/monitors.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
_: {
|
||||
modules.system.hardware.monitors = [
|
||||
{
|
||||
name = "Integrated laptop screen";
|
||||
device = "eDP-1";
|
||||
resolution = {
|
||||
x = 1920;
|
||||
y = 1080;
|
||||
};
|
||||
scale = 1;
|
||||
refresh_rate = 60;
|
||||
position = {
|
||||
x = 0;
|
||||
y = 0;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
|
@ -1,71 +1,73 @@
|
|||
{lib, ...}:
|
||||
with lib; {
|
||||
options.modules.other.system.monitors = mkOption {
|
||||
{lib, ...}: let
|
||||
inherit (lib) mkOption;
|
||||
inherit (lib.types) str submodule int ints number listOf;
|
||||
in {
|
||||
options.modules.system.monitors = mkOption {
|
||||
description = "\n List of monitors to use\n ";
|
||||
default = [];
|
||||
type = with types;
|
||||
types.listOf (submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
description = "Give your monitor a cute name";
|
||||
default = "monitor0(I am lazy)";
|
||||
};
|
||||
device = mkOption {
|
||||
type = types.str;
|
||||
description = "The actual device name of the monitor";
|
||||
};
|
||||
resolution = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
x = mkOption {
|
||||
type = types.int;
|
||||
description = "monitor width";
|
||||
default = "1920";
|
||||
};
|
||||
y = mkOption {
|
||||
type = types.int;
|
||||
description = "monitor height";
|
||||
default = "1080";
|
||||
};
|
||||
type = listOf (submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = str;
|
||||
description = "Give your monitor a cute name";
|
||||
default = "";
|
||||
};
|
||||
device = mkOption {
|
||||
type = str;
|
||||
description = "The actual device name of the monitor";
|
||||
default = "eDP-1";
|
||||
};
|
||||
resolution = mkOption {
|
||||
type = submodule {
|
||||
options = {
|
||||
x = mkOption {
|
||||
type = int;
|
||||
description = "monitor width";
|
||||
default = "1920";
|
||||
};
|
||||
y = mkOption {
|
||||
type = int;
|
||||
description = "monitor height";
|
||||
default = "1080";
|
||||
};
|
||||
};
|
||||
};
|
||||
scale = mkOption {
|
||||
type = types.number;
|
||||
description = "monitor scale";
|
||||
default = 1.0;
|
||||
};
|
||||
refresh_rate = mkOption {
|
||||
type = types.int;
|
||||
description = "monitor refresh rate (in Hz)";
|
||||
default = 60;
|
||||
};
|
||||
position = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
x = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
y = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
description = "absolute monitor posititon";
|
||||
default = {
|
||||
x = 0;
|
||||
y = 0;
|
||||
};
|
||||
};
|
||||
transform = mkOption {
|
||||
type = types.ints.between 0 3;
|
||||
description = "Rotation of the monitor counterclockwise";
|
||||
default = 0;
|
||||
};
|
||||
};
|
||||
});
|
||||
scale = mkOption {
|
||||
type = number;
|
||||
description = "monitor scale";
|
||||
default = 1.0;
|
||||
};
|
||||
refresh_rate = mkOption {
|
||||
type = int;
|
||||
description = "monitor refresh rate (in Hz)";
|
||||
default = 60;
|
||||
};
|
||||
position = mkOption {
|
||||
type = submodule {
|
||||
options = {
|
||||
x = mkOption {
|
||||
type = int;
|
||||
default = 0;
|
||||
};
|
||||
y = mkOption {
|
||||
type = int;
|
||||
default = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
description = "absolute monitor posititon";
|
||||
default = {
|
||||
x = 0;
|
||||
y = 0;
|
||||
};
|
||||
};
|
||||
transform = mkOption {
|
||||
type = ints.between 0 3;
|
||||
description = "Rotation of the monitor counterclockwise";
|
||||
default = 0;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
cfg = config.modules.usrEnv.desktops.hyprland;
|
||||
inherit (config.modules.other.system) username;
|
||||
inherit (config.modules.style) cursor;
|
||||
inherit (config.modules.hardware) monitors;
|
||||
|
||||
inherit
|
||||
(inputs'.split-monitor-workspaces.packages)
|
||||
|
@ -58,14 +59,21 @@ in {
|
|||
"$mainMod" = "SUPER";
|
||||
|
||||
# Monitor config
|
||||
monitor = [
|
||||
"eDP-1,1920x1080,0x0,1"
|
||||
# "DP-2,1920x1080,0x0,1"
|
||||
# "HDMI-A-2,1920x1080,1920x0,1"
|
||||
# "HDMI-A-1,1920x1080,3840x0,1"
|
||||
# Had the shadow monitor bug, so had to disable all unknown monitors.
|
||||
"Unknown-1,disable"
|
||||
];
|
||||
# monitor = [
|
||||
# "eDP-1,1920x1080,0x0,1"
|
||||
# # "DP-2,1920x1080,0x0,1"
|
||||
# # "HDMI-A-2,1920x1080,1920x0,1"
|
||||
# # "HDMI-A-1,1920x1080,3840x0,1"
|
||||
# # Had the shadow monitor bug, so had to disable all unknown monitors.
|
||||
# "Unknown-1,disable"
|
||||
# ];
|
||||
|
||||
monitor =
|
||||
map (
|
||||
m: "${m.device},${toString m.resolution.x}x${toString m.resolution.y}@${toString m.refresh_rate},${toString m.position.x}x${toString m.position.y},${toString m.scale},transform,${toString m.transform}"
|
||||
)
|
||||
monitors; #TODO: default value
|
||||
|
||||
# Workspace config
|
||||
workspace = [
|
||||
"1,monitor:eDP-1, default:true"
|
||||
|
@ -163,7 +171,7 @@ in {
|
|||
];
|
||||
# Hyprland anomations, using the above bezier curves
|
||||
animations = {
|
||||
enabled = true;
|
||||
enabled = false;
|
||||
animation = [
|
||||
"windows, 1, 4, dupa, popin"
|
||||
"windowsOut, 1, 4, dupa, slide"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue