feat(display): per-profile workspace→output pins (item 15c)
A display profile can now pin workspaces to outputs:
docked = {
monitors = [ … ];
workspaces = { "1" = "DP-3"; "9" = "eDP-1"; };
};
The bare list-of-monitors shape still works (either-type; hyprland.nix
normalizes — coercedTo refuses list-of-submodule sources). Pins bake as
Hyprland `workspace` rules from the active profile and apply instantly
on `nomarchy-display-profile apply`: keyword sets the session rule,
moveworkspacetomonitor moves open workspaces over. Pins from a
previously applied profile linger in-session until reload/rebuild
(hyprctl can only add) — inert if the output is absent, noted in the
applier.
V1: flake check green (checks.display-profiles now asserts
workspaceRule) + scratch-downstream eval: baked settings carry both
rule sets, the generated applier has the keyword+dispatch pairs
(bash -n), match/list correct with mixed shapes. V3 queued in
HARDWARE-QUEUE (rides the dock test). Item 15 complete — deleted.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -55,6 +55,33 @@ let
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# One display profile: a monitor layout plus optional workspace→output
|
||||
# pinning. A bare list of monitor entries still works (the original
|
||||
# shape) — hyprland.nix normalizes it to { monitors = […]; }.
|
||||
# (either, not coercedTo: coercedTo refuses list-of-submodule sources.)
|
||||
displayProfileType = lib.types.either
|
||||
(lib.types.listOf monitorType)
|
||||
(lib.types.submodule {
|
||||
options = {
|
||||
monitors = lib.mkOption {
|
||||
type = lib.types.listOf monitorType;
|
||||
default = [ ];
|
||||
description = "nomarchy.monitors-style entries; each replaces the base entry for the same output whole.";
|
||||
};
|
||||
workspaces = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
default = { };
|
||||
example = { "1" = "DP-3"; "9" = "eDP-1"; };
|
||||
description = ''
|
||||
Workspace → output pinning while this profile is active
|
||||
(Hyprland `workspace = <ws>, monitor:<output>` rules).
|
||||
Applied instantly on profile switch (existing workspaces are
|
||||
moved over) and baked at the next rebuild.
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
in
|
||||
{
|
||||
options.nomarchy = {
|
||||
@@ -284,25 +311,30 @@ in
|
||||
};
|
||||
|
||||
displayProfiles = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.listOf monitorType);
|
||||
type = lib.types.attrsOf displayProfileType;
|
||||
default = { };
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
docked = [
|
||||
{ name = "eDP-1"; resolution = "disable"; }
|
||||
{ name = "DP-3"; position = "0x0"; }
|
||||
{ name = "DP-4"; position = "auto-right"; }
|
||||
];
|
||||
docked = {
|
||||
monitors = [
|
||||
{ name = "eDP-1"; resolution = "disable"; }
|
||||
{ name = "DP-3"; position = "0x0"; }
|
||||
{ name = "DP-4"; position = "auto-right"; }
|
||||
];
|
||||
workspaces = { "1" = "DP-3"; "9" = "DP-4"; };
|
||||
};
|
||||
undocked = [ { name = "eDP-1"; position = "0x0"; } ];
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Named display layouts for the same outputs (docked, undocked, …),
|
||||
each a list of nomarchy.monitors-style entries. Switch from the menu
|
||||
(System › Display › Profiles) or `nomarchy-display-profile apply
|
||||
<name>`: the profile's rules apply instantly via hyprctl and the
|
||||
choice persists in the in-flake state (settings.displayProfile), so
|
||||
the next rebuild bakes the active profile's entries over
|
||||
Named display layouts for the same outputs (docked, undocked, …):
|
||||
a list of nomarchy.monitors-style entries, or an attrset with
|
||||
`monitors` plus optional `workspaces` (workspace → output pinning
|
||||
while the profile is active). Switch from the menu (System ›
|
||||
Display › Profiles) or `nomarchy-display-profile apply <name>`:
|
||||
the profile's rules apply instantly via hyprctl and the choice
|
||||
persists in the in-flake state (settings.displayProfile), so the
|
||||
next rebuild bakes the active profile's entries over
|
||||
nomarchy.monitors by name. Outputs a profile doesn't name keep
|
||||
their base rules.
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user