Automatically install third-party widget if it is present in a panel (#236)

This commit is contained in:
Heitor Augusto 2024-06-30 16:18:53 -03:00 committed by GitHub
parent 121424d140
commit 16012b09e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,7 @@
} @ args:
let
cfg = config.programs.plasma;
hasWidget = widgetName: builtins.any (panel: builtins.any (widget: widget.name == widgetName) panel.widgets) cfg.panels;
widgets = import ./widgets args;
@ -145,7 +146,7 @@ in
# these should run at the same time.
config = (lib.mkIf cfg.enable {
home.packages = with pkgs; []
++ lib.optionals (lib.elem "application-title-bar" cfg.extraWidgets) [ application-title-bar ];
++ lib.optionals (lib.elem "application-title-bar" cfg.extraWidgets || hasWidget "com.github.antroids.application-title-bar") [ application-title-bar ];
programs.plasma.startup.desktopScript."panels_and_wallpaper" = (lib.mkIf anyPanelOrWallpaperSet
(