101 lines
2.6 KiB
Nix
101 lines
2.6 KiB
Nix
{ lib, config, ... }:
|
|
{
|
|
options =
|
|
with lib;
|
|
with types;
|
|
{
|
|
hardware.monitors = mkOption {
|
|
type = lazyAttrsOf (submodule {
|
|
options = {
|
|
mode = mkOption {
|
|
type = str;
|
|
default = "auto";
|
|
};
|
|
position = mkOption {
|
|
type = str;
|
|
default = "auto";
|
|
};
|
|
rotation = mkOption {
|
|
type = enum [
|
|
"none"
|
|
"90"
|
|
"180"
|
|
"270"
|
|
];
|
|
default = "none";
|
|
};
|
|
flipped = mkOption {
|
|
type = bool;
|
|
default = false;
|
|
};
|
|
};
|
|
});
|
|
default = { };
|
|
description = "Monitor configuration";
|
|
};
|
|
};
|
|
|
|
# config = {
|
|
# xdg.configFile."hypr/monitors.lua" = lib.mkIf config.wayland.windowManager.hyprland.enable {
|
|
# text =
|
|
# let
|
|
# workspaceSettings = (
|
|
# lib.imap0 (
|
|
# idx:
|
|
# { name, value }:
|
|
# let
|
|
# offset = idx * 10;
|
|
# in
|
|
# lib.concatMapStrings (
|
|
# i:
|
|
# let
|
|
# ws = offset + i;
|
|
# in
|
|
# ''
|
|
# hl.workspace_rule({ workspace = ${toString ws}, monitor = "${name}", default_name = "${toString i}" })
|
|
# ''
|
|
# ) (lib.range 1 10)
|
|
# ) (lib.attrsToList config.hardware.monitors)
|
|
# );
|
|
# transformMap = {
|
|
# "none" = {
|
|
# normal = 0;
|
|
# flipped = 4;
|
|
# };
|
|
# "90" = {
|
|
# normal = 1;
|
|
# flipped = 5;
|
|
# };
|
|
# "180" = {
|
|
# normal = 2;
|
|
# flipped = 6;
|
|
# };
|
|
# "270" = {
|
|
# normal = 3;
|
|
# flipped = 7;
|
|
# };
|
|
# };
|
|
#
|
|
# monitorTransform =
|
|
# m:
|
|
# let
|
|
# t = transformMap.${m.rotation};
|
|
# in
|
|
# if m.flipped then t.flipped else t.normal;
|
|
#
|
|
# monitorString = name: m: ''
|
|
# hl.monitor({
|
|
# output = "${name}",
|
|
# mode = "${m.mode}",
|
|
# position = "${m.position}",
|
|
# transform = ${toString (monitorTransform m)},
|
|
# })
|
|
# '';
|
|
#
|
|
# monitorSettings = lib.mapAttrsToList monitorString config.hardware.monitors;
|
|
# in
|
|
# lib.concatStringsSep "\n" (workspaceSettings ++ monitorSettings);
|
|
# };
|
|
# };
|
|
}
|