diff --git a/modules/services/window-managers/i3-sway/lib/functions.nix b/modules/services/window-managers/i3-sway/lib/functions.nix index 4395f38b7..d8f51e785 100644 --- a/modules/services/window-managers/i3-sway/lib/functions.nix +++ b/modules/services/window-managers/i3-sway/lib/functions.nix @@ -72,65 +72,54 @@ rec { , workspaceNumbers, command, statusCommand, colors, trayOutput, trayPadding , extraConfig, ... }: let colorsNotNull = lib.filterAttrs (n: v: v != null) colors != { }; - in '' - bar { - ${ - concatStringsSep "\n" (indent (lists.subtractLists [ "" null ] - (flatten [ - (optionalString (id != null) "id ${id}") - (fontConfigStr fonts) - (optionalString (mode != null) "mode ${mode}") - (optionalString (hiddenState != null) - "hidden_state ${hiddenState}") - (optionalString (position != null) "position ${position}") - (optionalString (statusCommand != null) - "status_command ${statusCommand}") - "${moduleName}bar_command ${command}" - (optionalString (workspaceButtons != null) - "workspace_buttons ${lib.hm.booleans.yesNo workspaceButtons}") - (optionalString (workspaceNumbers != null) - "strip_workspace_numbers ${ - lib.hm.booleans.yesNo (!workspaceNumbers) - }") - (optionalString (trayOutput != null) "tray_output ${trayOutput}") - (optionalString (trayPadding != null) - "tray_padding ${toString trayPadding}") - (optionals colorsNotNull (indent - (lists.subtractLists [ "" null ] [ - "colors {" - (optionalString (colors.background != null) - "background ${colors.background}") - (optionalString (colors.statusline != null) - "statusline ${colors.statusline}") - (optionalString (colors.separator != null) - "separator ${colors.separator}") - (optionalString (colors.focusedBackground != null) - "focused_background ${colors.focusedBackground}") - (optionalString (colors.focusedStatusline != null) - "focused_statusline ${colors.focusedStatusline}") - (optionalString (colors.focusedSeparator != null) - "focused_separator ${colors.focusedSeparator}") - (optionalString (colors.focusedWorkspace != null) - "focused_workspace ${ - barColorSetStr colors.focusedWorkspace - }") - (optionalString (colors.activeWorkspace != null) - "active_workspace ${barColorSetStr colors.activeWorkspace}") - (optionalString (colors.inactiveWorkspace != null) - "inactive_workspace ${ - barColorSetStr colors.inactiveWorkspace - }") - (optionalString (colors.urgentWorkspace != null) - "urgent_workspace ${barColorSetStr colors.urgentWorkspace}") - (optionalString (colors.bindingMode != null) - "binding_mode ${barColorSetStr colors.bindingMode}") - "}" - ]) { })) - extraConfig - ])) { }) - } - } - ''; + in concatMapStrings (x: x + "\n") (indent (lists.subtractLists [ "" null ] + (flatten [ + "bar {" + (optionalString (id != null) "id ${id}") + (fontConfigStr fonts) + (optionalString (mode != null) "mode ${mode}") + (optionalString (hiddenState != null) "hidden_state ${hiddenState}") + (optionalString (position != null) "position ${position}") + (optionalString (statusCommand != null) + "status_command ${statusCommand}") + "${moduleName}bar_command ${command}" + (optionalString (workspaceButtons != null) + "workspace_buttons ${lib.hm.booleans.yesNo workspaceButtons}") + (optionalString (workspaceNumbers != null) "strip_workspace_numbers ${ + lib.hm.booleans.yesNo (!workspaceNumbers) + }") + (optionalString (trayOutput != null) "tray_output ${trayOutput}") + (optionalString (trayPadding != null) + "tray_padding ${toString trayPadding}") + (optionals colorsNotNull (indent (lists.subtractLists [ "" null ] [ + "colors {" + (optionalString (colors.background != null) + "background ${colors.background}") + (optionalString (colors.statusline != null) + "statusline ${colors.statusline}") + (optionalString (colors.separator != null) + "separator ${colors.separator}") + (optionalString (colors.focusedBackground != null) + "focused_background ${colors.focusedBackground}") + (optionalString (colors.focusedStatusline != null) + "focused_statusline ${colors.focusedStatusline}") + (optionalString (colors.focusedSeparator != null) + "focused_separator ${colors.focusedSeparator}") + (optionalString (colors.focusedWorkspace != null) + "focused_workspace ${barColorSetStr colors.focusedWorkspace}") + (optionalString (colors.activeWorkspace != null) + "active_workspace ${barColorSetStr colors.activeWorkspace}") + (optionalString (colors.inactiveWorkspace != null) + "inactive_workspace ${barColorSetStr colors.inactiveWorkspace}") + (optionalString (colors.urgentWorkspace != null) + "urgent_workspace ${barColorSetStr colors.urgentWorkspace}") + (optionalString (colors.bindingMode != null) + "binding_mode ${barColorSetStr colors.bindingMode}") + "}" + ]) { })) + extraConfig + "}" + ])) { }); gapsStr = with cfg.config.gaps; concatStringsSep "\n" (lists.subtractLists [ "" null ] [ diff --git a/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf b/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf index 3b8fca8a2..80a3e7533 100644 --- a/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf @@ -94,6 +94,6 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } diff --git a/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf b/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf index dccf535a3..22231abda 100644 --- a/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf @@ -91,6 +91,6 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } diff --git a/tests/modules/services/window-managers/i3/i3-fonts-expected.conf b/tests/modules/services/window-managers/i3/i3-fonts-expected.conf index 8e8cb9da3..e2606b320 100644 --- a/tests/modules/services/window-managers/i3/i3-fonts-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-fonts-expected.conf @@ -91,6 +91,6 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } diff --git a/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf b/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf index 2b7251d2f..34460f120 100644 --- a/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf @@ -92,6 +92,6 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } diff --git a/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf b/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf index baca14115..cf4f62df3 100644 --- a/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf @@ -90,6 +90,6 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } diff --git a/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf b/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf index a51edb9a0..9aca04fca 100644 --- a/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf @@ -91,7 +91,7 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } workspace "1" output eDP diff --git a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf index 406cee124..795ad59d9 100644 --- a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf +++ b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf @@ -103,7 +103,7 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf index 303610879..8b11cc1f6 100644 --- a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf +++ b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf @@ -102,7 +102,7 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-default.conf b/tests/modules/services/window-managers/sway/sway-default.conf index c733335e5..be9160620 100644 --- a/tests/modules/services/window-managers/sway/sway-default.conf +++ b/tests/modules/services/window-managers/sway/sway-default.conf @@ -100,7 +100,7 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-modules.conf b/tests/modules/services/window-managers/sway/sway-modules.conf index a1b8b53ea..b53d95bff 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.conf +++ b/tests/modules/services/window-managers/sway/sway-modules.conf @@ -112,7 +112,7 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-null-package.conf b/tests/modules/services/window-managers/sway/sway-null-package.conf index c733335e5..be9160620 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.conf +++ b/tests/modules/services/window-managers/sway/sway-null-package.conf @@ -100,7 +100,7 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf index d4f8fe35e..34924bb1a 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf @@ -99,7 +99,7 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf index 17ff25a7c..3fd76e0ef 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf @@ -100,7 +100,7 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff -} + } } workspace "1" output eDP