terribly overengineered monitor -> workspace function

this probably adds around 20 years of eval time
This commit is contained in:
jacekpoz 2024-08-27 16:07:13 +02:00
parent e628f55645
commit 0bbc352e8f
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -188,17 +188,17 @@ in {
"${name},${w}x${h}@${refresh},${x}x${y},${scale}"
) config.poz.other.hardware.monitors;
workspace = (
# laptop
map (i:
"${i}, monitor:eDP-1${optionalString (i == "1") ", default:true"}"
) (genList (i: toString (i + 1)) 10)
) ++ (
# second monitor
map (i:
"${i}, monitor:HDMI-A-1${optionalString (i == "11") ", default:true"}"
) (genList (i: toString (i + 11)) 10)
) ++ [
# I'm so sorry
workspace = (flatten (imap0 (monitor_index: monitor_name: (
map (i: let
# a % b
mod = a: b: a - (b * (a / b));
workspace = toString i;
isDefault = (mod i 10) == 1; # 11, 21, 31, ...
in
"${workspace}, monitor:${monitor_name}${optionalString isDefault ", default:true"}"
) (genList (i: i + 1 + (10 * monitor_index)) 10)
)) (attrNames config.poz.other.hardware.monitors))) ++ [
# scratchpads
"special:btop, decorate:false"
(mkIf isAmdGpuPresent "special:amdgpu_top, decorate:false")