nixos/modules/desktop/dms/bar.nix

142 lines
3.3 KiB
Nix
Raw Normal View History

2025-12-12 04:02:55 +01:00
{
config,
lib,
...
}: let
2025-12-14 04:09:59 +01:00
hasMonitors = config.monitors != [];
commonBarSettings = {
enabled = true;
position = 0;
spacing = 0;
2025-12-13 16:06:58 +01:00
innerPadding = -4;
bottomGap = -9;
transparency = 0;
widgetTransparency = 1;
squareCorners = true;
noBackground = false;
gothCornersEnabled = false;
gothCornerRadiusOverride = false;
gothCornerRadiusValue = 12;
borderEnabled = false;
borderColor = "primary";
borderOpacity = 1;
borderThickness = 2;
widgetOutlineEnabled = false;
widgetOutlineColor = "primary";
widgetOutlineOpacity = 1;
widgetOutlineThickness = 1;
fontScale = 1;
autoHide = false;
autoHideDelay = 250;
openOnOverview = false;
visible = true;
popupGapsAuto = true;
popupGapsManual = 4;
maximizeDetection = true;
};
2025-12-13 16:06:58 +01:00
2025-12-14 04:09:59 +01:00
primaryMonitor =
if hasMonitors
then builtins.head config.monitors
else {};
2025-12-13 16:06:58 +01:00
primaryX = primaryMonitor.position.x or 0;
# Partition secondary monitors into left and right based on their x position relative to primary
2025-12-14 04:09:59 +01:00
secondaryMonitors =
if hasMonitors
then builtins.tail config.monitors
else [];
2025-12-13 16:06:58 +01:00
leftMonitors = builtins.filter (m: (m.position.x or 0) <= primaryX) secondaryMonitors;
rightMonitors = builtins.filter (m: (m.position.x or 0) > primaryX) secondaryMonitors;
primaryBar =
{
id = "default";
name = "Primary Bar";
screenPreferences = [
{
2025-12-13 16:06:58 +01:00
name = primaryMonitor.name or "";
}
];
showOnLastDisplay = true;
leftWidgets = [
"launcherButton"
2025-12-13 16:06:58 +01:00
"clock"
"workspaceSwitcher"
"runningApps"
];
centerWidgets = [
"focusedWindow"
];
2025-12-27 00:32:56 +01:00
rightWidgets =
[
"music"
"systemTray"
"cpuUsage"
"controlCenterButton"
]
++ lib.optional config.fireproof.hardware.battery "battery" ++ ["notificationButton"];
}
// commonBarSettings;
2025-12-13 16:06:58 +01:00
leftSecondaryBar =
{
id = "secondary-left";
name = "Secondary Bar (Left)";
2025-12-13 19:41:40 +01:00
screenPreferences =
builtins.map (monitor: {
inherit (monitor) name;
})
leftMonitors;
2025-12-13 16:06:58 +01:00
showOnLastDisplay = false;
leftWidgets = [];
centerWidgets = [];
rightWidgets = [
"workspaceSwitcher"
];
}
// commonBarSettings;
rightSecondaryBar =
{
2025-12-13 16:06:58 +01:00
id = "secondary-right";
name = "Secondary Bar (Right)";
2025-12-13 19:41:40 +01:00
screenPreferences =
builtins.map (monitor: {
inherit (monitor) name;
})
rightMonitors;
showOnLastDisplay = false;
leftWidgets = [
"workspaceSwitcher"
];
centerWidgets = [];
rightWidgets = [];
}
// commonBarSettings;
2025-12-13 16:06:58 +01:00
# Only include secondary bars if they have monitors assigned
secondaryBars =
(lib.optional (leftMonitors != []) leftSecondaryBar)
++ (lib.optional (rightMonitors != []) rightSecondaryBar);
in {
2025-12-12 04:02:55 +01:00
config = lib.mkIf config.fireproof.desktop.enable {
fireproof.home-manager = {
2026-01-19 17:44:37 +01:00
programs.dank-material-shell.settings = {
2025-12-12 04:02:55 +01:00
launcherLogoMode = "os";
launcherLogoContrast = 1;
launcherLogoSizeOffset = 3;
2025-12-12 04:02:55 +01:00
centeringMode = "geometric";
2025-12-12 04:02:55 +01:00
runningAppsCurrentWorkspace = true;
runningAppsGroupByApp = true;
2025-12-13 16:06:58 +01:00
barConfigs = [primaryBar] ++ secondaryBars;
2025-12-12 04:02:55 +01:00
};
};
};
}