mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
waybar: fix deprecated "modules" setting check (#2646)
- The check did not account the default value of `settings.modules` to be `{}`. The default value was changed to null. - The `settings.modules` option is now hidden from the docs.
This commit is contained in:
parent
60d2c9660b
commit
9bceb8292e
1 changed files with 18 additions and 18 deletions
|
@ -97,7 +97,8 @@ let
|
||||||
|
|
||||||
modules = mkOption {
|
modules = mkOption {
|
||||||
type = jsonFormat.type;
|
type = jsonFormat.type;
|
||||||
default = { };
|
visible = false;
|
||||||
|
default = null;
|
||||||
description = "Modules configuration.";
|
description = "Modules configuration.";
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
|
@ -176,7 +177,7 @@ in {
|
||||||
modules-left = [ "sway/workspaces" "sway/mode" "wlr/taskbar" ];
|
modules-left = [ "sway/workspaces" "sway/mode" "wlr/taskbar" ];
|
||||||
modules-center = [ "sway/window" "custom/hello-from-waybar" ];
|
modules-center = [ "sway/window" "custom/hello-from-waybar" ];
|
||||||
modules-right = [ "mpd" "custom/mymodule#with-css-id" "temperature" ];
|
modules-right = [ "mpd" "custom/mymodule#with-css-id" "temperature" ];
|
||||||
modules = {
|
|
||||||
"sway/workspaces" = {
|
"sway/workspaces" = {
|
||||||
disable-scroll = true;
|
disable-scroll = true;
|
||||||
all-outputs = true;
|
all-outputs = true;
|
||||||
|
@ -190,7 +191,6 @@ in {
|
||||||
''';
|
''';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -244,7 +244,7 @@ in {
|
||||||
config = let
|
config = let
|
||||||
# Removes nulls because Waybar ignores them.
|
# Removes nulls because Waybar ignores them.
|
||||||
# This is not recursive.
|
# This is not recursive.
|
||||||
removeNulls = filterAttrs (_: v: v != null);
|
removeTopLevelNulls = filterAttrs (_: v: v != null);
|
||||||
|
|
||||||
# Makes the actual valid configuration Waybar accepts
|
# Makes the actual valid configuration Waybar accepts
|
||||||
# (strips our custom settings before converting to JSON)
|
# (strips our custom settings before converting to JSON)
|
||||||
|
@ -254,8 +254,8 @@ in {
|
||||||
# as its descendants have to live at the top-level
|
# as its descendants have to live at the top-level
|
||||||
settingsWithoutModules = removeAttrs configuration [ "modules" ];
|
settingsWithoutModules = removeAttrs configuration [ "modules" ];
|
||||||
settingsModules =
|
settingsModules =
|
||||||
optionalAttrs (configuration.modules != { }) configuration.modules;
|
optionalAttrs (configuration.modules != null) configuration.modules;
|
||||||
in removeNulls (settingsWithoutModules // settingsModules);
|
in removeTopLevelNulls (settingsWithoutModules // settingsModules);
|
||||||
|
|
||||||
# Allow using attrs for settings instead of a list in order to more easily override
|
# Allow using attrs for settings instead of a list in order to more easily override
|
||||||
settings = if builtins.isAttrs cfg.settings then
|
settings = if builtins.isAttrs cfg.settings then
|
||||||
|
@ -276,7 +276,7 @@ in {
|
||||||
({
|
({
|
||||||
assertion =
|
assertion =
|
||||||
if lib.versionAtLeast config.home.stateVersion "22.05" then
|
if lib.versionAtLeast config.home.stateVersion "22.05" then
|
||||||
all (x: !hasAttr "modules" x) settings
|
all (x: !hasAttr "modules" x || x.modules == null) settings
|
||||||
else
|
else
|
||||||
true;
|
true;
|
||||||
message = ''
|
message = ''
|
||||||
|
|
Loading…
Reference in a new issue