2024-08-28 13:52:43 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
2024-09-22 19:21:53 +02:00
|
|
|
inherit (config.meta.mainUser) username;
|
2024-08-28 13:52:43 +02:00
|
|
|
inherit (config.modules.system.hardware) monitors;
|
|
|
|
inherit (lib) imap0 flatten optionalString;
|
|
|
|
inherit (builtins) map genList attrNames toString;
|
|
|
|
in {
|
|
|
|
home-manager.users.${username} = {
|
2024-08-28 14:17:38 +02:00
|
|
|
wayland.windowManager.hyprland.settings = {
|
|
|
|
# INFO: This is a custom function to map all of my monitors to workspaces.
|
|
|
|
# Since I use split-monitor-workspaces, I map 10 workspaces to each monitor
|
|
|
|
# and set the first one to be the default one.
|
2024-08-30 20:19:07 +02:00
|
|
|
# To be able to use this for a varying amount of monitors we do some nasty trickery.
|
|
|
|
# This was inspired by jacekpoz, whose configuration is linked in this project's README.md.
|
2024-08-28 14:17:38 +02:00
|
|
|
workspace =
|
|
|
|
# We're creating several lists of workspace assignments, one for each monitor,
|
|
|
|
# and have to merge them into one big list.
|
|
|
|
(flatten
|
|
|
|
# We then use imap0 insted of map because imap0 starts indexing at zero as oppsed to one with map.
|
|
|
|
(imap0 (monitorIndex: monitorName: (
|
|
|
|
map (
|
|
|
|
i: let
|
|
|
|
# we define our own modulo operation for this,
|
|
|
|
# since only the first workspace on each monitor is the default workspace.
|
|
|
|
mod = a: b: a - (b * (a / b));
|
|
|
|
workspace = toString i;
|
|
|
|
isDefault = (mod i 10) == 1; # 11, 21, 31, ...
|
|
|
|
in "${workspace}, monitor:${monitorName}${optionalString isDefault ", default:true"}"
|
|
|
|
)
|
|
|
|
# we generate a list of 10 elements for each monitor. We have to add 1 each time since genList starts indexing at 0.
|
|
|
|
# also, we add the monitorIndex * 10 to get 10 workspaces for each individual monitor.
|
|
|
|
(genList (i: i + 1 + (10 * monitorIndex)) 10)
|
|
|
|
))
|
|
|
|
# our attrSet of different monitors
|
|
|
|
(attrNames monitors)))
|
|
|
|
# These are my two special workspaces
|
|
|
|
++ [
|
|
|
|
"special:nixos, decorate:false"
|
|
|
|
"special:keepassxc, decorate:false"
|
2024-09-22 19:21:53 +02:00
|
|
|
"special:audio, decorate:false"
|
2024-08-28 14:17:38 +02:00
|
|
|
];
|
2024-08-28 13:52:43 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|