mirror of
https://github.com/nix-community/home-manager
synced 2024-12-27 12:19:48 +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:
parent
d991776527
commit
2f6a917ade
14 changed files with 61 additions and 72 deletions
|
@ -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 ] [
|
||||
|
|
|
@ -94,6 +94,6 @@ bar {
|
|||
inactive_workspace #333333 #222222 #888888
|
||||
urgent_workspace #2f343a #900000 #ffffff
|
||||
binding_mode #2f343a #900000 #ffffff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,6 @@ bar {
|
|||
inactive_workspace #333333 #222222 #888888
|
||||
urgent_workspace #2f343a #900000 #ffffff
|
||||
binding_mode #2f343a #900000 #ffffff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,6 @@ bar {
|
|||
inactive_workspace #333333 #222222 #888888
|
||||
urgent_workspace #2f343a #900000 #ffffff
|
||||
binding_mode #2f343a #900000 #ffffff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,6 @@ bar {
|
|||
inactive_workspace #333333 #222222 #888888
|
||||
urgent_workspace #2f343a #900000 #ffffff
|
||||
binding_mode #2f343a #900000 #ffffff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,6 @@ bar {
|
|||
inactive_workspace #333333 #222222 #888888
|
||||
urgent_workspace #2f343a #900000 #ffffff
|
||||
binding_mode #2f343a #900000 #ffffff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ bar {
|
|||
inactive_workspace #333333 #222222 #888888
|
||||
urgent_workspace #2f343a #900000 #ffffff
|
||||
binding_mode #2f343a #900000 #ffffff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
workspace "1" output eDP
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -100,7 +100,7 @@ bar {
|
|||
inactive_workspace #333333 #222222 #888888
|
||||
urgent_workspace #2f343a #900000 #ffffff
|
||||
binding_mode #2f343a #900000 #ffffff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
workspace "1" output eDP
|
||||
|
|
Loading…
Reference in a new issue