From 27f7be844a054fe08073d7b38d799b3fedf0a7b0 Mon Sep 17 00:00:00 2001 From: Mogria Date: Wed, 31 Jan 2018 22:21:55 +0100 Subject: [PATCH] rofi: use string values for `location` instead of numbers to be more descriptive --- modules/programs/rofi.nix | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index 9e4a22ae..145ee420 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -113,6 +113,17 @@ let (rowsColorsToString colors.rows)} ''; + locationsMap = { + "center" = 0; + "top-left" = 1; + "top" = 2; + "top-right" = 3; + "right" = 4; + "bottom-right" = 5; + "bottom" = 6; + "bottom-left" = 7; + "left" = 8; + }; in { @@ -196,20 +207,9 @@ in }; location = mkOption { - default = 0; - type = types.enum (range 0 8); - description = '' - Location on the screen following the pattern: - - - 1 (top left)2 (top)3 (top right) - 8 (left)0 (center)4 (right) - 7 (bottom left)6 (bottom)5 (bottom right) - - - - ''; - + default = "center"; + type = types.enum (builtins.attrNames locationsMap); + description = "The location rofi appears on the screen."; }; xoffset = mkOption { @@ -287,7 +287,7 @@ in ${setOption "terminal" cfg.terminal} ${setOption "cycle" cfg.cycle} ${setOption "fullscreen" cfg.fullscreen} - ${setOption "location" cfg.location} + ${setOption "location" (builtins.getAttr cfg.location locationsMap)} ${setOption "xoffset" cfg.xoffset} ${setOption "yoffset" cfg.yoffset}