From 05d655146b1e98bf38c57e2ed2bea0f354e73388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Sun, 9 Jan 2022 23:15:24 +0100 Subject: [PATCH] rofi: allow extending themes (#2571) Move @import and @theme directives to the top of custom theme definitions so as to allow extending other themes. --- modules/programs/rofi.nix | 7 ++++++- tests/modules/programs/rofi/custom-theme.rasi | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index 0c4bc3d8..f4edf1a3 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -40,7 +40,12 @@ let end = ""; } name value) + "\n"; - toRasi = attrs: concatStringsSep "\n" (mapAttrsToList mkRasiSection attrs); + toRasi = attrs: + concatStringsSep "\n" (concatMap (mapAttrsToList mkRasiSection) [ + (filterAttrs (n: _: n == "@theme") attrs) + (filterAttrs (n: _: n == "@import") attrs) + (removeAttrs attrs [ "@theme" "@import" ]) + ]); locationsMap = { center = 0; diff --git a/tests/modules/programs/rofi/custom-theme.rasi b/tests/modules/programs/rofi/custom-theme.rasi index 8ec09709..b479e7b7 100644 --- a/tests/modules/programs/rofi/custom-theme.rasi +++ b/tests/modules/programs/rofi/custom-theme.rasi @@ -1,3 +1,5 @@ +@import "~/.cache/wal/colors-rofi-dark" + #inputbar { children: [ prompt,entry ]; } @@ -15,5 +17,3 @@ border-color: #FFFFFF; foreground-color: rgba ( 250, 251, 252, 100 % ); width: 512; } - -@import "~/.cache/wal/colors-rofi-dark"