58 lines
2.4 KiB
Nix
58 lines
2.4 KiB
Nix
|
{
|
||
|
config,
|
||
|
lib,
|
||
|
...
|
||
|
}: let
|
||
|
inherit (config.modules.other.system) username;
|
||
|
inherit (config.modules.system.hardware) monitors;
|
||
|
inherit (lib) imap0 flatten optionalString;
|
||
|
inherit (builtins) map genList attrNames toString;
|
||
|
in {
|
||
|
home-manager.users.${username} = {
|
||
|
wayland.windowManager.hyprland = {
|
||
|
settings = {
|
||
|
# 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"
|
||
|
# ];
|
||
|
|
||
|
# 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.
|
||
|
# To be able to use this for a varying amount of monitors we do some nasty trickery:
|
||
|
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"
|
||
|
];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|