Browse Source

Use safer way to compose $style

Alois Mahdal 10 years ago
parent
commit
a29deefe38
1 changed files with 9 additions and 7 deletions
  1. 9
    7
      bin/eedmenu.in

+ 9
- 7
bin/eedmenu.in View File

@@ -30,15 +30,17 @@ sb="$(iniread -p style.color.sng)"
30 30
 sf="$(iniread -p style.color.sfg)"
31 31
 fn="$(iniread -p style.font)"
32 32
 fn=${fn:--*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*}
33
-arg_nb="${nb:+-nb $nb}"
34
-arg_nf="${nf:+-nf $nf}"
35
-arg_sb="${sb:+-sb $sb}"
36
-arg_sf="${sf:+-sf $sf}"
37
-arg_fn="${fn:+-fn $fn}"
38
-style="$arg_nb $arg_nf $arg_sb $arg_sf $arg_fn"
33
+
34
+style() {
35
+    test -n "$nb" && echo -n "-nb $nb "
36
+    test -n "$nf" && echo -n "-nf $nf "
37
+    test -n "$sb" && echo -n "-sb $sb "
38
+    test -n "$sf" && echo -n "-sf $sf "
39
+    test -n "$fn" && echo -n "-fn $fn "
40
+}
39 41
 
40 42
 do_split() {
41 43
     cut -d$delim -f2-
42 44
 }
43 45
 
44
-dmenu -i -l $lines $style "$@" | $maybe_split
46
+dmenu -i -l $lines $(style) "$@" | $maybe_split