1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

i3-sway: fix indentation of bar blocks (#3978)

The `indent` function unindents the first and last line by default, so
the `"bar {"` `"}"` wrapper should go inside the list.
This commit is contained in:
Naïm Favier 2023-05-11 14:04:29 +02:00 committed by GitHub
parent d991776527
commit 2f6a917ade
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 61 additions and 72 deletions

View file

@ -72,31 +72,26 @@ 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 ]
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 (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 ${
(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 ] [
(optionals colorsNotNull (indent (lists.subtractLists [ "" null ] [
"colors {"
(optionalString (colors.background != null)
"background ${colors.background}")
@ -111,15 +106,11 @@ rec {
(optionalString (colors.focusedSeparator != null)
"focused_separator ${colors.focusedSeparator}")
(optionalString (colors.focusedWorkspace != null)
"focused_workspace ${
barColorSetStr colors.focusedWorkspace
}")
"focused_workspace ${barColorSetStr colors.focusedWorkspace}")
(optionalString (colors.activeWorkspace != null)
"active_workspace ${barColorSetStr colors.activeWorkspace}")
(optionalString (colors.inactiveWorkspace != null)
"inactive_workspace ${
barColorSetStr colors.inactiveWorkspace
}")
"inactive_workspace ${barColorSetStr colors.inactiveWorkspace}")
(optionalString (colors.urgentWorkspace != null)
"urgent_workspace ${barColorSetStr colors.urgentWorkspace}")
(optionalString (colors.bindingMode != null)
@ -127,10 +118,8 @@ rec {
"}"
]) { }))
extraConfig
])) { })
}
}
'';
"}"
])) { });
gapsStr = with cfg.config.gaps;
concatStringsSep "\n" (lists.subtractLists [ "" null ] [