From e42f845f0950348e44d77e8d19fb1243eed02a71 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Wed, 25 Jan 2023 19:25:35 -0800 Subject: [PATCH] Use substituteAll for fcitx5 theming --- fcitx5/default.nix | 12 ++++++++---- fcitx5/{theme.nix => theme.conf} | 29 ++++++++++------------------- 2 files changed, 18 insertions(+), 23 deletions(-) rename fcitx5/{theme.nix => theme.conf} (61%) diff --git a/fcitx5/default.nix b/fcitx5/default.nix index 4ad50e5..adb4c33 100644 --- a/fcitx5/default.nix +++ b/fcitx5/default.nix @@ -1,7 +1,7 @@ { pkgs, ... }: -let - themeFolder = ".local/share/fcitx5/themes/Theme/"; +with import ../theme; let + themeFolder = ".local/share/fcitx5/themes/${theme}/"; in { i18n.inputMethod = { @@ -10,9 +10,13 @@ in }; home.file = { - "${themeFolder}theme.conf".text = import ./theme.nix; + "${themeFolder}theme.conf".source = with colors; pkgs.substituteAll ({ + src = ./theme.conf; + background = "${bg1}80"; + highlight = bg0; + } // colors); "${themeFolder}arrow.png".source = ./arrow.png; "${themeFolder}radio.png".source = ./radio.png; - ".config/fcitx5/conf/classicui.conf".text = "Theme=Theme"; + ".config/fcitx5/conf/classicui.conf".text = "Theme=${theme}"; }; } diff --git a/fcitx5/theme.nix b/fcitx5/theme.conf similarity index 61% rename from fcitx5/theme.nix rename to fcitx5/theme.conf index b9e0ea3..ac6f54e 100644 --- a/fcitx5/theme.nix +++ b/fcitx5/theme.conf @@ -1,20 +1,12 @@ -# Modified from https://github.com/tonyfettes/fcitx5-nord -let - theme = import ../theme; -in with theme.colors; let - background = "${bg1}80"; - highlight = "${bg0}"; -in -'' [Metadata] ScaleWithDPI=True [InputPanel] Font=Sans 13 -NormalColor=${fg0} -HighlightCandidateColor=${fg1}; -HighlightColor=${undefined} -HighlightBackgroundColor=${undefined} +NormalColor=@fg0@ +HighlightCandidateColor=@fg1@; +HighlightColor=@undefined@ +HighlightBackgroundColor=@undefined@ Spacing=3 [InputPanel/TextMargin] @@ -24,7 +16,7 @@ Top=6 Bottom=6 [InputPanel/Background] -Color=${background} +Color=@background@ [InputPanel/Background/Margin] Left=2 @@ -33,7 +25,7 @@ Top=2 Bottom=2 [InputPanel/Highlight] -Color=${highlight} +Color=@highlight@ [InputPanel/Highlight/Margin] Left=10 @@ -43,11 +35,11 @@ Bottom=7 [Menu] Font=Sans 10 -NormalColor=${fg0} +NormalColor=@fg0@ Spacing=3 [Menu/Background] -Color=${background} +Color=@background@ [Menu/Background/Margin] Left=2 @@ -62,7 +54,7 @@ Top=2 Bottom=2 [Menu/Highlight] -Color=${highlight} +Color=@highlight@ [Menu/Highlight/Margin] Left=10 @@ -71,7 +63,7 @@ Top=5 Bottom=5 [Menu/Separator] -Color=${highlight} +Color=@highlight@ [Menu/CheckBox] Image=radio.png @@ -84,4 +76,3 @@ Left=5 Right=5 Top=5 Bottom=5 -''