From 3ec7f6fb43ff77cff429aba1a2541d28cc44d37c Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Sun, 28 Nov 2021 15:07:46 -0500 Subject: [PATCH] rofi: fix theme definition in configuration for 1.7.0+ (#2513) Since Rofi 1.7.1 (specifically davatorium/rofi@0e70d8a), the deprecated `theme` option in the `configuration` section no longer works. For 1.7.0 and up, `@theme "name"` is supposed to be used *after* the `configuration` block. --- modules/programs/rofi.nix | 8 ++++---- tests/modules/programs/rofi/custom-theme-config.rasi | 2 +- tests/modules/programs/rofi/custom-theme.rasi | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index 1ae7016b..0c4bc3d8 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -35,10 +35,10 @@ let ${configStr}} '' else - mkKeyValue { + (mkKeyValue { sep = " "; end = ""; - } name value; + } name value) + "\n"; toRasi = attrs: concatStringsSep "\n" (mapAttrsToList mkRasiSection attrs); @@ -266,9 +266,9 @@ in { location = (getAttr cfg.location locationsMap); xoffset = cfg.xoffset; yoffset = cfg.yoffset; - theme = themeName; } // cfg.extraConfig); - }; + # @theme must go after configuration but attrs are output in alphabetical order ('@' first) + } + (optionalString (themeName != null) (toRasi { "@theme" = themeName; })); xdg.dataFile = mkIf (themePath != null) (if themePath == "custom" then { "rofi/themes/${themeName}.rasi".text = toRasi cfg.theme; diff --git a/tests/modules/programs/rofi/custom-theme-config.rasi b/tests/modules/programs/rofi/custom-theme-config.rasi index 639336d9..6b4d5b8a 100644 --- a/tests/modules/programs/rofi/custom-theme-config.rasi +++ b/tests/modules/programs/rofi/custom-theme-config.rasi @@ -1,6 +1,6 @@ configuration { location: 0; -theme: "custom"; xoffset: 0; yoffset: 0; } +@theme "custom" diff --git a/tests/modules/programs/rofi/custom-theme.rasi b/tests/modules/programs/rofi/custom-theme.rasi index b018843f..8ec09709 100644 --- a/tests/modules/programs/rofi/custom-theme.rasi +++ b/tests/modules/programs/rofi/custom-theme.rasi @@ -16,4 +16,4 @@ foreground-color: rgba ( 250, 251, 252, 100 % ); width: 512; } -@import "~/.cache/wal/colors-rofi-dark" \ No newline at end of file +@import "~/.cache/wal/colors-rofi-dark"